Sonoff NSPanel - Uploading tft to Nextion display fails

Hi all!
I have a Sonoff NSPanel and managed to upload the tft file for testing from here:

But now I have the problem, I can’t upload any other file. Any hints what it could be?

The log looks like this:

[16:19:12][D][nextion_upload:169]: Connected
[16:19:12][D][nextion_upload:175]: Requesting URL: http://192.168.1.43:8123/local/ns-panel.tft
[16:19:12][D][nextion_upload:209]: Updating Nextion NX4832F035_011C...
[16:19:12][D][nextion_upload:235]: Waiting for upgrade response
[16:19:13][E][uart:015]: Reading from UART timed out at byte 0!
[16:19:13][E][uart:015]: Reading from UART timed out at byte 0!
[16:19:13][E][uart:015]: Reading from UART timed out at byte 0!
[16:19:13][E][uart:015]: Reading from UART timed out at byte 0!
[16:19:13][E][uart:015]: Reading from UART timed out at byte 0!
[16:19:13][E][uart:015]: Reading from UART timed out at byte 0!
[16:19:14][E][uart:015]: Reading from UART timed out at byte 0!
[16:19:14][E][uart:015]: Reading from UART timed out at byte 0!
[16:19:14][E][uart:015]: Reading from UART timed out at byte 0!
[16:19:14][E][uart:015]: Reading from UART timed out at byte 0!
[16:19:14][E][uart:015]: Reading from UART timed out at byte 0!
[16:19:14][E][uart:015]: Reading from UART timed out at byte 0!
[16:19:14][E][uart:015]: Reading from UART timed out at byte 0!
[16:19:14][D][nextion_upload:239]: Upgrade response is  43
[16:19:14][D][nextion_upload:242]: Available 0 : 0x00
[16:19:14][D][nextion_upload:242]: Available 1 : 0x00
[16:19:14][D][nextion_upload:242]: Available 2 : 0x00
[16:19:14][D][nextion_upload:242]: Available 3 : 0x00
[16:19:14][D][nextion_upload:242]: Available 4 : 0x00
[16:19:14][D][nextion_upload:242]: Available 5 : 0x00
[16:19:14][D][nextion_upload:242]: Available 6 : 0x00
[16:19:14][D][nextion_upload:242]: Available 7 : 0x00
[16:19:14][D][nextion_upload:242]: Available 8 : 0x00
[16:19:14][D][nextion_upload:242]: Available 9 : 0x55
[16:19:14][D][nextion_upload:242]: Available 10 : 0xBB
[16:19:14][D][nextion_upload:242]: Available 11 : 0x13
[16:19:14][D][nextion_upload:242]: Available 12 : 0x00
[16:19:14][D][nextion_upload:242]: Available 13 : 0x65
[16:19:14][D][nextion_upload:242]: Available 14 : 0x76
[16:19:14][D][nextion_upload:242]: Available 15 : 0x65
[16:19:14][D][nextion_upload:242]: Available 16 : 0x6E
[16:19:14][D][nextion_upload:242]: Available 17 : 0x74
[16:19:14][D][nextion_upload:242]: Available 18 : 0x2C
[16:19:14][D][nextion_upload:242]: Available 19 : 0x73
[16:19:14][D][nextion_upload:242]: Available 20 : 0x74
[16:19:14][D][nextion_upload:242]: Available 21 : 0x61
[16:19:14][D][nextion_upload:242]: Available 22 : 0x72
[16:19:14][D][nextion_upload:242]: Available 23 : 0x74
[16:19:14][D][nextion_upload:242]: Available 24 : 0x75
[16:19:14][D][nextion_upload:242]: Available 25 : 0x70
[16:19:14][D][nextion_upload:242]: Available 26 : 0x2C
[16:19:14][D][nextion_upload:242]: Available 27 : 0x33
[16:19:14][D][nextion_upload:242]: Available 28 : 0x32
[16:19:14][D][nextion_upload:242]: Available 29 : 0x2C
[16:19:14][D][nextion_upload:242]: Available 30 : 0x65
[16:19:14][D][nextion_upload:242]: Available 31 : 0x75
[16:19:14][D][nextion_upload:242]: Available 32 : 0xDE
[16:19:14][D][nextion_upload:242]: Available 33 : 0x74
[16:19:14][D][nextion_upload:242]: Available 34 : 0x74
[16:19:14][D][nextion_upload:242]: Available 35 : 0x74
[16:19:14][D][nextion_upload:242]: Available 36 : 0x74
[16:19:14][D][nextion_upload:242]: Available 37 : 0x74
[16:19:14][D][nextion_upload:242]: Available 38 : 0x74
[16:19:14][D][nextion_upload:242]: Available 39 : 0x74
[16:19:14][D][nextion_upload:242]: Available 40 : 0x74
[16:19:14][D][nextion_upload:242]: Available 41 : 0x74
[16:19:14][D][nextion_upload:242]: Available 42 : 0x74
[16:19:15][D][nextion_upload:248]: preparation for tft update failed 0 ""
[16:19:15][D][nextion_upload:324]: Restarting Nextion
[16:19:16][D][nextion_upload:327]: Restarting esphome

And here the configuration

YAML:
substitutions:
  # Name the device and it's entities
  node_name: nspanel-werkstatt
  device_name: Werkstatt NSPanel

external_components:
  - source: github://pr#2956
    components: [nextion]
    refresh: 1h

esphome:
  name: $node_name
  comment: $device_name

esp32:
  board: esp32dev
  
# Wifi settings. Add these to your secrets.yaml. fast_connect must be true for a hidden ssid.
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

# Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "$node_name"
    password: !secret esp_ap_password
    
captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:
 services:
  # Service to upload a new screen file (TFT)
  - service: upload_tft
    then:
      - lambda: 'id(disp1)->upload_tft();'
ota:

# Enable Web server.
web_server:
  port: 80
# Uart for the Nextion display
uart:
  id: tf_uart
  tx_pin: 16
  rx_pin: 17
  baud_rate: 115200

I have the same issue… did you figure out how to resolve it?

Edit: it is something in the yaml portion of the code by @marcfager as when I uploaded yaml code from another github project (mate) the tft file uploaded without any problems. Once my nspanel was running mate’s yaml and hmi, I easily uploaded @marcfager tft file and right after his yaml code without issues. It may have something to do with the state of “Nextion inited” (see device) but on or off I couldn’t get the tft to upload (maybe it was but it would have taken many hours at that pace and no the file was not on https source)

Hi @aruffell could you share that github project that worked…
I’ve tried editing out most of the ESPHome config basically leaving the UART and Display sections but still get stuck on the Reading from UART timed out at byte 0! also tried with or without the external_components

@grahambrown11 - I spent countless hours and what worked the first time did not work afterwards for unknown reasons. If I recall correctly, since I had tested tasmota, I found a way to use tasmota’s tool to upload the file but it was not straightforward and I really can’t remember all the steps.

All I recall was that it was the console, and I had to send some commands, and the console was finally able to upload the tft I needed to use to move back to ESPHome. I have not worked on it in a few weeks but I believe I should now be able to replace the tft file as needed. I guess something I did put the device in some weird state.

The github for what I was using initially is:

… but I could not update the tft file. I found another that worked:

If I recall correctly, is seemed like something in marcfager’s yaml was causing the tft not to upload (no idea why) as when I used masto’s yaml it worked. MAybe just a coincidence? Sorry I am not of much help, I was really shooting in the dark…

Great thanks for the info, I ended up installing Tasmota and the berry driver, then I was able to update using their TFT file with the command FlashNextion http://nspanel.pky.eu/lui-us-p-release.tft (As I have the US version). I basically followed these instructions.
After that I switched back to the ESPHome firmware and now the upload is working. I guess there might be a Nextion compatibility issue and the Tasmota route fixed that…

1 Like

Yes, that is what I did but I think I also ran a few other commands to switch some option on / off. Anyhow, the gist was the same so glad you fixed it.

Hi, I have exactly the same problem. Glad that you could fix it. I’ll try your advice when I have time. Will inform about the results.

Thanks.

Hi, had the same issue. Changed the baud rate in yaml back to default of 9600 and all good.

Configure UART for communicating with the screen

uart:
  id: tf_uart
  tx_pin: 16
  rx_pin: 17
  baud_rate: 9600
2 Likes
[16:19:14][E][uart:015]: Reading from UART timed out at byte 0!

Seems like serial port communication is timing out, it could be due to network congestion. I used to have this issue and had to move to VLANs on home network and removed all untagged interfaces to minimize broadcast traffic and life has been good since then.

Hello,

I’m getting the following error message on the nspanel:

System Data ERROR!

I have tried to upload several tft files with no success also tried to flesh tasmota.
now the board is flashed with esphome

following the log from esphome:

[15:19:34][W][nextion:318]: Nextion reported invalid instruction!
[15:19:34][E][nextion:262]: Nextion queue is empty!
[15:19:34][D][nextion:557]: system successful start up 0
[15:19:34][C][nextion:123]: Nextion:
[15:19:34][C][nextion:124]: Device Model: NX4832F035_011C
[15:19:34][C][nextion:125]: Firmware Version: 51
[15:19:34][C][nextion:126]: Serial Number: 8F8934015FA7CD79
[15:19:34][C][nextion:127]: Flash Size: 16777216
[15:19:34][C][nextion:128]: Wake On Touch: True

[15:19:35][W][nextion:728]: Received unknown event from nextion: 0xC0
[15:19:35][D][nextion:557]: system successful start up 0
[15:19:37][W][nextion:318]: Nextion reported invalid instruction!
[15:19:37][E][nextion:262]: Nextion queue is empty!
[15:19:37][D][nextion:557]: system successful start up 0
[15:19:39][W][nextion:318]: Nextion reported invalid instruction!
[15:19:39][E][nextion:262]: Nextion queue is empty!
[15:19:39][D][nextion:557]: system successful start up 0
[15:19:39][W][nextion:318]: Nextion reported invalid instruction!
[15:19:39][E][nextion:262]: Nextion queue is empty!
[15:19:39][D][nextion:557]: system successful start up 0
[15:19:47][W][nextion:728]: Received unknown event from nextion: 0x80
[15:19:47][D][nextion:557]: system successful start up 0
[15:19:48][W][nextion:473]: ERROR: Received string return but the queue is empty
[15:19:48][D][nextion:557]: system successful start up 0
[15:19:48][W][nextion:318]: Nextion reported invalid instruction!
[15:19:48][E][nextion:262]: Nextion queue is empty!
[15:19:48][D][nextion:557]: system successful start up 0
[15:19:48][E][nextion:262]: Nextion queue is empty!
[15:19:48][D][nextion:330]: Nextion is setup
[15:19:48][D][number:054]: ‘nspanel-dev Brightness’ - Setting number value
[15:19:48][D][number:113]: New number value: 30.000000
[15:19:48][D][switch:037]: ‘nspanel-dev Nextion inited’: Sending state ON
[15:19:48][D][nextion:557]: system successful start up 0
[15:19:49][W][nextion:728]: Received unknown event from nextion: 0xAB
[15:19:49][D][nextion:557]: system successful start up 0
[15:19:49][W][nextion:318]: Nextion reported invalid instruction!
[15:19:49][D][nextion:557]: system successful start up 0
[15:19:49][E][nextion:527]: ERROR: Received numeric return but next in queue “set_component_text” is not a valid sensor type 0
[15:19:50][E][nextion:527]: ERROR: Received numeric return but next in queue “set_component_text” is not a valid sensor type 0
[15:19:51][E][nextion:527]: ERROR: Received numeric return but next in queue “set_component_text” is not a valid sensor type 0
[15:19:52][W][nextion:728]: Received unknown event from nextion: 0xF8
[15:19:52][D][nextion:557]: system successful start up 0
[15:19:52][E][nextion:527]: ERROR: Received numeric return but next in queue “set_component_text” is not a valid sensor type 0
[15:19:53][E][nextion:527]: ERROR: Received numeric return but next in queue “set_component_text” is not a valid sensor type 0
[15:19:53][W][nextion:341]: Nextion reported page ID invalid!
[15:19:54][W][nextion:318]: Nextion reported invalid instruction!
[15:19:54][D][nextion:557]: system successful start up 0

1 Like

Yes, I confirm changing baud rate to 9600 solved the loading issue.
Thank you

1 Like

Have a look here: NSPanel cannot upload TFT file to Nextion display · Issue #3519 · esphome/issues · GitHub

After alot of trail and error i finally managed to get the TFT file wirelessly to the NSPANEL.
The hunch came when i was reading about the logger in the ESPHome docs, the logger is using a UART.

hardware_uart (Optional, string): The Hardware UART to use for logging. Defaults to UART0.

So i figured, what if the UART used by the logger is also used by the Nextion for uploading the TFT.

So i remarked the logger: section

# Logger. Disable the temperature sensor etc. to focus on the HMI development
#logger:
#  baud_rate: 0
  #115200
#  level: DEBUG
#  logs:
#    sensor: WARN
#    resistance: WARN
#    text_sensor: WARN
#    ntc: WARN

And changed the left button from

binary_sensor:
  # Left button below the display
  - platform: gpio
    name: $device_name Left Button
    pin:
      number: 14
      inverted: true
    on_click:
      - switch.toggle: relay_1

to

binary_sensor:
  # Left button below the display
  - platform: gpio
    name: $device_name Left Button
    pin:
      number: 14
      inverted: true
    on_click:
      - lambda: 'id(disp1)->upload_tft();'

And after installing the new esphome config and pressing the left button on the NSPANEL it works!
Afterwards i restored the logger and the left button to its original state and all still works like a charm.

1 Like

Hi, I would like to share my experience about this issue here as well. I think I found one of the potential causes to this behaviour.

I’m reaching the end of my NSPanel project which has been going on for about a year.
I’ve had tft uploading issues randomly during the entire project. In the beginning they were always solvable by uploading a super small tft as some have mentioned and then try again with the tft file which failed.

But, this week the upload issues got unacceptable. I have 8 NSPanels installed in my home and every attempt to upload my new tft file failed. All 8 screens showing Data check failed after uploading and then data error after rebooting. The old fix with uploading a small file and try again didn’t work either.

I’m pretty confident though that I found the cause today. I read a post in the Nextion forum where someone complained about that there’s no error correction builtin the display when uploading tft files which means if some of the data is not received correctly there will be a data error when when upload finishes.

I also found this on the Nextion FAQ:
The Data Error message signifies the uploaded *.tft file can not be used
– it can be a result of line noise and *.tft did not arrive in tact, or
– it can also be a result of your device requiring to use a newer Nextion Editor.

LINE NOISE, was the problem for me. My tft file is just above 7mb and it takes about 15 minutes to be uploaded. I do not have a nice signal environment at home. Lot of wifi stuff, lot of electricity cables, raspberry pies in front of the router and so on. I’m not an expert but i figured this could actually be the problem. So i turned every wifi device and server off and pulled some electricity cables.

Started trying to upload tft files to the displays again, I got successfull on 8 of 8 panels. No data error.

So, check your signal environment, especially if the tft files are getting big.

See you!

3 Likes

Hi,

i just received that nspanel and got same problems with the UART:

[18:14:02][C][logger:294]: Logger:
[18:14:02][C][logger:295]: Level: DEBUG
[18:14:02][C][logger:296]: Log Baud Rate: 0
[18:14:02][C][logger:297]: Hardware UART: UART0
[18:14:02][C][uart.arduino_esp32:108]: UART Bus 1:
[18:14:02][C][uart.arduino_esp32:109]: TX Pin: GPIO16
[18:14:02][C][uart.arduino_esp32:110]: RX Pin: GPIO17
[18:14:02][C][uart.arduino_esp32:112]: RX Buffer Size: 256
[18:14:02][C][uart.arduino_esp32:114]: Baud Rate: 115200 baud
[18:14:02][C][uart.arduino_esp32:115]: Data Bits: 8
[18:14:02][C][uart.arduino_esp32:116]: Parity: NONE
[18:14:02][C][uart.arduino_esp32:117]: Stop bits: 1
[18:14:02][C][ledc.output:160]: LEDC Output:
[18:14:02][C][ledc.output:161]: Pin GPIO21
[18:14:02][C][ledc.output:162]: LEDC Channel: 0
[18:14:02][C][ledc.output:163]: PWM Frequency: 1000.0 Hz
[18:14:02][C][ledc.output:164]: Bit depth: 16
[18:14:02][C][template.binary_sensor:018]: Template Binary Sensor ‘nspanelwz Nextion display’
[18:14:02][C][template.binary_sensor:018]: Device Class: ‘connectivity’
[18:14:02][C][uptime.sensor:031]: Uptime Sensor ‘nspanelwz uptime’
[18:14:02][C][uptime.sensor:031]: Device Class: ‘duration’
[18:14:02][C][uptime.sensor:031]: State Class: ‘total_increasing’
[18:14:02][C][uptime.sensor:031]: Unit of Measurement: ‘s’
[18:14:02][C][uptime.sensor:031]: Accuracy Decimals: 0
[18:14:02][C][uptime.sensor:031]: Icon: ‘mdi:timer-outline’
[18:14:02][C][template.sensor:023]: Template Sensor ‘nspanelwz Display Target Temperature’
[18:14:02][C][template.sensor:023]: State Class: ‘’
[18:14:02][C][template.sensor:023]: Unit of Measurement: ‘’
[18:14:02][C][template.sensor:023]: Accuracy Decimals: 1
[18:14:02][C][template.sensor:024]: Update Interval: 10.0s
[18:14:02][E][uart:015]: Reading from UART timed out at byte 0!
[18:14:02][W][nextion:072]: Nextion is not connected!




[18:16:37][E][uart:015]: Reading from UART timed out at byte 0!
[18:16:37][W][nextion:072]: Nextion is not connected!
[18:16:38][E][uart:015]: Reading from UART timed out at byte 0!
[18:16:38][W][nextion:072]: Nextion is not connected!
[18:16:39][E][uart:015]: Reading from UART timed out at byte 0!
[18:16:39][W][nextion:072]: Nextion is not connected!
[18:16:39][E][uart:015]: Reading from UART timed out at byte 0!
[18:16:39][W][nextion:072]: Nextion is not connected!
[18:16:40][E][uart:015]: Reading from UART timed out at byte 0!
[18:16:40][W][nextion:072]: Nextion is not connected!
[18:16:40][E][uart:015]: Reading from UART timed out at byte 0!
[18:16:40][W][nextion:072]: Nextion is not connected!
[18:16:41][E][uart:015]: Reading from UART timed out at byte 0!

Im stuck at update tft button, after pressing i get this error msgs.
Any ideas?

1 Like

same here… is there already a solution? It seems the only Solutions which realy works is to flash the Nextion display via nextion softwere?

Hi
With Tasmota, there is no issue and it is very easy to OTA from Tasmota to esphome and from esphome to Tasmota
Phil

my solution is
[Error: Model does not match-Nextion Display bricked-Solution · Issue #166 · Blackymas/NSPanel_HA_Blueprint · GitHub]
after installing the blank tft via nextion editor, everything works fine.
THX everybody who works on this Project.
Im sending a Donation via Paypal

1 Like

Thanks mate! The tip on signal noice solved my issue also. I literally put my NS-panel on top of a wi-fi antenna and then it worked to update wireless with no issues on three of three devices. I know it is a hassle but still easier then to have it plugged in via USB-emulator.

2 Likes

Where did you change this?
When i add it to the yaml file for the NSpanel it says the Baud_rate command is not found.