I wanted to share my further work on the same code I shared earlier. In addition to the home screen with temperature and weather widget and the music page, I have added the following:
When the device boots up, it shows a HA logo on the screen. When the ESP has connected to WiFi, the IP is printed (to easier add device to HA if not yet added and to make troubleshooting easier). When the screen is fully set up from HA, all elements are allowed to populate the global elements on the screen during a short delay period. That way the home screen is ready when it is showed. Before adding this functionality, the Home screen appeared but with no data for a certain amount of time. I also delayed all elements to wait for the screen being ready before populating it to prevent empty positions (when items are populated on the screen before the screen is ready).
On the right side, there is now a page to control 8 lights. Six different light types are available with both on and off state. Both the state and the lights name are pulled from HA automatically.
I added a page to be used when the alarm is turned on. This page shows an armed symbol and prevents the screen from being used. I think it is a more elegant feature than just turning the display off.
Notifications can be sent from HA to the display. The NSPanel plays a tone and displays the notification.
@marcfager - wanted to highlight two really smart features you have.
# Service to control the visible page from Home Assistant
- service: set_page
variables:
page: int
then:
- lambda: id(disp1).send_command_printf("page %i", page);
Very neat idea!
# Service to send a command directly to the display. Useful for testing
- service: send_command
variables:
cmd: string
then:
- lambda: 'id(disp1).send_command_printf("%s", cmd.c_str());'
This will be very handy, no more compiling and uploading to test!
[edit] do you have an example of what the cmd string might look like. Only had time to test the contents of a send method but those didn’t work. Need more experimenting.
Love the various new HMI GUIs . Some great looking ones. As I have zero design skills I’ve gone another path. I’m using the stock HMI with ESPHome. But as the nspanel component doesn’t yet implement all the widgets/thermostat I’ve very mildly modded a local copy that allows it to essentially pass through the JSON received from the panel. I can then catch that in the ESPhome log, decode and handle the GUI instruction with lambda sections in ESPhome. I can then return the necessary JSON commands through the component to update the panel in return.
The documentation from blakadder for Tasmota is absolutely invaluable - and the ability to see how both tasmota and the ESPHome nspanel component drive the screen already.
So far I have :-
nspanel component setting Temperature, Date, Time, WiFi, Relay indicators as standard
Weather updating via wttr.in (as per Tasmota) with https json request direct from the NSPanel
2-Way sync of thermostat with HA (Set temperature + On/Off)
Today the amazing folks on the Unofficial Nextion Discord discovered how to fix the problem of EU panels having their touch position offset if you’re using a custom TFT. Put this incantation into Program.s (at the top of the Nextion Editor):
lcd_dev fffb 0002 0000 0020
and everything should be good.
@gijsje@krulbel … I tried to tag folks who mentioned they were having this problem, but I feel like there were others I missed.
Could you make a backup of your panel with esphome and share it so you can recover the original HMI? In euphoria I forgot to backup the original tft I would be grateful
have errors when compiling on dev-esphome: Compiling .pioenvs\nspanel1\src\esphome\components\web_server\web_server.cpp.o</s> <s>src\esphome\components\json\json_util.cpp: In function 'std::__cxx11::string esphome::json::build_json(const json_build_t&)':</s> <s>src\esphome\components\json\json_util.cpp:28:3: error: 'DynamicJsonDocument' was not declared in this scope</s> <s> DynamicJsonDocument json_document(free_heap);</s> <s> ^</s> <s>src\esphome\components\json\json_util.cpp:29:21: error: 'json_document' was not declared in this scope</s> <s> JsonObject root = json_document.to<JsonObject>();</s> <s> ^</s> <s>src\esphome\components\json\json_util.cpp:29:48: error: expected primary-expression before '>' token</s> <s> JsonObject root = json_document.to<JsonObject>();</s> <s> ^</s> <s>src\esphome\components\json\json_util.cpp:29:50: error: expected primary-expression before ')' token</s> <s> JsonObject root = json_document.to<JsonObject>();</s> <s> ^</s> <s>src\esphome\components\json\json_util.cpp:30:9: error: use of deleted function 'ArduinoJson::JsonObject::JsonObject(const ArduinoJson::JsonObject&)'</s> <s> f(root);</s> <s> ^
as i understand: i need to downgrage to ArduinoJson v5, but i don’t know how?
P.s. changed code to ArduinoJson v6, but now have another problem: panel restarts after few seconds from main screen opened… P.s.2 maybe it’s because it deleted weather section and wifi-indicator from my code? problem is when state changed from UI Panel - it’s reboot…
This disables the nspanel component from trying to handle the responses from the panel, and simply allows it to log them.
You will also need to delete the line
lambda: 'id(nspanel1).send_wifi_state_();'
from the screen power switch section of my NSP yaml - it will cause another error, but didn’t accomplish what I needed so easier to delete.
Obviously once you’re using the local version you wont benefit from any additional functionality or bugfixes applied to the component moving forward. Ideally a “on_json_message” trigger could be added to the component in the future to achieve the same thing.
This is all very much work in progress currently and mostly I wanted to see the potential of the original panel GUI,
My panel is coming on quite nicely. But one problem I can’t get my head round is that the display disappears on the right hand side. I have the correct profile in the Nextion editor and it looks fine in the debugger but it’s almost like the image is too big.
Long time lurker, first time poster! I’ve purchased three of these units for my new house in AUS - and these truly are game changers.
I’m no UI designer, and only just started playing with both Tasmota and ESPHome, love both, and both will def have their uses.
Decided to run ESPHome on these rather than Tasmota, personal opinion is these might be better suited to ESPHome where tasmota is better for the standalone sensors without the UI.
Anyways, here’s my latest iteration of the front page of my NSPanel.
Got a bit more work to do! Love the fact that I can QR code my guest-wifi details (if you hit the wifi button it switches to a new page with the code)! this has been something i’ve wanted at my front door for a long time!
Still got some work to do but am loving this thing!