Home Automation Switch Plate (HASP) - DIY touch controller

People,
for those willing to have a “fancier” HASP, I have developed a set of background images to be used with the original HASP software. I have commited everything to my GitHub repo, as well as some rules example for using it. Please check it out at https://github.com/lspaula/Nextion-background-for-HASwitchPlate

4 Likes

Ok I’m officially at a loss as to where to look here. I have a screen and board freshly flashed with the newest versions on github. Saved the rules, items, sitemap from github. Booted and setup the screen to connect. It gets a successful message, load the site map, and nothing changes on the screen nor does the site map update with the stats from plate01.

I’m using openhab 2.4 with the embedded mqtt broker. I am able to use my 16relay mysensor mega setup and 5 of the 8 sonoff devices I’m setting up connect and send/receive messages. I’m not sure what I’m doing wrong. The only message I see relating to the plate01 in the log are the messages from site map changing and a notification when the plate connects saying no session.

@Devon_H - if you’re using the Embedded broker, that means you’re using the MQTTv2 binding. The items file I have in the first post is still written for MQTTv1 (which is what I’m using currently). I haven’t had time to convert all of my MQTT devies to v2 yet, but fortunately, @pkhajanchi created a compatible set of .items & .things files in his post earlier this year. You should be able to use his configuration directly with my rules/sitemap entries. Once I have more time, I will convert my items (and update the top post with the V2 configuration).

Oooh. I though I read that the new coding was uploaded to github already. Guess that would make sense. I will browse up and find the other code and plug it in to see what happens. Much appreciated.

Edit: Took a little bit of messing around to get the broker set right… but we successfully have a screen and has buttons… now, let the fun begin. As soon as I’m done rewiring a pinsetter.

2 Likes

Hello

Can you show how to make the plate send mqtt to a wled ,I have tried
different things but i can not find were to change a dimmer mqtt masage
to show up Clint_id : PIXEL_LED.
I tried in items to change but not really whit any luck please help

You would use a rule to send state changes in mqtt to wled.

So in the rule


rule "Handle HASP Master"

when

    Item HASP_Plate01_Plate_State_JSON_Value received update

then

    //parse out data from JSON string (page, button, value)

    var String eventpage = HASP_Plate01_Plate_State_JSON_Event.state.toString.split("\\[").get(1).split("\\]").get(0)

You have an area to put your code

//Insert action to perform if button 4 was pressed

Lets say your have an item like

Number WLedStringTestPresets  "Preset" <text> {channel="wled:wled:Auto001:test:presets"

Then you in the rule you would send a command to change the item

WLedStringTestPresets.sendCommand(1)

This should start preset 1

So your rule should look like

                        if (eventbutton == '4')
                        {
                            //Insert action to perform if button 4 was pressed
                            WLedStringTestPresets.sendCommand(1)
                        }

I can no longer call mine a hasp plate because it looks like
Lcars 24 ud

2 Likes

Sorry but you did see it was a DIMMER value i need to send right ,not a (1) ?

Dimmer 1 :

 if (HASP_Plate01_Plate_State_JSON_Value.state != 'ON'){
    HASP_Plate01_Light_Dimmer.sendCommand(HASP_Plate01_Plate_State_JSON_Value.state.toString)

I don`t realy know how to put in either the channel or string value in the Hasp rule

Udklip

Its confusing I know.

I thought you wanted to press a button on screen to do something in wled.

You can’t just send a value to hasp firmware as it has know idea what you want to do with that value you sent.

You need to format you data in json payload and send that to the hasp firmware through mqtt for the hasp firmware to send to nextion screen.

Now what exactly are you trying to do?

Send a dimmer value from a slider on the screen to wled?

Change a dimmer value in sitemap or wled app and have it sync the value on the nextion?

Can you control wled from openhab?

This please :smiley:
Send a dimmer value from a slider on the Haspplate screen to wled ?
i`m building my kitchen lights to led whit RGBWW led strips so it can do stuf and just turn on as normal (the last part i have working whit a botten on the wall i do have live power in lamp too )

Ok

Do you have WLED working in openhab?
Did you use the binding here

What is the name of your WLED dimmer item?

In the interest of time I will assume you have these working.

Item

Dimmer WLedStringTestDimmer   "level"     {channel="wled:wled:Auto001:test:colour"}

Lets use the Slider on page 8 located at b9

When it changes it triggers the code in this section

else if (eventbutton == '9')
 {
 //Insert action to perform if dimmer 9 was moved
 }

We only want it to run if the value is not = to ON
So add

else if (eventbutton == '9')
{
    //Insert action to perform if dimmer 9 was moved

    if (HASP_Plate01_Plate_State_JSON_Value.state != 'ON') {               
        WLedStringTestDimmer.sendCommand(HASP_Plate01_Plate_State_JSON_Value.state.toString) 
    }
 }

Make sure you can control wled through sitemap first.

Make sure in the log you are getting command from HASP in the log file like

HASP_Plate01_Plate_State_JSON changed from {"event":"p[8].b[9]", "value":"ON"} to {"event":"p[8].b[9].val", "value":21}

Great work, I have the basic HASP working but it seems that OH is slow to respond and change screens or turn on the backlight.

Sometimes it is quick (with some screen flicker) other times the screen lights up but there is a massive delay.

Below is the log of one of the delays, it was unresponsive then seemed to run through everything at once, is this a OH (2.5 running on Pi 3 B v1.2) or a rules issue?
Note: Mosquitto MQTT shows no delays and the LED flashes (on the back of the Wemo D1 r2) with every screen press.
Any ideas how to fix this or where to look?
Thanks

2020-03-01 21:52:52.852 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Light_Power’ received command ON

2020-03-01 21:52:52.863 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Light_Power’ received command ON

2020-03-01 21:52:52.879 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Plate_Command_JSON’ received command [“p[2].b[4].txt="O: 4.6 °C"”, “p[2].b[5].txt="I: 20.8 °C"”, “p[2].b[6].txt="Sunday"”, “p[2].b[7].txt="01.Mar.2020"”]

2020-03-01 21:52:52.894 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Light_Power’ received command ON

2020-03-01 21:52:52.903 [vent.ItemStateChangedEvent] - HASP_Plate01_Light_Power changed from OFF to ON

2020-03-01 21:52:52.917 [vent.ItemStateChangedEvent] - HASP_Plate01_Plate_Command_JSON changed from [“p[1].b[4].font=2”, “p[1].b[5].font=2”, “p[1].b[6].font=2”, “p[1].b[7].font=2”, “p[2].b[4].font=2”, “p[2].b[5].font=2”, “p[2].b[6].font=2”, “p[2].b[7].font=1”, “p[3].b[4].font=1”, “p[3].b[5].font=1”, “p[3].b[6].font=1”, “p[3].b[7].font=1”, “p[4].b[4].font=1”, “p[4].b[5].font=1”, “p[4].b[6].font=1”, “p[5].b[4].font=1”, “p[5].b[5].font=1”, “p[5].b[6].font=1”, “p[6].b[4].font=1”, “p[6].b[5].font=1”, “p[6].b[6].font=1”, “p[6].b[7].font=1”, “p[6].b[8].font=1”, “p[6].b[9].font=1”, “p[6].b[10].font=1”, “p[6].b[11].font=1”, “p[7].b[4].font=3”, “p[7].b[5].font=3”, “p[7].b[6].font=3”, “p[7].b[7].font=3”, “p[7].b[8].font=3”, “p[7].b[9].font=3”, “p[7].b[10].font=3”, “p[7].b[11].font=3”, “p[7].b[12].font=3”, “p[7].b[13].font=3”, “p[7].b[14].font=3”, “p[7].b[15].font=3”, “p[8].b[4].font=1”, “p[8].b[5].font=1”, “p[8].b[6].font=1”, “p[8].b[7].font=1”, “p[8].b[8].font=1”, “p[9].b[4].font=2”, “p[9].b[5].font=2”] to [“p[2].b[4].txt="O: 4.6 °C"”, “p[2].b[5].txt="I: 20.8 °C"”, “p[2].b[6].txt="Sunday"”, “p[2].b[7].txt="01.Mar.2020"”]

2020-03-01 21:52:53.234 [vent.ItemStateChangedEvent] - HASP_Plate01_Light_Status changed from OFF to ON

2020-03-01 21:52:56.414 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Plate_Command_JSON’ received command [“p[2].b[4].txt="O: 4.6 °C"”, “p[2].b[5].txt="I: 20.8 °C"”, “p[2].b[6].txt="Sunday"”, “p[2].b[7].txt="01.Mar.2020"”]

2020-03-01 21:52:56.421 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Page’ received command 1

2020-03-01 21:52:56.428 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Light_Power’ received command ON

2020-03-01 21:52:56.451 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Page’ received command 1

2020-03-01 21:52:56.459 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Page’ received command 1

2020-03-01 21:52:56.467 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Light_Power’ received command ON

2020-03-01 21:52:56.488 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Page’ received command 1

2020-03-01 21:52:56.496 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Light_Power’ received command ON

2020-03-01 21:52:56.505 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Light_Power’ received command ON

2020-03-01 21:52:56.513 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Page’ received command 1

2020-03-01 21:52:56.520 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Page’ received command 1

2020-03-01 21:52:56.527 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Light_Power’ received command ON

2020-03-01 21:52:56.532 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Light_Power’ received command ON

2020-03-01 21:52:56.537 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Page’ received command 1

2020-03-01 21:52:56.543 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Page’ received command 1

2020-03-01 21:52:56.556 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Light_Power’ received command ON

2020-03-01 21:52:56.562 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Light_Power’ received command ON

2020-03-01 21:52:56.568 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Page’ received command 1

2020-03-01 21:52:56.574 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Light_Power’ received command ON

2020-03-01 21:52:56.580 [vent.ItemStateChangedEvent] - HASP_Plate01_Page changed from 2 to 1

2020-03-01 21:52:56.583 [vent.ItemStateChangedEvent] - HASP_Plate01_Page_Current changed from 2 to 1

2020-03-01 21:52:56.587 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Plate_Command_JSON’ received command [“p[1].b[1].bco=25388”, “p[1].b[2].bco=25388”, “p[1].b[3].bco=25388”, “p[1].b[1].bco=65535”]

2020-03-01 21:52:56.620 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Plate_Command_JSON’ received command [“p[1].b[1].bco=25388”, “p[1].b[2].bco=25388”, “p[1].b[3].bco=25388”, “p[1].b[1].bco=65535”]

2020-03-01 21:52:56.627 [vent.ItemStateChangedEvent] - HASP_Plate01_Plate_Command_JSON changed from [“p[2].b[4].txt="O: 4.6 °C"”, “p[2].b[5].txt="I: 20.8 °C"”, “p[2].b[6].txt="Sunday"”, “p[2].b[7].txt="01.Mar.2020"”] to [“p[1].b[1].bco=25388”, “p[1].b[2].bco=25388”, “p[1].b[3].bco=25388”, “p[1].b[1].bco=65535”]

2020-03-01 21:52:56.636 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Plate_Command_JSON’ received command [“p[1].b[1].bco=25388”, “p[1].b[2].bco=25388”, “p[1].b[3].bco=25388”, “p[1].b[1].bco=65535”]

2020-03-01 21:52:56.642 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Plate_Command_JSON’ received command [“p[1].b[1].bco=25388”, “p[1].b[2].bco=25388”, “p[1].b[3].bco=25388”, “p[1].b[1].bco=65535”]

2020-03-01 21:52:56.648 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Plate_Command_JSON’ received command [“p[1].b[1].bco=25388”, “p[1].b[2].bco=25388”, “p[1].b[3].bco=25388”, “p[1].b[1].bco=65535”]

2020-03-01 21:52:56.655 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Plate_Command_JSON’ received command [“p[1].b[1].bco=25388”, “p[1].b[2].bco=25388”, “p[1].b[3].bco=25388”, “p[1].b[1].bco=65535”]

2020-03-01 21:52:56.660 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Plate_Command_JSON’ received command [“p[1].b[1].bco=25388”, “p[1].b[2].bco=25388”, “p[1].b[3].bco=25388”, “p[1].b[1].bco=65535”]

2020-03-01 21:52:56.666 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Plate_Command_JSON’ received command [“p[1].b[1].bco=25388”, “p[1].b[2].bco=25388”, “p[1].b[3].bco=25388”, “p[1].b[1].bco=65535”]

2020-03-01 21:52:56.676 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Plate_Command_JSON’ received command [“p[1].b[1].bco=25388”, “p[1].b[2].bco=25388”, “p[1].b[3].bco=25388”, “p[1].b[1].bco=65535”]

Are you getting that just the first time, and then it works? OH usually takes time to parse the rules after startup/rule change. For me, this happens as well, where I’ll click on the screen, it’ll take about 10-15 seconds, then works fine after that.

BTW, check my Github OH-config repo for some updated rules - I’ve done a few things with my HASPs, like adding a thermostat control page, and that’s where I keep all my latest configs (in case I forget to update the rules in the first post).

It seems random, it will be slow on the first load / rule refresh but then operate fine on the next try, then the screen turns off and on the next press the screen may come on or may not.

I checked the MQTT data and it is instant but the data isn’t seen in OH for a few seconds, if I keep pressing the screen a few seconds apart the OH eventually catches up and processes all the commands.

There isn’t much data on OH and I have disabled all items that are unused so it isn’t polling them.

Other items controlled by OH via MQTT v1 are instant so I dont think the issue is MQTT to OH or OH to MQTT. The screen responds as soon as the MQTT is sent. The delay seems to be with OH decoding/sending the MQTT data.

I will try your updated rules this week, the thermostat one will be handy.
Thanks

Some more testing tonight and I rolled back the Arduino code to 0.37 as on your GitHub but I get the same issues.
I can control the HASP screen via OH with the site map and it changes screens very quickly
When I press the screen on the HASP the data is sent instantly to Mosquitto MQTT, this is picked up instantly in OH Log file but nothing happens for between 24 up to 41 seconds. It seems like the rules are waiting or running in a loop so can’t start the next task.

Any ideas appreciated :smile:

Thermostat page looks good too.

Look here @DigitalDB there is a solution described

Anyone fixed issue with OFF-ON-OFF switch? Tried firmware from aderusha github and downgraded to [bkpsu] 0.37 with same effect:

021-01-22 23:51:01.945 [vent.ItemStateChangedEvent] - HASP_Plate01_Button_P1B4 changed from OFF to ON

2021-01-22 23:51:01.956 [vent.ItemStateChangedEvent] - HASP_Plate01_Plate_State_JSON_Event changed from p[1].b[7] to p[1].b[4]

2021-01-22 23:51:01.960 [vent.ItemStateChangedEvent] - HASP_Plate01_Plate_State_JSON changed from {“event”:“p[1].b[7]”, “value”:“ON”} to {“event”:“p[1].b[4]”, “value”:“ON”}

2021-01-22 23:51:01.992 [ome.event.ItemCommandEvent] - Item ‘HASP_Plate01_Light_Power’ received command ON

2021-01-22 23:51:01.995 [nt.ItemStatePredictedEvent] - HASP_Plate01_Light_Power predicted to become ON

2021-01-22 23:51:02.032 [vent.ItemStateChangedEvent] - HASP_Plate01_Button_P1B4 changed from ON to OFF

Hi!
I’m fighting since several days now with the HASP. Somehow I have issues with the transformations. I get the jsons from the Nextion and I can send command via the HASP sitemap. but I don’t get any MQTT message/command based on the json. E.g. I can’t switch pages, only via the sitemap. In the sitemap ESP and LCD updates show false. I think my jsonpath transformation is not working but how can I check that? Any more ideas?Please…

You can check using the kraf console to see if it is running.

Thx! Really quick reaction! Edit mistake for config.

1 Like

Just a bump, to let everyone know I’ve updated the config files in my OH config Github repo to work with the latest version of HASPopen (1.0.5), as well as fix some OH3.4 related maintenance issues.

1 Like