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

For 107, do we just run the migrate script? Or do we also run the deploy script afterward?

If you ran the deploy script after I posted the 107 script, then you don’t need to do anything. If you ran the deploy script before then, you’ll need to run the migrate script.

Specifically, what’s happening is that the view: command is going away come version 107. The script just pulls those lines out of the HASP packages. If you look at the script, it essentially boils down to one line:

find packages -name "hasp_*.yaml" -exec sed -i '/[[:blank:]]view\:/d' {} +

I’d still recommend running the script itself but if you speak bash you can see what’s going on here. Find all the hasp-related yaml files, and delete any line that has the view: thing going on.

I do want to keep one “stock default” config just because it makes the automations easy to line up with the Nextion HMI. Once a user has that basic config, then they can re-arrange pages at will, add/delete/etc, and adjust automations to match. Making it modular from the beginning makes the automations difficult because they are tied to a specific page number, so as soon as someone changes the ordering, the stock automations break.

However, you can still do the thing you are talking about right in the Nextion editor. Right-click a page and you’ll see some options including an import/export, so you can save individual pages to a file, cut unused pages out, duplicate pages you want more of, or share your custom pages with the rest of us.
image

In regards to the QR, I think I might go with my final idea in the post above. Standardize the unconfigured SSID and password to a single value, and we can use a pre-rendered picture object for the QR code instead of the QR object. This is great because it takes way less memory and still serves the need for first-time setup. I’ve tested it and it looks like it’s working well, and we get to keep the new page 9 for climate controls.

image

Someone mentioned weather
 anyone have a mockup of what that might look like? It’s worth noting that the new fonts will include weather icons, which can be mixed with text.

image

1 Like

but as long a the user KEEP to the same logic

P# been the page name

and

b# been the Button number

can’t see why every thing should just work

Thats one of the reason I have 3 around the house

same code just pass in difference data to match the room its in

Been working on some customization to one of my hasp. I found that the text for the three buttons on the bottom of page 1, 2, 3 get set in the first run automation. Is there any reason it change be changed during normal startup like the text on the other buttons?

Oh for sure! Making the change yourself to re-arrange things is easy (well, I think so anyway). My concern is for the first-time user, this project is already pretty complex and I want to remove as many barriers as possible between an assembled unit and a functioning HASP that works with Home Assistant. Once you have it up and running, then absolutely please do customize all the things!

However, this is also why I don’t want to distribute as a set of pages that the user needs to assemble into a functioning HMI, compile and flash to Nextion, and then customize the automations to match. All those things are a great idea once you have a handle on how everything works and I encourage people to do that, but it’s also a lot to deal with if you have never seen any of this before.

So, for the time being anyway, I’m shipping all the components as “ready-to-assemble” as possible.

Thanks for the info. It was just strange that the three labels were set one way and the other buttons another. The other buttons could have had their labels set in the first time automation also it seems and wasn’t sure if there was a reason for doing it this way.

edit: I completely mis-read your post. Let’s try this again


The text labels and page numbers on the page control buttons are configurable in the Home Assistant UI. If you’re using the new Lovelace yaml you’ll have a view that looks something like this:

The “Page Selection” section to the left is how you can interact with this. So
 those values are set only once in the first-time setup to give everything you see there some reasonable startup values. If you change the text or sliders there, they will apply to HASP and be remembered by Home Assistant. In this way, you can change the page buttons right in Home Assistant without having to edit automations.

The page change automations reference these values, which is how they are sent to the screen at run time. That’s what you’ll see in the rest of the automations.

end edit: everything below this line is me being dumb and not reading good.

Nothing more than a design decision. The page control buttons are setup to be used for all pages, so I load them on startup. The individual pages can all be optional (see post above), and as a result the automations specific to each page have all been split out, so you can pick and choose which ones you want to use, and it’s relatively easy to identify where to find the automations which apply to page 3 or whatever.

None of this is by necessity - feel free to modify at will!

Okay. That all makes sense now. I keep forgetting about the interaction with the GUI.

And speaking of GUI interactions, I have more info on the page changing issue. I have found when I use the command/json to change the page, the slider changes and things work as expected. But when I use the command/page command, it does not update the slider and this causes the problems I was having. I changed the command/page to the json version and it is working as expected.

Hello everybody,
Since the “official” store set-up by @luma does not ship to Europe (I believe it must be quite complicated to export goods), I have just made an order of some PCBs from a producer. As I placed a bulk order, I am going to sell 15 of them to anybody in Europe for roughly the same price as @luma’s.
The PCBs will be delivered to me by the end of february. Please note that this includes the PCB only, no other components.

Shall you be interested in purchasing one or more PCBs from me, just private-message me here on the community. I’m not selling for profit, I’m selling as I was forced to make a larger order than I need and thought I could help some other fellow Europeans who cannot access @luma’s devices.

PS:
To the community moderators: I quickly went through the home-assistant community guidelines and did not spot anything against selling, please let me know if this is not the case.

1 Like

Hi,

as i have posted earlier i am using a 7 inch nextion the back end is connected to a 5v 2a supply the thing is i can see it doing most of the times dropping mqtt and then tryin 2-3 times each time 30 second delay to reconnect to MQTT else its connected to wifi okay 


other screen which is 3.5 is all good

wifi doesn’t drop only MQTT, any idea what might be happening how to read logs ?

thanks

I see that too with the 2.4" display. I have an AP within 10ft and I don’t show it loosing network connection.

ya the network connection is fine mine is just 2 feet away from AP , wifi doesnt drop it just drops mqtt

I’m making some headway with the Nextion 0.59 environment.

My goal here is to ship a new Arduino firmware and Nextion LCD firmware in the next release. Combined, these should be backward-compatible with existing automations you may have made already, with the exception of the dynamic QR code component on page 0 and the graph component on page 9. In their place is a static QR code available on page 0 for first-time setup, and the beginnings of a climate control interface on page 9. These changes were agreed upon earlier in the thread and should be the extent of any breaking changes in the new version.

This means with the next update you should be able to apply the new firmware, keep using your existing automations, and everything should continue working as before but with anti-aliased fonts.

I’m now working on updating the bundled automations to make use of some of the new features available. You won’t have to use these new automations, but if you do you’ll get some extras. One major feature is the inclusion of proportional font support. The existing HASP project includes the monospace font “Consolas” in several sizes and one size of “WebDings” for some icons. The new development version adds 5 sizes of “Noto Sans” (24,32,48,64,80) along with a bold 80. This provides a nice proportional font option that renders well on the 2.4" screen.

Another feature added to the Noto Sans font is the FontAwesome icon set. You can add icons along with text by copying/pasting the icons from that cheatsheet into your automations. Here’s what that might look like:

While this is cool, I quickly discovered that it would be better if I had some more flexibility over the use of icons. The screen above is created by sending a command like this: p[1].b[4].txt="  Lights On ". Each button has a variable number of spaces padding things out to make the text and icons line up right. This is OK for buttons with static text, but as soon as you’re in the situation where the text is going to change then manual padding breaks. Take a look at the next page:

Consider the top item, the clock that appears in b[4]. The width of 1:54 is going to vary over time as we aren’t using fixed-width fonts. If you look at the calendar date below that, now we have two completely-different sizes of fonts, which can’t be done in a single button on Nextion. The “add spaces manually” approach to padding isn’t going to work on these buttons.

One simple option would be to re-write page 2 to split the buttons with new buttons to the left for the icons. This would work easily but would break backward compatibility. If you’re developing your own HMI, then by all means go ahead and use this approach.

For everyone else, I wanted a solution that works out of the box and doesn’t break your existing setup.

To make this work on the existing pages I’m making use of the xstr command from Nextion which allows one to place text anywhere on the screen. There are a lot of limitations around this approach, but what is gained is complete control over the text as it appears on the screen. You can draw letters (or icons) of any size, color, or justification and place them in any location on the screen.

For example, in the image above the thermometer and cloud icons change based on the outside temperature (thermometer fills as temp gets warmer) and the current conditions (“Cloudy” == cloud icon). It’s tricky to get right but I feel like I’ve solved most of the inherent problems with this approach and these workarounds will be demonstrated with the bundled automations.

With this update you’ll have the ability to place icons anywhere on the screen, all from Home Assistant and without modifying the Nextion HMI. Here’s what this looks like when interacting with the current development version:

3 Likes

That looks great. I am in the process of overhauling my Haswitch. I may just wait for this update. Any idea on release time?

“Soon” :smiley:

I’m shooting to wrap this up by this weekend providing testing goes well.


That is of course if I stop thinking up new things to add :stuck_out_tongue:

4 Likes

With easy color changing I figured themes were the next logical step


2 Likes

STOP TEASING US and release it! :smiley:

2 Likes

I have three HASP installed (purchased one built two) and running (almost). I have had all working in the past but after moving HA from an RPI-3B to 4B now to a i7 computer running Ubuntu 18.04.04, I have one HASP that is not working correctly. These three are labeled HASwitchPlate_1 to HASwitchPlate_3
at 192.168.123.102, 103, 104

HASwitchPlate_2 (103) is the only one this is not showing weather. I get 0 for degrees and blank in the condition label below (Rainy, Cloudy, etc). I do get the current time updating on this page, just not the weather. The other two work fine.
I have reinstalled twice. I have checked the weather page programing (/config/packages/haswitchplate_2/hasp_haswitchplate_2_p2_weather.yaml) and all is the same as other two except for the device _2 instead of _1 or _3. I use weather.nws for all three.
I do get one error in HA logs:

Log Details (ERROR)

Logger: homeassistant.components.automation
Integration: Automation (documentation, issues)
First occured: 8:58:39 AM (1 occurences)
Last logged: 8:58:39 AM

Error while executing automation automation.hasp_haswitchplate_3_p2_weather. Error rendering template for call_service at pos 4: UndefinedError: ‘None’ has no attribute ‘state’

I also see a difference in States UI where the HASP has several info menus. The menu called HASwitchPlate_2 shows “haswitchplate_2 Status ON” whereas the other with show Sensor:
HASwitchPlate_2 shows “haswitchplate_2 Sensor ON”
HASwitchPlate_2 shows “haswitchplate_2 Sensor ON”
All show Connected on this page.

My Home Assistant install in using the Alternate install procedures for ubuntu in the HA installation pages using Docker CE. I keep everything updated.

Wondering if anyone can help as I have been trying to get this going for weeks with no luck. Thanks