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.
215 stars 60 forks source link

Nextion TFT upload fail #20

Closed romainrossi closed 2 years ago

romainrossi commented 2 years ago

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 ?

romainrossi commented 2 years ago

I finally succeeded. The issue is not in the code.

The issue i faced maybe from the state of the "Nextion-inited" switch in the nspanel integration in HomeAssistant. It seems it needs to be "On" so the tft update can be performed.