HA SwitchPlate HASPone: DIY In-Wall Touchscreen Home Assistant Controller

If you take a look at the example volume update automation I note some differences with what you have above.

First, the MQTT payload coming from HASP isn’t in JSON format which is likely the major problem. Can you try something like the following?

volume_level: "{{ (trigger.payload|int) / 100 }}"

Second, you’ll probably want the trigger to be: "hasp/plate01/state/p[8].b[9].val"

Ciao Marco,
contact me via private message to arrange the exchange.

g

Since this post gained some traction again, I’m just letting people know that I still have some boards available at production price + shipping.
Contact me privately to arrange shipping.

Beat,
g

1 Like

Perfect, thanks Luma, that works great.
Thank you

:smile:

1 Like

Hi

Is it possible to add a new line \ carriage return into a payload?

I use NCID to record incoming calls to a MySQL database on another Pi and have used that for sometime now. Part of the trigger to record the data to the database, I include an SMTP call, so it would be straight forward enough to publish an MQTT message in the same trigger.

I’ve installed paho.mqtt on to my pi running NCID, created a small python script that sends “Call From: 1234567890 at: 18:55” to a topic called ncid/data.

That displays on Page 11 of my HASP when there is an incoming call, but it’s all in one line with word wrap it fits on the screen. I can add spaces to the original message so that it has “Call From:” on one line the telephone on another, "at: " and the next and so on. But is there a method of adding a new line using \r or \r or something so that I don’t need to fill the message with spaces?

Thanks again
Neil

So Luma, i’m quite a newbie… if i place an [m0] hotspot in the wheel, i see mqtt is not listening anything about that?

I mean…the code is listening anything is happening in the nextion or just the buttons you’ve set up?

"\r" is what you’re looking for, but in double-quoted strings inside a yaml file you’ll need to escape that as "\\r".

Example.

By default, button interactions (buttons, hotspot, etc) don’t send out commands via serial unless you tell them to. Select the hotspot object in the editor, select “Touch Press Event”, and check “Send Component ID”. Do the same for Touch Release event.

Hey Guys

Need some help here as i’m stuck!

I’ve used Arduino to copy the code across after downloading the 3 libraries and adding the custom URL. I’ve copied the TFT file from the MicroSD card to the Nextion. Can access the D1 Mini via IP address and it has successfully connected to MQTT and my Network. The issue is the LCD just keeps saying ‘HASP initializing’. I’ve done a continuity check on everything with a Multimeter and all checks out, connected leads directly to the D1 mini and also through the HASP PCB itself. I have Red - 5V, Black - G, Blue - D7 and Yellow - D4. I have reflashed the D1 mini and Nextion again to no avail. I have added everything into HA and can see in the serial output, messages are being received and the LCD on the D1 mini is blinking in sync with every action.

I have read all the posts with ‘HASP Initializing’ in this forum and it all seemed to be leads incorrect/reversed or cold solders, both of which i’ve triple checked…

Any help would be appreciated, Thanks a bunch!

Your research is correct, in that the display never actually showing anything strongly suggests a problem with TX from the WeMos getting to RX on the Nextion. Can you post a serial debug log of the startup process?

Thanks heaps for the help! Not sure how to post the whole debug as it’s huge, but here’s the start and end…

}⸮⸮⸮[+4.146s] MQTT: subscribed to hasp/plate01/command/#
[+4.168s] MQTT: subscribed to hasp/plates/command/#
[+4.189s] MQTT: subscribed to hasp/plate01/light/#
[+4.211s] MQTT: subscribed to hasp/plate01/light/#
[+4.232s] MQTT: subscribed to hasp/plate01/status
[+4.238s] MQTT: binary_sensor state: [hasp/plate01/status] : [OFF]
[+4.248s] MQTT IN: 'hasp/plate01/status' : 'ON'
[+4.459s] HMI OUT: 'p[0].b[1].txt="WiFi Connected!\r BuddBoys AirPort\rIP: 192.168.0.183\r\rMQTT Connected:\r 192.168.0.242"'
[+4.472s] MQTT: connected
[+4.474s] SYSTEM: System init complete.
[+4.479s] MQTT IN: 'hasp/plate01/status' : 'OFF'
[+4.490s] MQTT IN: 'hasp/plate01/status' : 'ON'
[+4.971s] MQTT IN: 'hasp/plate01/command/p[2].b[6].font' : '10'
[+4.97⸮⸮B5%⸮OUT: 'p[2].b[6].font=10'
[+5.000s] HMI: sending Nextion connect request
[+5.004s] HMI OUT: connect
[+5.026s] M⸮TT IN: 'hasp/plate01/command/pag⸮' : '1'
[+5.032s] HMI OUT: page 1
[+10.007s] HMI: sending Nextion connect request
[+10.012s] HMI OUT: connect
[+15.014s] HMI: sending Nextion connect request
[+15.019s] HMI OUT: connect
[+20.021s] HMI: No Nextion response, attempting 9600bps connection
[+20.046s] HMI: sending Nextion serial speed 115200 request
[+25.001s] UPDATE: Checking update URL: http://haswitchplate.com/update/version.json
[+25~511s] UPDATE: upda⸮eEspAvailableVersion: 0.40
[+25.516s] UPDATE: Update check completed
[+25.564s] MQTT: status update: {"status":"available","espVersion":0.40,"updateEspAvailable":false,"lcdConnected":true,"lcdVersion":"0","updateLcdAvailable":false,"espUptime":25,"signalStrength":-66,"haspIP":"192.168.0.183","heapFree":23632,"heapFragmentation":2,"espCore":"2_7_2"}
[+25.603s] MQTT: binary_sensor state: [hasp/plate01/status] : [ONwm
[+25.659s] MQTT IN: 'hasp/plate01/status' : 'ON'
[+28.758s] MQTT IN: 'hasp/plate01/command/p[2].b[4].txt' : '"11:38 "'
[+28.765s] HMI OUT: 'p[2].b[4].txt="11:38 "'
[+88.738s] MQTT IN: 'hasp/plate01/command/p[2].b[4].txt' : '"11:39 "'
[+88.746s] HMI OUT: 'p[2].b[4].txt="11:39 "'

Question:
I’m always trying to learn about this code and automations for making the rgb wheel…actually i’m trying to modify the page p6, but why if i leave the blank page and only the code for toggle 1 light the plate is not able to connect anymore?

this is my p6 for testing:

‘’’ # Toggle light1 when p[6].b[4] pressed

  • alias: hasp_plate01_p6_ToggleLight1
    trigger:
    • platform: mqtt
      topic: “hasp/plate01/state/p[6].b[4]”
      payload: “ON”
      action:
  • service: homeassistant.toggle
    entity_id: light.ufficio_luce_ufficio_99’’’

All this is really telling us is that nothing is being received from the Nextion LCD. That may very well be because nothing is getting TO the LCD. My best advice here will be to track down the TX from the WeMos on D4 to RX on the Nextion via the yellow cable. Continuity testing might help you there.

Can you explain a little more about what’s going on there? I’m not clear from your description exactly what the sequence of events are and what problem they’ve lead to.

I am running 0.38 and I can’t get it to update to 0.40. It shows to be updating, but at the end it is still the same (both by URL and local update).

MQTT Status: Connected
MQTT ClientID: plate01-601945da074
HASP Version: 0.38
LCD Model: NX3224T024_011R
LCD Version: 1
LCD Active Page: 3
CPU Frequency: 160MHz
Sketch Size: 463568 bytes
Free Sketch Space: 2678784 bytes
Heap Free: 19584
Heap Fragmentation: 22
ESP core version: 2_5_2
IP Address: 192.168.1.88
Signal Strength: -29
Uptime: 1170
Last reset: Fatal exception:4 flag:3 (SOFT_WDT) epc1:0x400043e6 epc2:0x00000000 epc3:0x00000000 excvaddr:0x00000000 depc:0x00000000

I would like to also update the tft to the standard one (I tryied another one in the past and it not working well). I should first update to 0.40, right?
Thanks.
Can someone give me some tip how to solve this?

One solution may be to connect to serial and try flashing the WeMos D1 directly.

I did it. Ok.
I also updated TFT. It took about 5 min but it returned “Successful” and rebooted.
The MQTT settings were lost, so I inserted again and save. It reboots and loses it again…

MQTT Status: Disconnected, return code: 0
MQTT ClientID:
HASP Version: 0.40
LCD Model:
LCD Version: 0
LCD Active Page: 3
CPU Frequency: 160MHz
Sketch Size: 477536 bytes
Free Sketch Space: 2666496 bytes
Heap Free: 20160
Heap Fragmentation: 1
ESP core version: 2_6_3
IP Address: 192.168.1.91
Signal Strength: -35
Uptime: 14
Last reset: Fatal exception:0 flag:4 (SOFT_RESTART) epc1:0x00000000 epc2:0x00000000 epc3:0x00000000 excvaddr:0x00000000 depc:0x00000000

The MQTT settings were ok before the TFT update, since it worked as expected.

PS: Then I flashed 0.40 again and I could proceed with next steps. MQTT settings now got remembered.

I don’t know if this is by design but I don’t remember it happening previously:

every 30 seconds or so the display’s screen ‘rewrites’ even if nothing has changed, it’s really obvious and distracting. @luma is this to be expected, or am I experiencing a bug? I can take a quick vid if it helps.

ok, so i’m trying to make my rgb wheel page…but still not confident with the code at all.

For test, I’ve tried a blank page (yaml) at P6, with only the code for toggling one light. Mqtt works fine, it receives the button pressed on the touchscreen, but nothing happens on HA.
The more, my P6 blank page with only the code for toggle 1 light, seems to get the plate stuck…does it make sense to you?

If it’s a page w/ icons overlaid, and something happens that sends new info to that writes to that page, there will be a lot of stuff going on which might be visible. What page exactly are you seeing this on? If it’s the default automations w/ page 2 scenes, you’d expect things to happen every minute when the time updates.