marcfager / nspanel-mf Goto Github PK
View Code? Open in Web Editor NEWCustom HMI controlled by ESPHome for the Sonoff NSPanel. Includes media player card and home screen with weather data and clock. More to come.
Custom HMI controlled by ESPHome for the Sonoff NSPanel. Includes media player card and home screen with weather data and clock. More to come.
Hi, very nice work btw!
looking at doing my own screens and had a question before starting. Is it right you can't use icons with transparent backgrounds? So you need to make an image and flatten the icons onto that, then cut those new icons out with the background included and use them in the hmi?
That sound very awkward to do. You have any tips on how to do that? both to make the icons and layout out in hmi editor?
Thanks!!
First off, this is fantastic!
I have managed to set up home screen and lights screen as I want.
Now I'm trying to set up lights2 or add any other screen to the right of Lights page?
I can't find where this order is set or where this is controlled.
Thanks for all your hard work on this. It has given me a great basis to edit around for my own setup. I have made some custom icons, and replaced some of yours in the Nextion editor however, I can't seem to find how to change the id that is linked to each picture element. I have zero experience with Nextion and honestly, I'm not even sure if I'm asking the question correctly.
So far I have swapped out the images 22 through 29 which has enabled me to change the top row of lights icons. You have three of the bottom row all referencing images 32 and 33 but I cannot find out where I can change this so I can uploaded more images. I hope that makes sense?
Thanks again for your hard work.
Would you be willing to share your source files for creating the images & button icons?
Hi, just wanting to share with you a great video that could help you in your todo element : "Dim screen when not used and wake up when used."
Very great project I very like it! Thanks!
Hi,
First great work!
I try to upload the yaml on esphome after edited the code to fit to my sensor in ha..
As soon as i boot , after wifi connection i got this message..
[09:43:36][D][api:098]: Accepted 192.168.100.96
[09:43:36][W][api.connection:083]: Home Assistant 2021.12.10 (192.168.100.96): Connection closed
Previously with another yml , i had no problem.. do you know why ha closed the connection ?
Thanks
@marcfager would you mind to share the nextion project? :)
Cant update from version 2023.5.5 to 2023.6.2
wont initiate the update pulled through home assistant esphome addon.
Any idea of what i can do?
Hi,
I copied your config and flashed it with one light only, but then when I power it with 5v the screen just flashes on and off randomly (staying on the Sonoff boot logo screen), wifi connects but the API port stays closed.
I then tried a minimal config, thinking maybe one of the sensors or services was causing the issue :
esphome:
name: nspanel-lr
esp32:
board: esp32dev
ota:
password: "blah"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
logger:
api:
With that the logs on serial show a boot loop, with the below repeating endlessly :
[17:16:27]ets Jul 29 2019 12:21:46
[17:16:27]
[17:16:27]rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[17:16:27]configsip: 0, SPIWP:0xee
[17:16:27]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[17:16:27]mode:DIO, clock div:2
[17:16:27]load:0x3fff0018,len:4
[17:16:27]load:0x3fff001c,len:1044
[17:16:27]load:0x40078000,len:8896
[17:16:27]load:0x40080400,len:5828
[17:16:27]entry 0x400806ac
[17:16:28][I][logger:214]: Log initialized
[17:16:28][C][ota:461]: There have been 10 suspected unsuccessful boot attempts.
[17:16:28][D][esp32.preferences:114]: Saving preferences to flash...
[17:16:28][E][ota:468]: Boot loop detected. Proceeding to safe mode.
[17:16:28][I][app:029]: Running through setup()...
[17:16:28][C][wifi:037]: Setting up WiFi...
That's when powering the esp32 itself with 3v on the UART pins, is that supposed to boot ? I can't get any logs when giving the whole board 5v through the bottom header of course so that's difficult to diagnose.
With that it doesn't seem to connect to the wifi at all anymore so I'm not sure it's the same issue as I started with.
Any help would be appreciated, I'm stuck.
One detail is in the videos I saw the bottom header has the 5v and GND pins labelled as such, whereas mine has 'TP7' and 'TP1' instead there. I'm assuming they're still the same pins and I've been using them as such (and presumably haven't fried anything since wifi did come up with the first config) but maybe I'm wrong.
Trying to edit the HMI file to work with a US version, but I can't even open the file in Nextion editor.
Also, with the obvious changes, will the YAML work with a US version?
Can you add sliders for light brightness?
First of all:
Thank you for this amazing work.
I just configured all the Media Player Button an run into this problem:
https://youtu.be/g8OUxJEw2dU?t=52
Have someone else this problem?
Just a general query, for things like the notifications is it possible to send images to the panel? Use case would be thumbnails from a doorbell, media player covers or custom backgrounds. I understand there is limited ram and bandwidth to the panel.
The compiled tft file in the repo doesn't match the esphome yaml. The yaml defined the speed at 115600, which dosn't work, but setting it up to 9600 solves the issue and make the two talk again.
I love this implementation, but when I tried to convert a 2nd page of light switches to handle my heating zones defined as input_booleans the panel would no longer boot.
After re-flashing a working binary using my serial adapter I managed to recover the panel.
Is there a recommended way I could support virtual switches using my input_booleans or sensor templates or by some other means?
Hello
Thanks for sharing your work, I build a v0 of mine from yours and I am very happy. Thanks a lot.
I notice your hotspots have an offset. Have you seen there is a command to avoid this?
https://github.com/masto/NSPanel-Demo-Files/wiki/HowTo
Fixing the touch offset for EU panels: Add lcd_dev fffb 0002 0000 0020 to Program.s (at the top of the Nextion Editor)
Thanks for all the work you've done on this project - it's given me and I suspect many others a huge hand in getting these devices into a useful state.
I have taken your project and am extending it for heating but I have an issue when I call climate.set_temperature whereby if I send a temperature value (which of course is the whole point) the device never finishes booting (instead it sticks on the HA logo) and occasionally boot loops.
With the following code, the device boots but of course the buttons don't do anything;
- platform: nextion
name: $device_name Heating Up Button
page_id: 0
component_id: 24
on_press:
then:
- homeassistant.service:
service: climate.set_temperature
data:
entity_id: climate.kids_bed
temperature: '20'
But with the following, the only difference being sending a temperature value, the device crashes;
- platform: nextion
name: $device_name Heating Up Button
page_id: 0
component_id: 24
on_press:
then:
- homeassistant.service:
service: climate.set_temperature
data:
entity_id: climate.kids_bed
I've tried variants of quotes to no avail.
If I look at the example here it clearly shows the temperature sent with a single quote but this doesn't work for me.
nspanel.zip
Verify Installation is ok, only when I try to install the ESPHome I get this:
What went wrong:
INFO ESPHome 2024.2.1 INFO Reading configuration /config/esphome/nspanelbroosbedroom.yaml... INFO Detected timezone 'Europe/Brussels' INFO Generating C++ source... Traceback (most recent call last): File "/usr/local/bin/esphome", line 33, in <module> sys.exit(load_entry_point('esphome', 'console_scripts', 'esphome')()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/esphome/esphome/__main__.py", line 1041, in main return run_esphome(sys.argv) ^^^^^^^^^^^^^^^^^^^^^ File "/esphome/esphome/__main__.py", line 1028, in run_esphome rc = POST_CONFIG_ACTIONS[args.command](args, config) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/esphome/esphome/__main__.py", line 407, in command_compile exit_code = write_cpp(config) ^^^^^^^^^^^^^^^^^ File "/esphome/esphome/__main__.py", line 192, in write_cpp generate_cpp_contents(config) File "/esphome/esphome/__main__.py", line 204, in generate_cpp_contents CORE.flush_tasks() File "/esphome/esphome/core/__init__.py", line 679, in flush_tasks self.event_loop.flush_tasks() File "/esphome/esphome/coroutine.py", line 246, in flush_tasks next(task.iterator) File "/esphome/esphome/__main__.py", line 184, in wrapped await coro(conf) File "/data/external_components/b5254113/esphome/components/nextion/display.py", line 92, in to_code await display.register_display(var, config) File "/esphome/esphome/components/display/__init__.py", line 119, in register_display await cg.register_component(var, config) File "/esphome/esphome/cpp_helpers.py", line 56, in register_component raise ValueError( ValueError: Component ID disp1 was not declared to inherit from Component, or was registered twice. Please create a bug report with your configuration.
The NSpanel config is added as a zip
Hello,
Would it be possible to change the timeout for the screensaver via a helper variable in Home Assistant?
Thank you for making this project. I just found it, and I am thinking of more and more uses for it.
In the Nextion editor go to the Program.s tab.
Add the line:
lcd_dev fffb 0002 0000 0020
Now your touchscreen inputs should be perfectly aligned with the elements on the display.
I was just wondering if this will display correctly on the vertical North American panels?
Thanks
Craig
I've successfully flashed ESPHome on my NSPanel and adapted the settings for my personal needs with Homeassistant.
What I didn't get is, that the buzzer of my panel is not working with the following configuration:
`output:
I haven't found any information about using another GPIO, so I assume using pin 21 should work, but I cannot get rttl tones played using the homeassistant service.
ESPHome Log:
Hello. I have a question. You have a lot of pages in your project. But only 3 participate in swaps. How do I add a page so that it opens with a swap to the left and to the left, or for example with a swap to the top or bottom?
I am looking for a way to factory restore the NSPanel.
What i mean by factory restore is to flash the original HMI interface and the original BIN for the esp32.
Getting backup for the ESP is easy and i have done it. Now how to do the HMI/TFT part? or is there some place where i can get the original TFT. HMI would be much nicer but beggars can't be choosers.
It would be very useful to be able to add the alarm clock function.
Hello, I want to edit the first page to add some buttons on the right of the forecast, But where is it defined in the yaml file?
Hi Marc, am trying to extend on your great work (thanks a lot for commencing this!!).
I have odd issues though and maybe you have see this before...if not then maybe as a 'fyi'?
In the same way as you added light to the lights page, to the home-page I added a batterywarning pic field and two pictures (off + on), updated the yaml (binary sensor) and all went fine. Then I added more to the home screen as a textsensor driven box and inside/nspanel-temp ... and as of some point the boot loop changes and the only way to get it working seems to be to fully switch it off for about 30 sec+. As the boot does not kick back any log it is quite hard to analyse other than go completely back to your base and gradually re-do the lot and see where it starts to fail....which I am doing right now but the results are different whilst booting with/out full power off.
BTW, the differences in boot are: if all fine then the screen flashes a couple of times between HA page and main page...if not fine then it flashes only the HA page and a full power down is needed.
Any chance you have had similar issues and maybe some tips in this area?
Example: section with input_boolean works and boots as-before, when adding the motion part, it changes boot loop. If I then remove the battery part...all OK again, so it seems related to having both active???
# Battery warning, output use in display (bottom)
- platform: homeassistant
id: battery_low
entity_id: input_boolean.battery_low
on_state:
then:
- lambda: |-
int symbol=36;
if (id(battery_low).state)
{
symbol=37;
}
id(disp1).send_command_printf("Home.battery.pic=%i", symbol);
# Motion warning, output use in display (bottom)
# - platform: homeassistant
# id: person_detected
# entity_id: binary_sensor.tapo_camera_545d_motion
# on_state:
# then:
# - lambda: |-
# if (x) {
# id(disp1).send_command_printf("Home.pdetect.pic=%i", 39);
# }
# else {
# id(disp1).send_command_printf("Home.pdetect.pic=%i", 38);
# }
I just flashed nspanel-mf code in two new Sonoff NsPanel devices (EU version) and have the following problem on both : the nextion TFT file fails.
On the device logs (esphome logs nspanel.yaml) I can see the following relevant infos :
...
[16:42:17][C][nextion:123]: Nextion:
[16:42:17][C][nextion:124]: Device Model: NX4832F035_011C
[16:42:17][C][nextion:125]: Firmware Version: 50
[16:42:17][C][nextion:126]: Serial Number: 17663401EB61F835
[16:42:17][C][nextion:127]: Flash Size: 16777216
[16:42:17][C][nextion:128]: Wake On Touch: True
...
[16:35:11][E][uart:015]: Reading from UART timed out at byte 0!
[16:35:11][W][nextion:072]: Nextion is not connected!
[16:35:12][E][uart:015]: Reading from UART timed out at byte 0!
[16:35:12][W][nextion:072]: Nextion is not connected!
[16:35:13][E][uart:015]: Reading from UART timed out at byte 0!
[16:35:13][W][nextion:072]: Nextion is not connected!
The last error messages are repeated two times per second.
When I start the "upload_tft" service from HomeAssistant, I get the following messages in the log :
[16:43:40][D][nextion_upload:169]: Connected
[16:43:40][D][nextion_upload:175]: Requesting URL: http://192.168.8.20:8123/local/nextion.tft
[16:43:40][D][nextion_upload:209]: Updating Nextion NX4832F035_011C...
[16:43:40][D][nextion_upload:235]: Waiting for upgrade response
[16:43:40][E][uart:015]: Reading from UART timed out at byte 0!
[16:43:40][E][uart:015]: Reading from UART timed out at byte 0!
[16:43:40][E][uart:015]: Reading from UART timed out at byte 0!
[16:43:41][E][uart:015]: Reading from UART timed out at byte 0!
[16:43:41][E][uart:015]: Reading from UART timed out at byte 0!
[16:43:41][E][uart:015]: Reading from UART timed out at byte 0!
[16:43:41][E][uart:015]: Reading from UART timed out at byte 0!
[16:43:41][E][uart:015]: Reading from UART timed out at byte 0!
[16:43:41][E][uart:015]: Reading from UART timed out at byte 0!
[16:43:41][E][uart:015]: Reading from UART timed out at byte 0!
[16:43:41][E][uart:015]: Reading from UART timed out at byte 0!
[16:43:41][E][uart:015]: Reading from UART timed out at byte 0!
[16:43:42][E][uart:015]: Reading from UART timed out at byte 0!
[16:43:42][E][uart:015]: Reading from UART timed out at byte 0!
[16:43:42][E][uart:015]: Reading from UART timed out at byte 0!
[16:43:42][E][uart:015]: Reading from UART timed out at byte 0!
[16:43:42][E][uart:015]: Reading from UART timed out at byte 0!
[16:43:42][E][uart:015]: Reading from UART timed out at byte 0!
[16:43:42][E][uart:015]: Reading from UART timed out at byte 0!
[16:43:42][D][nextion_upload:239]: Upgrade response is 19
[16:43:42][D][nextion_upload:242]: Available 0 : 0x00
[16:43:42][D][nextion_upload:242]: Available 1 : 0x00
[16:43:42][D][nextion_upload:242]: Available 2 : 0x00
[16:43:42][D][nextion_upload:242]: Available 3 : 0x00
[16:43:42][D][nextion_upload:242]: Available 4 : 0x00
[16:43:42][D][nextion_upload:242]: Available 5 : 0x00
[16:43:42][D][nextion_upload:242]: Available 6 : 0x00
[16:43:42][D][nextion_upload:242]: Available 7 : 0x00
[16:43:42][D][nextion_upload:242]: Available 8 : 0x00
[16:43:42][D][nextion_upload:242]: Available 9 : 0x00
[16:43:42][D][nextion_upload:242]: Available 10 : 0x00
[16:43:42][D][nextion_upload:242]: Available 11 : 0x00
[16:43:42][D][nextion_upload:242]: Available 12 : 0x00
[16:43:42][D][nextion_upload:242]: Available 13 : 0x00
[16:43:42][D][nextion_upload:242]: Available 14 : 0x00
[16:43:42][D][nextion_upload:242]: Available 15 : 0x00
[16:43:42][D][nextion_upload:242]: Available 16 : 0x00
[16:43:42][D][nextion_upload:242]: Available 17 : 0x00
[16:43:42][D][nextion_upload:242]: Available 18 : 0x00
[16:43:42][D][nextion_upload:248]: preparation for tft update failed 0 ""
[16:43:42][D][nextion_upload:324]: Restarting Nextion
[16:43:44][D][nextion_upload:327]: Restarting esphome
INFO nspanel.local: Error while reading incoming messages: Error while reading data: [Errno 104] Connection reset by peer
INFO Disconnected from ESPHome API for nspanel.local
WARNING Disconnected from API
INFO nspanel.local: Ping Failed: Error while reading data: [Errno 104] Connection reset by peer
INFO Successfully connected to nspanel.local
[16:43:49][D][api:102]: Accepted ::FFFF:C0A8:814
[16:43:49][D][api.connection:827]: Home Assistant 2022.3.8 (::FFFF:C0A8:814): Connected successfully
[16:43:49][D][time:039]: Synchronized time: 2022-04-03 16:43:49
[16:43:50][D][homeassistant.text_sensor:017]: 'sun.sun': Got state 'above_horizon'
[16:43:53][D][nextion:253]: Manually set nextion report ready
[16:43:53][D][nextion:330]: Nextion is setup
[16:43:53][D][number:010]: 'nspanel-dev Brightness' - Setting
[16:43:53][D][number:029]: Value: 30.000000
[16:43:53][D][switch:037]: 'nspanel-dev Nextion inited': Sending state ON
[16:43:53][E][nextion:262]: Nextion queue is empty!
I tried numerous times without success.
Any idea ?
i have connected everything according to the manual, 3.3V, GND, RX and RX to 3.3V, GND RX and TX.
GPIO0 to GND.
But it is not entering bootloader. No connection in ESP home flasher. When i disconnect GPIO0 from GND, it starts correctly, as i can ping the ip adres of the device.
I completely removed the oard from the nspanel, so the serial connection is not touching the metal
In the Nextion Editor, set the vscope of the QR code qr0 to global.
Export the .tft file and upload it to the display, then the service should work.
So I tried to flash my nspanel but when I uploaded to the device via the Dev tools I'm met with a error message "Model does not match
Device Model:
NX4832F035_0110"
Hi;
Thanks for developing this, I would like to do my configs via HA as per this:
"If you prefer to set-and-forget it, you can replace the media entities, weather entities, light entities etc. with HA templates or input_text fields. That way you can re-configure everything directly from Home Assistant."
I have tried adding a binary sensor to ha:
- platform: nextion
name: Light 2 button
page_id: 2
component_id: 19
on_click:
- homeassistant.service:
service: light.toggle
data:
entity_id: light.jack
But I get the error: Platform error binary_sensor.nextion - Integration 'nextion' not found.
Any chance you could provide some info on how to configure the panel from within HA rather than in the esphome yaml file ?
Many Thanks
Foremost, thanks for sharing. This is awesome work.
For reference, is it possible to disable the music page from ESPhome or HA? Or is this only possible in the HMI file?
Are you planning on adding more icons to support scenes instead of just lights? Currently, I'm using a modified version with some different icons I put in myself.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.