Using openHASP with Node-Red

@Steve-Mcl To quote an often heard trope "PR's are welcome" :wink:

1 Like

The next paragraph is more clear -

Issuing commands~

Commands can be issued via the Serial commandline, telnet commandline or MQTT.

For MQTT, you can use either:

  • hasp/<nodename>/command topic with payload <keyword>=<parameter(s)>
  • hasp/<nodename>/command/<keyword> topic with payload <parameter(s)>
    Leave the payload empty to get the current state without changing it.

Many thanks!

I'll have a go and let you know!

B.

1 Like

@bwims What type of screen are you using and what is the resolution please?

Hi there. It's an ESP32 terminal by Elecrow bought from SB Components here.

Resolution 230 x 480. Works really well.

Incidentally, I'm very impressed with your massive project. It'll take me some time to go through it. Could you do me a favour and point to the documentation that describes how to program a popup?
(Also, where the initial popup with the ip address defined?) - but only if it's no problem!

(This is the one I mean)

image

Thanks!

B.

that popup is setup by default when you flash the firmware -

jsonl {"page":0,"id":239,"obj":"msgbox","text":"%ip%","auto_close":20000}

its in /online.cmd, which you can see in file editor

Thanks!

B.

Latest update, screen resolution and rotation is now retrieved from the Hasp device, so the same layout will now scale to whatever the dimentions and orientaion of the screen are.

One more thing that doesn't need to be setup by the user :wink:

Sunton 7" 800x480 rotated 90 degrees

I will update the code above once I get the cover control popup finished.

1 Like

Sunton 7" screen masquerading as a picture frame :wink:

3 Likes

Recent updates -
request by @jbudd, Reduced number of MQTT nodes by using swich nodes to route topics.

Thanks to the overwhelming feedback on my survey (4 for v 4 against) :wink:
I made both header and footer menus optional, content will adjust to the extra space, handy if you only want one layout on the device, or want to create a different menu system.

Various other overrides added to the theme, for more customisation of widgets etc.

Further reduced the amount of setup required by using hierarchical defaults for most things, so only changes from those need to be setup per screen.

New widget to display an incoming image buffer, resizes the image, converts to PNG, saves to host, triggers HASP to display the image directly from host for a configurable time, then returns to previous screen, timeout can also be cancelled by tapping the screen.

image

I won't upload just yet as I'm still making changes, but if anyone wants to try it, let me know and I can do so.

2 Likes

hi. Do you have animated blinds? :slight_smile: I'm searching for my own now how to make it look real or animated.

See post 48 https://discourse.nodered.org/t/using-openhasp-with-node-red/81457/48

Since then I have removed the sliders on the page and created hidden sliders, so that you can drag the actual blind to change position. see post 70 Using openHASP with Node-Red - #70 by smcgann99 this is for a vertical blind, but the "widget" can be used for curtains etc also.

Regarding animation, to reduce the number of messages, the blind position is only updated when you stop dragging.

Hello, did any of you try to build a line chart on the plate through Node-RED ?

Not yet. You may try to use the line object. Post an example of your chart data.

1 Like

This is the latest flow (11/04/24), if anyone would like to give it a try and provide some feed back.

NOTE this version uses the following contrib node for the CCTV / Image Popup widget

openhasp flow.zip (2).txt (45.9 KB)

Remove the .txt extension and then unzip. Copy the text and import into NR.

Set all MQTT nodes to your own server.

On the hasp device go to HASP Design and choose Material Dark theme, then in MQTT settings set the hostname (topic) to "1". Reboot hasp and hopefully you should see some content :wink:

In NR there a a green coloured group, the Setup Pages Layout contains a large JSON object which defines the screen content ( I will document this better when I get time).

There is also Setup Theme function, this contains most of the default setup

When editing the two functions, just be careful not to break the JSON formatting :wink:

Please feel free to experiment and let me know of any issues you have.

I love how far you have taken this. Keep up the great work

I have some of the 4inch screens - (Lanbon) but really questioning how much effort to put into this as against buying a cheap android tablet and just doing a webpage/dashboard page

Craig

1 Like

Hi Craig,

Been there done that with not so cheap tablets. One was sat on my desk for testing always plugged in, now the battery has presumably died and it will not stay on even when powered :rage:
At some point I will get around to fixing it, but it was still a bit laggy with NR desktop.

You can get some really nice, HASP supported screens in the £20 to £30 range, so you could fill your house for the price of a decent tablet :wink:

Also with my flow there isn't much effort, give it a try :grinning:

Even more so as it works with Tasmota out of the box!

Tablets and mobiles, especially cheap and older models, have always had issues with Dashboard. Dashboard is a BEAST and requires a lot of local resources. Hopefully Dashboard 2 is better but there is always UIBUILDER of course if you need something more performant. :wink:

Wow you have been busy. I imported the latest update but I haven't setup my test plate to use it yet. I was looking around and wondering how does the plate control the HA components and get feedback to the plates?

You mean of my flow ?

The two groups - Devices to Hasp and Hasp to devices are where I handle the input / output.

It is based on topics, e.g. for a Tasmota device, a button entry in the layout JSON might look like this -

 { text:"\n",value_str: "Main", props:{ topic:"loungelights/POWER2",type:"tas" } }

image
That's how you define the button style, the icon and text to be shown on the button, also the Topic to publish to when the button is pressed.

The button events are routed based on topic and or type and publish a command to toggle the relevant device.

The Devices to Hasp group listens for incoming updates from the devices and handles the button appearance - either off or on.
image