-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't update the Nextion / Display Firmware using the 'id(nspanel).upload_tft(url);' service #20
Comments
Hi, thanks for trying out the project! I recently discovered this issue too and I have been trying to figure out what the cause is without success so far!.. I did push an update yesterday which improved it (you can read more about the issue in the commit message), are you using the latest code? |
Hi, |
I tried searching for similar problems and found these issues:
Maybe this helps! |
Hello, I am facing a similar problem, for the me the upload process does not even start.
Reading the links above, I also tried to set the uart baud_rate to 9600, which makes no difference for me. |
It sounds like your issue is different because of the nextion response.. Do you have the original TFT firmware on your panel? Is the panel blank/off when you start the uploading? I will push an update based on a theory I have. Also, the firmware size
It should look something like this:
|
I am quite sure, I bought a used NSPanel to test this, it appeared to be still with the default Sonoff firmware, I just flashed esphome with the basic configuration of this repo. The screen does not change at all. When I power on the device, a sonoff animation plays and then a default screen with time 0:00 and null temperatures etc. is displayed. The display can be toggled via esphome, but during flash it remains exactly like that. |
I have pushed a commit for you to test :) Try deleting the |
I only see url: https://github.com/olicooper/esphome-nspanel-lovelace-native
ref: dev
refresh: 60s <-- I'm not sure the update will change anything given that the screen is already awake though... I wonder if it has some other firmware on it so that update commands are slightly different? I'm not sure what the stock firmware looks like because I immediately deleted it when I got mine! I expected it to look like this: https://www.espthings.io/wp-content/uploads/2021/10/nspanel-1024x825.png?v=1633549657 ... I guess it is pretty similar? Based on the links in the comment above, maybe the quickest solution for now is to temporarily upload Tasmota and use it to upload the TFT like vmarquar did? You can also try switching to the Arduino variant of the firmware if you want to try that but I assume that won't help in this case... esp32:
...
framework:
type: arduino <--
...
url: https://github.com/olicooper/esphome-nspanel-lovelace-native
ref: arduino-panic-fix <-- It seems even esphome has issues with the TFT sometimes. It will need more investigation for sure. |
I tried again with the following config
I tried the update command multiple times, getting the following feedback ( the currently updating part).
I probably missed the initial log. I assume it should not take more than 30 minutes? Should I give it some more time, or try after a reboot? |
You'll have to restart the esp to issue the update command again because the Right now I think your quickest option is to use the NSPanel guide to flash Tasmota using a USB TTL like the CH340 and then flash ESPHome again after updating the TFT. The process is roughly as follows:
Once the custom TFT is uploaded, this issue shouldn't happen again based on what I've read online (although there are still other issues with the upload process I still need to fix). |
Flashing via Tasmota does indeed work without any troubles, looking forward to test your project now! |
This is an attempt at fixing the TFT upload failure when overwriting the stock FW. Added an edge case where the 'baud_rate' can be set to 9600 in the 'uart' section of the esphome config to initiate a legacy protocol upload.
I have added a commit which will hopefully address the issue you had. I haven't tested it though so I'm not sure it will work. Any testers out there that want to try this? For anyone else reading this... If you have the stock TFT firmware installed on your device, please set the Also worth noting, I recently made some updates to the code which addressed memory usage and should also improve the reliability of the upload process too. If you are having issues with the upload failing part way through the upload, try to reduce the amount of cards and entities you have as these use up memory. |
@olicooper Thanks for your effort! I will test the latest changes in the upcoming days and will let you know if it works. Just to make sure I understood you correctly:
My minimal config looks like this:
Referrring to the stock firmware issue: Maybe it would be a good idea to update the Important If you have the stock TFT firmware installed on your device, please set the |
Yes that looks okay to me.. The standard update procedure is mostly the same as it was before, so I would hope that updating the lovelace-ui firmware from an older version works as it did before. My main concern is whether it is possible to replace the stock firmware with the lovelace-ui firmware. I only have one NSPanel which is in active use so it is difficult to test these things sometimes 😄 If you look at the variable Yes, that is a good idea to add a warning to the readme, but to avoid confusion, I think I will hold off adding that until I have got confirmation that the fix works. |
I've just tested the upload_tft() feature but unfortunately it didn't work. As soon as i send the upload_service() the nextion display freezes and isn't usable anymore. I collected following logs:
Reflashing the device with |
I will have to look in to that, I am hoping that a recent update to the TFT communication mechanism hasn't messed this up. Thanks for testing 👍 |
* Account for updating from stock FW by cycling through common baud rates and trying to connect to the device. * Fix HTTP range request issue. * Only reset the TFT instead of restarting the ESP after upload finishes.
I've added another update which fixes some of the issues found during my testing today. It seems to work for my panel even when restarting a failed upload. Originally I was doing all my testing on a random ESP32 test device (which is way easier to test on) but this only simulates the TFT responses which is why I didn't spot the issues you encountered 🤦 It is not required to set 9600 baud now as I loop through some common baud rates to figure it out instead (so no need for the readme update!). I haven't tested the upload from a stock FW to the custom FW to confirm this works though. |
Well I have the same proble. I tried to update the tft without success Here is my Log: here is my log
my config.yaml is :# Advanced configuration example
# This includes some commented out configuration items showing what other functionality is available
# Available icons can be found in 'components\nspanel_lovelace\icons.json'. Icon colors range from 0 to 65535.
# NOTE: This project is in the beta stage so the configuration is subject to change without notice.
# Please check your own configuration againist the latest example when updating.
esphome:
name: nspanel
name_add_mac_suffix: False
comment: "ESPHome Advanced NSPanel Example"
build_path: ./.build/nspanel-advanced
esp32:
board: esp32dev
framework:
type: esp-idf
sdkconfig_options:
## These are required to allow access to the PSRAM
## NOTE: This is temporary and will be removed in a
## future release when the build script is improved
CONFIG_D0WD_PSRAM_CLK_IO: '5'
CONFIG_D0WD_PSRAM_CS_IO: '18'
external_components:
- source:
type: git
url: https://github.com/olicooper/esphome-nspanel-lovelace-native
ref: dev
refresh: 1s
components: [nspanel_lovelace]
nspanel_lovelace:
id: nspanel
sleep_timeout: 10
# locale:
# temperature_unit: celcius
# day_of_week_map:
# sunday: ['Sun', 'Sunday']
# monday: ['Mon', 'Monday']
# tuesday: ['Tue', 'Tuesday']
# wednesday: ['Wed', 'Wednesday']
# thursday: ['Thu', 'Thursday']
# friday: ['Fri', 'Friday']
# saturday: ['Sat', 'Saturday']
screensaver:
time_id: homeassistant_time
## For formatting options see: https://cplusplus.com/reference/ctime/strftime/
# time_format: '%H:%M'
# date_format: '%A, %d. %B %Y'
weather:
#entity_id: weather.spiti
## NOTE: use this version (after following the instructions on the README) with Home Assistant v4.4.0+
entity_id: sensor.weather_forecast_daily
# status_icon_left:
# entity_id: light.front_room_inner
# icon: hiking
# status_icon_right:
# entity_id: light.front_room_outer
# icon:
# value: robot-outline
# color: 200
cards:
- type: cardGrid
id: Front_House
title: Front Room
sleep_timeout: 10
# hidden: true
entities:
- entity_id: light.living_room
name: living_room
- entity_id: light.dining_room
name: Dining Room
- entity_id: light.kitchen_2
name: kitchen
- entity_id: light.sink
name: sink
- type: cardGrid
sleep_timeout: 10
title: Bedroom Lights
entities:
- entity_id: light.souzanna_bedroom
name: souzanna_bedroom
- entity_id: light.chronis_bedroom
name: chronis_bedroom
- entity_id: light.bedroom_light
name: Bedroom
- entity_id: light.bathroom
name: bathroom
- entity_id: light.bathroom_small_right
name: Small bathroom
- type: cardEntities
sleep_timeout: 30
title: House Info
entities:
- entity_id: sensor.boiler_outdoortemp
name: Outside Temp
- entity_id: sensor.temperature
name: Hall Temp
- entity_id: sensor.kitchen_temperature
name: kitchen_temperature
#- type: cardQR
# sleep_timeout: 30
# title: Guest WiFi
# qr_text: !secret qrcard_text
# entities:
# - entity_id: !secret qrcard_ssid_itext
# name: SSID
# icon: wifi
# - entity_id: !secret qrcard_password_itext
# name: Password
# icon: key
- type: cardAlarm
sleep_timeout: 60
title: Home Alarm
alarm_entity_id: alarm_control_panel.alarmo
- type: cardThermo
sleep_timeout: 60
title: Heating
thermo_entity_id: climate.thermostat_hc1
# temperature_unit: celsius
logger:
baud_rate: 115200
level: DEBUG
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
#use_address: 10.100.0.153
api:
services:
## Service to update the TFT firmware using a URL that is accessible to the nspanel
- service: upload_tft
variables:
url: string
then:
- lambda: 'id(nspanel).upload_tft(url);'
## Service to display a notification on the screensaver
- service: notify_on_screensaver
variables:
heading: string
message: string
## Set to 0 (or remove) to keep message until screensaver refreshes
timeout_ms: int
then:
- lambda: 'id(nspanel).notify_on_screensaver(heading, message, timeout_ms);'
- rtttl.play: 'scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b'
## Service to send a command directly to the display (useful for testing)
# - service: send_command
# variables:
# cmd: string
# then:
# - lambda: 'id(nspanel).send_display_command(cmd);'
ota:
platform: esphome
password: !secret ota_password
## UART for the Nextion display
uart:
id: uart_nextion
tx_pin: 16
rx_pin: 17
baud_rate: 115200
time:
- platform: homeassistant
id: homeassistant_time
timezone: Europe/Athens
on_time:
## At midnight
- seconds: 0
minutes: 0
hours: 0
then:
- lambda: 'id(nspanel).set_display_dim(1, 50);'
## At 8:00 PM
- seconds: 0
minutes: 0
hours: 20
then:
- lambda: 'id(nspanel).set_display_dim(20, 80);'
## At 7:00 AM
- seconds: 0
minutes: 0
hours: 7
then:
- lambda: 'id(nspanel).set_display_dim(50, 100);'
switch:
## Physical relay 1
- platform: gpio
name: Relay 1
id: relay_1
pin:
number: 19
restore_mode: ALWAYS_OFF
## Physical relay 2
- platform: gpio
name: Relay 2
id: relay_2
pin:
number: 22
restore_mode: ALWAYS_OFF
## Turn screen power on/off
- platform: gpio
name: Screen Power
id: screen_power
entity_category: config
pin:
number: 4
inverted: true
restore_mode: ALWAYS_ON
sensor:
## WiFi signal strength sensor
- platform: wifi_signal
name: WiFi Signal
update_interval: 300s
## Internal temperature sensor, adc value
- platform: adc
id: ntc_source
pin: 38
update_interval: 60s
attenuation: 12db
## Internal temperature sensor, adc reading converted to resistance (calculation)
- platform: resistance
id: resistance_sensor
sensor: ntc_source
configuration: DOWNSTREAM
resistor: 11.2kOhm
## Internal temperature sensor, resistance to temperature (calculation)
- platform: ntc
id: temperature
sensor: resistance_sensor
calibration:
b_constant: 3950
reference_temperature: 25°C
reference_resistance: 10kOhm
name: Temperature
binary_sensor:
## Left button below the display
- platform: gpio
name: Left Button
pin:
number: GPIO14
inverted: true
id: left_button
internal: true
on_multi_click:
####### Single click - toggle front_room_inner
- timing:
- ON for at most 1s
- OFF for at least 0.4s
then:
- if:
condition:
api.connected:
then:
- if:
condition:
switch.is_off: relay_1
then:
- switch.turn_on: relay_1
else:
- homeassistant.service:
service: light.toggle
data:
entity_id: light.front_room_inner
else:
- switch.toggle: relay_1
####### Triple click - restart the ESP32
- timing:
- ON for at most 1s
- OFF for at most 0.3s
- ON for at most 1s
- OFF for at most 0.3s
- ON for at most 1s
- OFF for at least 0.3s
then:
- button.press: restart_switch
####### Single long click - toggle light relay 1
- timing:
- ON for 1.2s to 4s
- OFF for at least 0.3s
then:
- switch.toggle: relay_1
## Right button below the display
- platform: gpio
name: Right Button
pin:
number: GPIO27
inverted: true
id: right_button
internal: true
on_multi_click:
####### Single click - toggle light front_room_outer
- timing:
- ON for at most 1s
- OFF for at least 0.4s
then:
- if:
condition:
api.connected:
then:
- if:
condition:
switch.is_off: relay_2
then:
- switch.turn_on: relay_2
else:
- homeassistant.service:
service: light.toggle
data:
entity_id: light.front_room_outer
else:
- switch.toggle: relay_2
####### Triple click - restart TFT
- timing:
- ON for at most 1s
- OFF for at most 0.3s
- ON for at most 1s
- OFF for at most 0.3s
- ON for at most 1s
- OFF for at least 0.3s
then:
- switch.turn_off: screen_power
- delay: 0.5s
- switch.turn_on: screen_power
####### Single long click - toggle light relay 2
- timing:
- ON for 1.2s to 4s
- OFF for at least 0.4s
then:
- switch.toggle: relay_2
button:
- platform: restart
id: restart_switch
name: Restart
output:
## Buzzer for playing tones
- platform: ledc
id: buzzer_out
pin: 21
## Rtttl function for buzzer
rtttl:
id: buzzer
output: buzzer_out |
It actually looks like your upload worked fine... RAM usage fine, TFT reports a new range and continues uploading from 85.36%:
Then the upload finishes and the panel reboots:
What problems are you seeing? |
The odd thing that the nextion displays only system data error. In the log
I can see : TFT CMD time out
Στις Σάβ 14 Σεπ 2024, 11:05 ο χρήστης Oli Cooper ***@***.***>
έγραψε:
… It actually looks like your upload worked fine...
RAM usage fine, TFT reports a new range and continues uploading from
85.36%:
[17:24:55][D][nspanel_lovelace_upload:144]: Uploaded 0.05%, remaining
8369472 bytes, free heap: 98896 (DRAM) + 2090519 (PSRAM) bytes, lblk 2064384
[17:24:55][D][nspanel_lovelace_upload:155]: recv_string [08.00.00.6D.00
(5)]
[17:24:55][I][nspanel_lovelace_upload:161]: Nextion reported new range
7143424
[17:24:57][D][nspanel_lovelace_upload:144]: Uploaded 85.36%, remaining
1226048 bytes, free heap: 97012 (DRAM) + 2090519 (PSRAM) bytes, lblk 2064384
Then the upload finishes and the panel reboots:
[17:26:54][D][nspanel_lovelace_upload:144]: Uploaded 100.00%, remaining 0
bytes, free heap: 96484 (DRAM) + 2090519 (PSRAM) bytes, lblk 2064384
[17:26:54][I][nspanel_lovelace_upload:432]: Nextion TFT upload finished
What problems are you seeing?
—
Reply to this email directly, view it on GitHub
<#20 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEDO25CIC4FEZPQVPIVVSKLZWPU4ZAVCNFSM6AAAAABL3C5YZSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJQHEYDGMBXGQ>
.
You are receiving this because you commented.Message ID:
***@***.***
com>
|
I don't think I have seen this before.. if the TFT reports that it has worked then it should be fine. Maybe try these steps?
|
[17:21:04][D][nspanel_lovelace:1290]: TFT CMD OUT: time~17:21
It is on log 3rd and 4th row , also after the upload I can see that. If
you see on the log I have no information about the nextion display such as
firmware serial etc
Στις Σάβ 14 Σεπ 2024, 11:26 ο χρήστης Oli Cooper ***@***.***>
έγραψε:
… I don't think I have seen this before.. if the TFT reports that it has
worked then it should be fine.
Is this the error you are seeing?
https://ewelinkcommunity.net/wp-content/uploads/2023/02/NSPanel_System_Data_ERROR-768x1024.jpg
The UART bus which this library uses to communicate with the TFT doesn't
output any command 'time out' logs from what I recall, where are you seeing
this?
Maybe try these steps?
- Remove the power from the nspanel to fully reboot the whole nspanel
- Upload an older version of the TFT firmware (maybe the file is
corrupt)
- If that doesn't work, use a different server to upload (maybe the
server is causing problems) e.g. http://nspanel.pky.eu/lui-release.tft
—
Reply to this email directly, view it on GitHub
<#20 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEDO25EROW4UDWAVCDKNKQDZWPXKLAVCNFSM6AAAAABL3C5YZSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJQHEYTCNBSGM>
.
You are receiving this because you commented.Message ID:
***@***.***
com>
|
Actually, hold off on that for a moment, I am going to update the code to add a delay before restarting the panel to see if that helps. |
[Remove the power from the nspanel to fully reboot the whole nspanel
Upload an older version of the TFT firmware (maybe the file is corrupt)
If that doesn't work, use a different server to upload (maybe the server is
causing problems) e.g. http://nspanel.pky.eu/lui-release.tft]
I have done these steps , also I tried the blank tft without success
Στις Σάβ 14 Σεπ 2024, 11:29 ο χρήστης Dimosthenis Theocharidis <
***@***.***> έγραψε:
… [17:21:04][D][nspanel_lovelace:1290]: TFT CMD OUT: time~17:21
It is on log 3rd and 4th row , also after the upload I can see that. If
you see on the log I have no information about the nextion display such as
firmware serial etc
Στις Σάβ 14 Σεπ 2024, 11:26 ο χρήστης Oli Cooper ***@***.***>
έγραψε:
> I don't think I have seen this before.. if the TFT reports that it has
> worked then it should be fine.
> Is this the error you are seeing?
> https://ewelinkcommunity.net/wp-content/uploads/2023/02/NSPanel_System_Data_ERROR-768x1024.jpg
> The UART bus which this library uses to communicate with the TFT doesn't
> output any command 'time out' logs from what I recall, where are you seeing
> this?
>
> Maybe try these steps?
>
> - Remove the power from the nspanel to fully reboot the whole nspanel
> - Upload an older version of the TFT firmware (maybe the file is
> corrupt)
> - If that doesn't work, use a different server to upload (maybe the
> server is causing problems) e.g. http://nspanel.pky.eu/lui-release.tft
>
> —
> Reply to this email directly, view it on GitHub
> <#20 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AEDO25EROW4UDWAVCDKNKQDZWPXKLAVCNFSM6AAAAABL3C5YZSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJQHEYTCNBSGM>
> .
> You are receiving this because you commented.Message ID:
> ***@***.***
> com>
>
|
Try uploading my latest changes to your panel and try the TFT upload again after a full reboot? |
These logs are normal, they just tell you that the system has sent a command 'OUT' to the TFT. So in the case of |
sorry , I didn't understand that, when I saw the log. Is it possible to write the commands that can give informations about the nextion display? |
I am not right now on home. I have clean build files and I will try to cut off power to reboot and then try the new code |
Tried again, after a reboot ( I cut the power to nspanel for 2 minutes) and it didn't work . Maybe something is broken from the last nspanel.tft that was used. I tryto upload the panel.tft via direct serial or I try with tasmota and back to esphome |
Just to confirm, can you see these updates in the It is probably better to try Tasmota first as we know this works. I really don't know what is wrong with the TFT, maybe it could be faulty? We will know after uploading with Tasmota I think. |
I tasmotized the device , then I uplaod the tft via tasmotaand then back to your esphome yaml , the device works again. |
Alternative workaround could be using this to get the TFT file uploaded to the device: And then switch to this firmware. |
@marcelveldt Has this method worked for you? The upload process is similar between these libraries so it shouldn't make a difference in theory. Tasmota is able to upgrade from the original NSPanel firmware which is what my recent updates tried to address (these aren't accounted for in the sairon's library) but there is probably something I am still missing to make it work reliably. PR's are welcome if anyone wants to figure it out👍 |
Yes, I just flashed a device that way. Worked perfectly fine. After that switched back to your version. |
Interesting.. do you have any logs? Maybe the code updates made it worse for some use cases? |
I just bought a brand new Sonoff NS Panel and tried to flash the nspanel.tft firmware (version 53) onto it. Unfortunately, I wasn't able to complete the display firmware update. I tried several attemps and all updates freezed at random percentages (6%, 18%, 47%, 2% etc.). I used the firmware v53, downloaded from this url, and hosted it on ha locally in the www-folder.
My workaround was to flash Tasmota onto the esp and using the
FlashNextion http://my-ha-ip:8123/local/nspanel.tft
command to successfully update the display firmware onto it. After that I was able to flash the esphome firmware onto the display as intended.However, these little issues apart - thank you very much for this project! :) It looks really promising to me and I hope to get rid of the AppDaemon solution for my NS Panels.
The text was updated successfully, but these errors were encountered: