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

I have succesfully flashed HASwitchPlate.tft to my Nextion NX3224T024 and HASwitchPlate.ino.d1_mini.bin to a Wemos D1 mini V3. Connected the wires like this:

Nextion yellow to Wemos TX
Nextion blue to Wemos RX
Nextion black to Wemos GND
Nextion red to Wemos 5V

Powered the Wemos via USB but my Nextion NX3224T024 keeps displaying “HASP Initializing…”
Expected the screen with AP en pass after this loading screen to connect to othe Wemos.
I think I have missed something, but not sure what exactly. Can anyone point me in the right direction?

You’ll want blue connected to D7 and yellow connected to D4. I should probably note this in the docs.

Thanks! That was the trick, WiFI and MQTT are now connected :slight_smile:

Your questions here have been helpful and have prompted me to make some changes to the documentation to better walk a new user through the process. Thanks!

1 Like

After connecting the wires the right way, the screen is loaded with the default buttons now.
Just wondering what the easiest way is to change to button text.

Changing the payload in config\packages\plate01\hasp_plate01_p3_toggles.yaml? How to send the changes the the Nextion? After running the hasp_plate01_p0_PageButton3_Text automation, nothing is changed.

Customizing this environment is going to require a few things:

I’d strongly recommend picking up the Nextion editor and taking a look at the provided HMI file to get a better understanding of how the HMI is structured with respect to how each page is layed out and how to identify and name each element on each page.

In regards to your specific question, hasp_plate01_p0_PageButton3_Text is part of a set of automations which handle changing pages using the 3 buttons found at the bottom of each page. The text on page 3 is not controlled by this automation, it’s used just for the page flipping buttons.

If you aren’t already familiar with how Home Assistant Automations works, I’d recommend avoiding changes to hasp_plate01_p0_pages.yaml as it’s functionality isn’t intuitively obvious to the beginner. Check out hasp_plate01_p3_toggles.yaml for the actual text being displayed on page 3.

1 Like

Thanks luma.

I guess these two ways should work (publish with MQTT.fx or a HASS automation)?
Screenshot MQTT.fx and HASS automation

@luma - I got the premade wall switch. When following the instructions to install the device in hassio, I run this:

cd /config
apk add tar wget
bash <(wget -qO- -o /dev/null https://raw.githubusercontent.com/aderusha/HASwitchPlate/master/Home_Assistant/deployhasp.sh) 

and get this:

ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.7/main: temporary error (try again later)
WARNING: Ignoring APKINDEX.70c88391.tar.gz: No such file or directory
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/armhf/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.7/community: temporary error (try again later)
WARNING: Ignoring APKINDEX.5022a8a2.tar.gz: No such file or directory
ERROR: unsatisfiable constraints:
  tar (missing):
    required by: world[tar]
  wget (missing):
    required by: world[wget]
core-ssh:/config# bash <(wget -qO- -o /dev/null https://raw.githubusercontent.com/aderusha/HASwitchPlate/master/Home_Assistant/deployhasp.sh)
wget: unrecognized option: o
BusyBox v1.27.2 (2018-01-29 16:01:29 GMT) multi-call binary.

Usage: wget [-c|--continue] [--spider] [-q|--quiet] [-O|--output-document FILE]
	[--header 'header: value'] [-Y|--proxy on/off] [-P DIR]
	[-S|--server-response] [-U|--user-agent AGENT] [-T SEC] URL...

Retrieve files via HTTP or FTP

	--spider	Only check URL existence: $? is 0 if exists
	-c		Continue retrieval of aborted transfer
	-q		Quiet
	-P DIR		Save to DIR (default .)
	-S    		Show server response
	-T SEC		Network read timeout is SEC seconds
	-O FILE		Save to FILE ('-' for stdout)
	-U STR		Use STR for User-Agent header
	-Y on/off	Use proxy
core-ssh:/config# 

It was a DNS issue. On Hassio I had to edit the resolv.conf file:

nano /etc/resolv.conf

Add a line that says

nameserver 192.168.1.1

where 192.168.1.1 is your routers IP.

Another thing to keep in mind, you can’t use the Lovelace interface to find the new TAB… I had to revert back to using the /states address.

This is great feedback @matthewjohn! The lovelace thing isn’t terribly surprising, nothing has been tested against that interface and it’s still very much in beta with Home Assistant and for the moment I’m going to let things settle down there. The hass.io problem is a little more surprising. I have tested this installer against hass.io without problems, and I’m surprised that DNS is the root cause. My hass.io test bed is using DHCP which provides a valid DNS server IP address. Is that the case with your setup? Any idea why it wouldn’t have had a DNS resolver configured? I’m not terribly familiar with hass.io and I’m not really sure why or how DNS would be missing from that setup.

I’m not too sure. It maybe that two network interfaces are running on my PI. Wireless and Network. Still both are DHCP and I would have thought it would have the routers IP entered.

Another questions. What is the preferred way to program the buttons. I noticed if I edit the toggle file, the light will work, but the status does not update on the switch (black background or white). I can use node red to monitor the MQTT message and trigger an event, but it seems to be slow and if the light status changes by a Manuel toggle of the switch, it does not update the switches status.

Am I doing this wrong? Lastly, I noticed that if I have to reboot the switch, the automations are off and I have to reenable them. Is that correct?

Another thing, is there a way to reload the config changes without restarting HASSIO?

By the way, it was not too hard to get the switches to this point! I thank you for all your hard work, I may be purchasing a 3rd.

I don’t really have a “preferred method” that I would recommend. I’m personally using Home Assistant automations and have included several samples of how they might be used, but if you’re more comfortable with Node-Red (or whatever), then I’d recommend using the platform with which you are the most familiar.

To get yourself familiar with what’s happening, I’d recommend starting with the Page 1 automations, understand how they function, and then work forward from there. To some extent, each page builds upon and extends concepts used in previous pages. If you don’t understand how the scene control buttons work, you’re going to have a hard time jumping straight into the toggles.

At the end of the day, HASP is a dumb panel - it receives MQTT commands which are directly sent to the Nextion display, and user interactions from the Nextion display are sent back to your MQTT broker. The automation platform you are using must then correctly make everything happen. For example, the light/dark “toggle” behavior is entirely controlled by Home Assistant automations. When a button is pressed, Hass sends commands to change the background to dark or light, to change the text color, and to perform any commands.

In regards to the automations disabling, I’ve not seen that behavior but for reasons above it would have to originate from Home Assistant. The HASP software has not control over Home Assistant except that which you directly program using tools provided by Home Assistant.

Okay thanks, not sure if you saw it because I edited my response above. Do you have to reload hassio each time you make a config change? Is there a quicker way?

I’m not too familiar with MQTT.fx but I suspect that you are using it to send the message:

{
  "payload": "Test",
}

That payload is JSON format which is not used by the HASP device - instead you would simply send the payload "Test", including the quotes (meaning, with none of the other stuff in your example. Just "Test", no more). In Home Assistant, you may need to escape the quotes to make sure the double quotes are sent as-is.

I don’t know hass.io very well but I think it’s safe to suggest that it also requires a full restart to reload automations which are presented as packages, same as the normal install of Home Assistant. It’s possible to skip using the packages but requires manually placing all of the contents of the various packages into several configuration files. It’s a tradeoff to be made, easy installation for first time users vs easy modification later on down the road.

Thanks for the quick response. I’ll keep digging in! I love hassio but sometimes wish I was using a more powerful computer. I went to order a few more, and your out :slight_smile:

Ugh yeah - had > $400 worth of LCDs on order to try and get in before the Trump Tariff and the Ali vendor screwed me, provided false tracking numbers and the result was nearly 2 months before I could dispute the non-shipment and get money refunded. More orders have since been placed, but with 25% added to everything because yay Trump.

Frustrating times…

Ugg is right! No problem paying a bit more :slight_smile: Thanks again!

Luma has it all documented really well (I do believe, even for background and text colors) so definitely check the GitHub. You change the background of a button by sending an MQTT message to topic hasp/plate01/command/p[3].b[4].bco, and can change the text color by sending a message to hasp/plate01/command/p[3].b[4].pco (note the extension at the end). Replace 3 and 4 with the page and button number you’re commanding. The value you send is an RGB 565 value (0-65535)… you can look up color pickers in google and see here for a little more info:

http://support.iteadstudio.com/support/discussions/topics/11000008693

Edit: Here’s a sample flow how it should work in Node RED to change the colors (bg and text) based on an entity state.

[
    {
            "id": "1a42e956.3f0da7",
            "type": "mqtt out",
            "z": "b7a90dac.caf07",
            "name": "",
            "topic": "hasp/plate01/command/p[3].b[4].bco",
            "qos": "0",
            "retain": "false",
            "broker": "90059f75.014cc",
            "x": 2290,
            "y": 2680,
            "wires": []
    },
    {
            "id": "a7db2b02.e4c478",
            "type": "mqtt out",
            "z": "b7a90dac.caf07",
            "name": "",
            "topic": "hasp/plate01/command/p[3].b[4].pco",
            "qos": "0",
            "retain": "false",
            "broker": "90059f75.014cc",
            "x": 2290,
            "y": 2720,
            "wires": []
    },
    {
            "id": "7dc5944e.d516fc",
            "type": "server-state-changed",
            "z": "b7a90dac.caf07",
            "name": "Entryway Lights",
            "server": "b588e1c8.58319",
            "entityidfilter": "light.entryway_lights",
            "entityidfiltertype": "substring",
            "haltifstate": "",
            "x": 1720,
            "y": 2740,
            "wires": [
                    [
                            "9a83e3a0.81948"
                    ]
            ]
    },
    {
            "id": "9a83e3a0.81948",
            "type": "switch",
            "z": "b7a90dac.caf07",
            "name": "Status",
            "property": "payload",
            "propertyType": "msg",
            "rules": [
                    {
                            "t": "eq",
                            "v": "on",
                            "vt": "str"
                    },
                    {
                            "t": "eq",
                            "v": "off",
                            "vt": "str"
                    }
            ],
            "checkall": "true",
            "repair": false,
            "outputs": 2,
            "x": 1890,
            "y": 2740,
            "wires": [
                    [
                            "4163740b.74a60c",
                            "80f5d881.071278"
                    ],
                    [
                            "8f933f67.2d16b",
                            "64c292cc.c58c2c"
                    ]
            ]
    },
    {
            "id": "4163740b.74a60c",
            "type": "change",
            "z": "b7a90dac.caf07",
            "name": "Yellow",
            "rules": [
                    {
                            "t": "set",
                            "p": "payload",
                            "pt": "msg",
                            "to": "65504",
                            "tot": "str"
                    }
            ],
            "action": "",
            "property": "",
            "from": "",
            "to": "",
            "reg": false,
            "x": 2050,
            "y": 2680,
            "wires": [
                    [
                            "1a42e956.3f0da7"
                    ]
            ]
    },
    {
            "id": "8f933f67.2d16b",
            "type": "change",
            "z": "b7a90dac.caf07",
            "name": "White",
            "rules": [
                    {
                            "t": "set",
                            "p": "payload",
                            "pt": "msg",
                            "to": "65535",
                            "tot": "str"
                    }
            ],
            "action": "",
            "property": "",
            "from": "",
            "to": "",
            "reg": false,
            "x": 2050,
            "y": 2760,
            "wires": [
                    [
                            "25c980e8.468f7"
                    ]
            ]
    },
    {
            "id": "64c292cc.c58c2c",
            "type": "change",
            "z": "b7a90dac.caf07",
            "name": "Black",
            "rules": [
                    {
                            "t": "set",
                            "p": "payload",
                            "pt": "msg",
                            "to": "0",
                            "tot": "str"
                    }
            ],
            "action": "",
            "property": "",
            "from": "",
            "to": "",
            "reg": false,
            "x": 2050,
            "y": 2800,
            "wires": [
                    [
                            "edf2cb09.df1a78"
                    ]
            ]
    },
    {
            "id": "80f5d881.071278",
            "type": "change",
            "z": "b7a90dac.caf07",
            "name": "Black",
            "rules": [
                    {
                            "t": "set",
                            "p": "payload",
                            "pt": "msg",
                            "to": "0",
                            "tot": "str"
                    }
            ],
            "action": "",
            "property": "",
            "from": "",
            "to": "",
            "reg": false,
            "x": 2050,
            "y": 2720,
            "wires": [
                    [
                            "a7db2b02.e4c478"
                    ]
            ]
    },
    {
            "id": "25c980e8.468f7",
            "type": "mqtt out",
            "z": "b7a90dac.caf07",
            "name": "",
            "topic": "hasp/plate01/command/p[3].b[4].bco",
            "qos": "0",
            "retain": "false",
            "broker": "90059f75.014cc",
            "x": 2290,
            "y": 2760,
            "wires": []
    },
    {
            "id": "edf2cb09.df1a78",
            "type": "mqtt out",
            "z": "b7a90dac.caf07",
            "name": "",
            "topic": "hasp/plate01/command/p[3].b[4].pco",
            "qos": "0",
            "retain": "false",
            "broker": "90059f75.014cc",
            "x": 2290,
            "y": 2800,
            "wires": []
    },
    {
            "id": "90059f75.014cc",
            "type": "mqtt-broker",
            "z": "",
            "name": "Mosquitto",
            "broker": "localhost",
            "port": "1883",
            "clientid": "home-assistant-nodered",
            "usetls": false,
            "compatmode": true,
            "keepalive": "60",
            "cleansession": true,
            "willTopic": "",
            "willQos": "0",
            "willPayload": "",
            "birthTopic": "",
            "birthQos": "0",
            "birthPayload": ""
    },
    {
            "id": "b588e1c8.58319",
            "type": "server",
            "z": "",
            "name": "Home Assistant",
            "url": "http://hassio/homeassistant",
            "pass": "ENTER YOUR PASSWORD HERE"
    }
]
2 Likes