Sonoff NSPanel by ITead - Smart Scene Wall Switch based on ESP32 and custom Nextion Touch Screen Panel Display (non-Pro variant)

I have a NSPanel that I flashed with ESPHome and downloaded custom screen using Christopher videos.
It was working and then I tried another update to the tft and It was weird.

The NSPanel powers on and does not play sound. I can touch the screen and it wakes up and even the dual state button on the screen changes state when i touch it. In Home Assistant I can see the device and the two physical buttons toggle correctly. The brightness slider in HA does not do anything to the screen.

Here is what I get when I try to use the upload tft service.

[21:40:41][D][nextion_upload:169]: Connected
[21:40:41][D][nextion_upload:175]: Requesting URL: http://192.168.0.200:8123/local/FamilyRoom.tft
[21:40:41][D][nextion_upload:209]: Updating Nextion NX4832F035_011C...
[21:40:41][D][nextion_upload:235]: Waiting for upgrade response
[21:40:42][E][uart:015]: Reading from UART timed out at byte 0!
[21:40:42][E][uart:015]: Reading from UART timed out at byte 0!
[21:40:42][E][uart:015]: Reading from UART timed out at byte 0!
[21:40:42][E][uart:015]: Reading from UART timed out at byte 0!
[21:40:42][E][uart:015]: Reading from UART timed out at byte 0!
[21:40:42][E][uart:015]: Reading from UART timed out at byte 0!
[21:40:42][E][uart:015]: Reading from UART timed out at byte 0!
[21:40:42][E][uart:015]: Reading from UART timed out at byte 0!
[21:40:42][E][uart:015]: Reading from UART timed out at byte 0!
[21:40:42][E][uart:015]: Reading from UART timed out at byte 0!
[21:40:43][E][uart:015]: Reading from UART timed out at byte 0!
[21:40:43][E][uart:015]: Reading from UART timed out at byte 0!
[21:40:43][E][uart:015]: Reading from UART timed out at byte 0!
[21:40:43][E][uart:015]: Reading from UART timed out at byte 0!
[21:40:43][E][uart:015]: Reading from UART timed out at byte 0!
[21:40:43][E][uart:015]: Reading from UART timed out at byte 0!
[21:40:43][E][uart:015]: Reading from UART timed out at byte 0!
[21:40:43][E][uart:015]: Reading from UART timed out at byte 0!
[21:40:43][E][uart:015]: Reading from UART timed out at byte 0!
[21:40:43][D][nextion_upload:239]: Upgrade response is  19
[21:40:43][D][nextion_upload:242]: Available 0 : 0x00
[21:40:43][D][nextion_upload:242]: Available 1 : 0x00
[21:40:43][D][nextion_upload:242]: Available 2 : 0x00
[21:40:43][D][nextion_upload:242]: Available 3 : 0x00
[21:40:43][D][nextion_upload:242]: Available 4 : 0x00
[21:40:43][D][nextion_upload:242]: Available 5 : 0x00
[21:40:43][D][nextion_upload:242]: Available 6 : 0x00
[21:40:43][D][nextion_upload:242]: Available 7 : 0x00
[21:40:44][D][nextion_upload:242]: Available 8 : 0x00
[21:40:44][D][nextion_upload:242]: Available 9 : 0x00
[21:40:44][D][nextion_upload:242]: Available 10 : 0x00
[21:40:44][D][nextion_upload:242]: Available 11 : 0x00
[21:40:44][D][nextion_upload:242]: Available 12 : 0x00
[21:40:44][D][nextion_upload:242]: Available 13 : 0x00
[21:40:44][D][nextion_upload:242]: Available 14 : 0x00
[21:40:44][D][nextion_upload:242]: Available 15 : 0x00
[21:40:44][D][nextion_upload:242]: Available 16 : 0x00
[21:40:44][D][nextion_upload:242]: Available 17 : 0x00
[21:40:44][D][nextion_upload:242]: Available 18 : 0x00
[21:40:44][D][nextion_upload:248]: preparation for tft update failed 0 ""
[21:40:44][D][nextion_upload:324]: Restarting Nextion
INFO nspanel-familyroom.local: Error while reading incoming messages: Error while reading data: [Errno 104] Connection reset by peer
INFO Disconnected from ESPHome API for nspanel-familyroom.local
WARNING Disconnected from API
INFO nspanel-familyroom.local: Ping Failed: Error while reading data: [Errno 104] Connection reset by peer
INFO Successfully connected to nspanel-familyroom.local

Hi,

Thanks for all the answers and help :slight_smile:

I have my panel as : NSPanel running ESPHome connected to Home Assistant - YouTube
All was going by:

rtttl:
id: ${switch_id}_buzzer
output: ${switch_id}_buzzer_out

So, what I did was removed all the ${switch_id}, punt the services in and voila it works :slight_smile:

Thanks all!

Great find! Do you mind sharing where you found 91 so I can figure out other numbers (ie 38182=send string, 48284=raise event etc)? Thanks!!

Okay interesting. My problem is kind of gone for the moment since I removed the retained MQTT messages from the MQTT broker. I will try to do do some experiments on how much more I can add soon. I also got an interesting reply on my youtube video where someone had a theory about using OTA. Pasting the comment here:

ā€œNot really familiar with the nspanel, but your issues at 60% memory usage could be caused by it reserving memory for OTA updates? I know that with ESP32/ESP8266 mcus, only 50% of the memory can be used for firmware if OTA is used?ā€

But just to give some numbers on what my setup can handle right now without issues:
Right now I have:
Total platform entries: 79
Platform Nextion: 34
Platform MQTT_subscriptions: 31
Like 2200 lines of code

64,3 % flash memory used

One thing I changed as well was to set all platform entries to internal: true
That seems to stop the esp to initialize every single item as a mqtt component. I thought that would relieve some pressure during the boot. No one of my nextion buttons need to be active on MQTT for example. Itā€™s a lot less happening now during boot at least but itā€™s all just guesses. :slight_smile:

Do you think NS can be used outside? Thinking of using it on covered terrace. But temperature can go as low qs -25C

Have a look at the published spec here

(It says -10C to +40C, and indoor only)

Did you manage to get it acting as an alarm Arm / Disarm? Iā€™d love to see the code you used to do it if you donā€™t mind sharing, please? :slight_smile:

I built the interface and then put the project on hold as others came up. Still need to dig into the Alarmo calls I need to use.

Ah bummer, thatā€™s unfortunate, Iā€™m basically at that same place right now :sweat_smile:

I would like to thank @DeanoX for sharing the config, I have mine set as I want but one thing bothers me - itā€™s possible to have thermostat and indoor temp decimal part displayed in original sonoff GUI (panel is flashed with ESPHome already)?

@kabelochkaffe mine wobbles at 67% just streamlining my code to try and get what i want finished :rofl:

3 Likes

It fits in mine. (standard orange box)

Hi guys,
Can anyone share code snippet to wake screen from HA? I would like to wake the panel from presence sensor.

TIA

@cismarine i canā€™t c&p as im remote on my mobile but heres a picture :grin:

Thanks,
thatā€™s more than enough.

I had this, but it does not work

- platform: homeassistant
    id: wake_screen
    entity_id: input_boolean.nspanel_01_wake_screen
    on_value:
      then:
        - lambda: 'id(disp1).sleep(false);'

Thank you!

Hello,
Iā€™m new to my nspnael and I must say itā€™s extremely chaoticā€¦

I have the us version, and this format has almost no community-made configuration, which greatly limits my understanding.

My original tft image is broken despite my original pre-flash backup, which I donā€™t know why doesnā€™t work for a restore.

I am therefore obliged to create a custom panel.

Iā€™m trying for the moment to simply manage to make a page with a reaction from home assistant.

Iā€™m using this project (GitHub - marcfager/nspanel-mf: Custom HMI controlled by ESPHome for the Sonoff NSPanel. Includes media player card and home screen with weather data and clock. More to come.) in europe format but itā€™s the closest donfig to what I want to start understanding.

When compiling the yalm file on esp, I get an error that I absolutely cannot understand:

Here is the code in question which seems to be causing the problem. I absolutely do not understand the error, especially since it is a configuration that is supposed to work as it is

Thanks for the help provided

number:
# Screen brightness
  - platform: template
    name: $device_name Brightness
    id: brightness
    entity_category: config
    unit_of_measurement: '%'
    min_value: 0
    max_value: 100
    step: 1
    initial_value: 30
    set_action:
      then:
        - lambda: 'id(disp1).set_backlight_brightness(x/100);'
        - lambda: 'id(disp1).send_command_printf("Home.brightness.val=%i", int(x));'

  # Screen brightness dimmed down
  - platform: template
    name: $device_name Brightness dimdown
    id: brightness_dim
    entity_category: config
    unit_of_measurement: '%'
    min_value: 0
    max_value: 100
    step: 1
    initial_value: 1
    set_action:
      then:
        - lambda: 'id(disp1).send_command_printf("Home.brightdd.val=%i", int(x));'


# Configure the screen itself
display:
  - platform: nextion
    id: disp1
    uart_id: tf_uart
    tft_url: http://192.168.1.89:8123/local/hmi0.tft
    # A little fun...
    on_setup:
      then:
        # Enable 1 light page (up to 4 available)
        - lambda: id(disp1).send_command_printf("Lights.pages.val=1");
        - number.set:
            id: brightness
            value: 30
        - lambda: id(disp1).send_command_printf("page 4");
        - wait_until:
            api.connected
        - switch.template.publish:
            id: nextion_init
            state: on
        - if:
            condition:
              - switch.is_on: alarm_activated
            then:
              - lambda: id(disp1).send_command_printf("page 5");
            else:
              - delay: 5s
              - lambda: id(disp1).send_command_printf("page 0");

Thereā€™s a fairly steep learning curve right now to use these things, itā€™s very much a DIY situation. It may get better over time, but expect to be frustrated and have to spend some time troubleshooting. At best, you can use the examples out there for inspiration and a launching point, but I donā€™t think weā€™re at the point where theyā€™re completely turnkey. (I know some folks have providing that as a goal, and I hope they are successful)

In this case, I just focused on the first part of the error message, ā€œ[unit_of_measurement] is an invalid option for [number.template]ā€. Then I went to the documentation: Number Component ā€” ESPHome

It says there:

  • unit_of_measurement (Optional, string): Manually set the unit of measurement for the number. Requires Home Assistant Core 2021.12 or newer.

So my first guess is that maybe you donā€™t have Home Assistant Core 2021.12 or newer.

1 Like

WOW I would never have found it on my ownā€¦ I got my hands back on my homeassistant and indeed I hadnā€™t done the update. you just saved me a lot of time!! thank you very much it works

It is indeed a difficult learning and there is a lack of documentation, although your videos have helped me a lot you are the only one who has my format by providing a basic model and many people are based on your works. So far no configuration, not even yours which could however work in my us format, does not work.

the yaml is not dependent on the version. its only the tft. you need to install the nextion editor and open his HMI project file in that. then look into how itā€™s tied into the yaml file with picture idā€™s etc.
Iā€™m unsure if you will have to create a new project with the correct screen or if there is a way to swap it within the project, then youā€™ll have to change out the images for your own rescaled ones and move things around. just focus on getting it open in the editor.

1 Like