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

Hi,

i used corel draw to design UI and then it was transferred to Nextion HMI editor to make relevant mappings of buttons and text’s every thing is crop image in nextion editor.

Thank you so much for appreciating the project its all thanks to @luma

i made a back frame and a front facia for the screen and used electrical back boxes as standard boxes available in India

this is the back box for 7"

the frame made according to it

Front of the frame (the round holes are where magnets will stick with epoxy glue)

3.5 inch frame (you can see magnets are placed in the holes )

Lastly i used power of cnc machines to cnc a block of aluminium 6 mm thick to achieve this 

& this from the back holes are then fitted with magnet with poles attracting each other then it snaps together like magic 

also posted previously using different materials and frame it was for 2.4 (you can check this post)

2 Likes

I’ve solved that problem with my pool sensor that sits on water-level, has a metal top and therefore is “enclosed”, getting poor signal.

I cut off the internal antenna trace, soldered a cable on it which matches the “required” length of 12cm, as seen on some page:
image

image

Another, more clean solution would be buying an ESP board which already has a external WiFi antenna connector, such as this one:
image
and buying an antenna which matches this connector. Since those antennas have shielded cables, you can attach an antenna with a cable of even several meters without loosing much signal strength, if you want to.

@luma If you’re going to make an circuit board for it, or adapting the design, I would suggest leaving the decision of plugging an external antenna to the user. I personally would make a hole on the back, which gives access to the connector and then sell the antenna optionally.

image

The user then could plug the antenna in and shove it outside the metal enclosure, if he has one, maybe in a cable pipe which isn’t metal or something like that.

I hope I helped someone :slight_smile:

1 Like

Really new to commanding the HASP and found an interesting behaviour that I can’t figure out. I am using the HASP with the default code and screens that it comes with.

I am trying to setup a case where I send a MQTT command to switch to the scenes (page 1) page and then press one of the bottom 3 buttons to go back to where they were. The problem I am seeing is after I send the MQTT command to select the page, pressing the button for the page they were on doesn’t do anything. You have to press the other button to get the HASP to change. Here is some log output I captured.

Starting on button 3 (lights), I send the MQTT command
hasp/bbr_plate/command/page 1

[+36766.176s] MQTT IN: 'hasp/bbr_plate/command/page' : '1'
[+36766.180s] HMI OUT: page 1
[+36766.234s] HMI IN:  0x66 0x1 0xff 0xff 0xff
[+36766.238s] HMI IN: [sendme Page] '1'
[+36770.035s] HMI IN:  0x65 0x1 0x3 0x1 0xff 0xff 0xff

Then I press button 3 (lights) on page 1 (scenes) and get this:

[+36770.039s] HMI IN: [Button ON] 'p[1].b[3]'
[+36770,047s] MQTT OUT: 'hasp/bbr_plate/state/p[1].b[3]' : 'ON'
[+36770.492s] HMI IN:  0x65 0x1 0x3 0x0 0xff 0xff 0xff
[+36770.496s] HMI IN: [Button OFF] 'p[1].b[3]'
[+36770.504s] MQTT OUT: 'hasp/bbr_plate/state/p[1].b[3]' : 'OFF'
[*36770.512s] HMI OUT: 'gåt p[1].b[3].val'
[+36770.559s] HMI IN:  0x1a 0xff 0xff 0xff

And the screen stays on page 1. The only way I can get back to page 3 (lights) is to first press button 2 (status) and then button 3 (lights).

Using the slider in HA to select page 1:

[+36970.227s] MQTT IN: 'hasp/bbr_plate/command/page' : '1'
[+36970.230s] HMI OUT: page 1
[+36970.289s] HMI IN:  0x66 0x1 0xff 0xff 0xff
[+36970.293s] HMI IN: [sendme Page] '1'
[+36974.770s] HMI IN:  0x65 0x1 0x3 0x1 0xff 0xff 0xff

Which seems identical to when I sent the MQTT command. But when I press button 3 (lights) on page 1, I get this:

[+36974.777s] HMI IN: [Button ON] 'p[1].b[3]'
[+36974.781s] MQTT OUT: 'hasp/bbr_plate/state/p[1].b[3]' : 'ON'
[+36974.836s] MQTT IN: 'hasp/bbr_plate/command/page' : '3'
[+36974.840s] HMI OUT: page 3
[+36974.895s] HMI IN:  0x66 0x3 0xff 0xff 0xff
[+36974.898s] HMI IN: [sendme Page] '3'

Why the difference? I didn’t send the message with retain on so I don’t believe the problem is there. What am I doing wrong in my command to change pages? In the response after using the slider, I see a MQTT command setting the page to 3. Do I need to capture that message and send the page command myself?

The general logic for everything here is that when you press something on the screen, an MQTT message is sent out indicating what you’ve done. In your paste above, you can see that a message is sent when the button is pressed, then another when the button is released.

The response to that button is up to the automations in Home Assistant. So, something should be looking for that button press, and sending a message back telling HASP what to do in response. In your paste, I don’t see Home Assistant sending an MQTT message back. Any chance that was edited out of your post? If not, then you need to wade through the automations to figure out why Home Assistant isn’t triggering when you press the page 3 button. You can find the relevant automation here.

Just a head’s up - I’m heading out on vacation for a week and will be mostly unavailable to respond to issues until I’m back. See you folks soon!

The response to that button is up to the automations in Home Assistant. So, something should be looking for that button press, and sending a message back telling HASP what to do in response.

Okay. That is making sense now. Figured the HASP would handle all that internally. I’ll try getting that code in and testing it.

Enjoy your vacation. Hope you are going somewhere fun. :slight_smile:

Hey guys, so I have a backlight issue which is really confusing me.

When I turn the backlight off through HA (manually or via automation), it turns off which is good. But, approximately 5 minutes later it turns back on by its self. Its status still says it is off in HA as well. I don’t have a motion sensor automation either which could be triggering it. This switch plate is in my bedroom so it is really annoying when the backlight turns back on at night.

If anyone has any ideas that would be great!

I misunderstood your reply and have gone back and checked the automation file and the trigger for that button is still in the code. So now I’m not sure where to look.

For both @Verpz and @edboston - can you post debug logs from the HASP covering the events leading up to and after the issue happens? If you have serial still connected you can view the logs there, otherwise you can enable telnet and you can capture debug logging via telnet to the HASP device.

Those logs might get big, so maybe throw them up on https://hastebin.com/ or similar and it will give me an idea of exactly what is happening on the HASP, and maybe we can get to the bottom of both of your issues!

The output I posted in my original message was the debug output. The HASP had been idle when I sent the command and nothing else came out before I pushed the button. After that last part, the unit sat idle for a bit not producing any out.

Is there any traffic after your second capture? If not, the the problem is somewhere on the Home Assistant side. You are sending the button event, Home Assistant isn’t responding.

Edit: I think I’ve misunderstood your issue after re-reading your original post. I’m still not clear on exactly what the sequence of events is in your situation.

OK here is an idea: what if you made your automation change the value of the ‘input_slider’ for the active page instead of sending the page command?

So, instead of sending page 1, instead change the active page slider in Home Assistant to page 1.

I am doing the automation in Node Red and I haven’t had any luck getting something to work the slider. Keep getting errors about no connection to server. Strange in that I created the node to toggle a light and it worked. But when I changed it to work the slider, it stopped working. I have a lot to learn about Node Red still.

Okay. Finally got something working and was able to switch pages via the slider and back with the button. But looking at the automation for the slider, all it does is send a page message. Just like I was doing.

Went back and tested using the page command and now it is working. :grimacing:

That is the most annoying way to fix something… Still, glad to hear it’s working!

Guys,

Inspired by the metal frame @Gagan_Kochar showed us, I decided to get back on making a bigger HASP for my house.

The only thing I hate about Nextion is the viewing angle. When the nextion is the vertical, when you look from both sides the image seems ok. But when you look from the bottom up it’s terrible.

My 2.4inches Nextion is on the horizontal. Similarly, When i look from right to left it is ok. But when I look from left to right it’s awful.

Below are the pics of the same HASP from both sides.

Can anyone tell me if the 7 inches (or the 4 inches) Nextion has a better viewing angle when you look from the sides?
If not, does anyone managed to figure out a work around for this?

Thanks!

It’s entirely possible that the off-axis viewing on that panel is a relatively recent development as a result of quality fade from Nextion. Read more about that here.

Hate to say it, but the problem is back. :sob: