Blackymas / NSPanel_HA_Blueprint

This allows you to configure your complete NSPanel via Blueprint with UI and without changing anything in the code
1.36k stars 253 forks source link

Can't upload tft file - Reading from UART timed out #619

Closed gintonic26 closed 1 year ago

gintonic26 commented 1 year ago

Hello, not my first time using esp32, but this time I have no more ideas.

I installed this blueprint and generated my esp32 file. Hooked up my FTDI Adapter to the NSPanel and flashed the file. So far, so good. Stupid as I am, there was a mistake in my Wi-Fi credentials, I changed them and generated a new file. NOW my problem: I can't establish a connection to the esp anymore, tried everything. I hope I did not destroy anything. esptool says: `Found 1 serial ports Serial port COM3 Connecting...................................... COM3 failed to connect: Failed to connect to Espressif device: No serial data received. For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html

A fatal error occurred: Could not connect to an Espressif device on any of the 1 available serial ports.`

My hope: After a few minutes there is a Wi-Fi access point with the name of my panel, but it is secured, are there backup credentials? Or are there any ideas?

gintonic26 commented 1 year ago

Okay, i was able to connect with WiFi password: "YOUR WIFI PASSWORD" Now I can ping the device with IP 192.168.4.1 but it is asking for username/password? Any ideas?

MaroslavG commented 1 year ago

After a few minutes there is a Wi-Fi access point with the name of my panel,

It seems that the device is unable to connect to the network. Have you tried entering the address manually?

Example:

wifi:
  ssid: your_ssid
  password: your_pass
    manual_ip:
    static_ip: 192.168.0.152
    gateway: 192.168.0.1
    subnet: 255.255.255.0
gintonic26 commented 1 year ago

Okay, after some trial and error i was able to login to the ESP with username: admin passwort: the WiFi password that was used. I was able to get it to the right WiFi, Home Assistant could be linked. but the Home Assistant IP was deleted from the ESPhome yaml, and so I can't update the TFT.

Edit1: I thought the might be an easy fix just by updating the ESP via ESPhome wireless but I get the message: "ERROR Error auth result: Error: Authentication invalid. Is the password correct?"

Edit2: I can interact with the NSPanel via direct IP Address, but when trying to update OTA with the generated bin file it tells me: "Update Failed: Wrong Magic Byte"

Edit3: When generating you have to use the lagacy format which gives a file WITHOUT "factory" in name. This file can be used for OTA.

gintonic26 commented 1 year ago

Okay I might have destroyed something.

Good new: the system is now able to get the file from HA but it can't be updated.

20:12:28 | [W] | [nextion:072] | Nextion is not connected! -- | -- | -- | -- 20:12:28 | [D] | [nextion_upload:169] | Connected 20:12:28 | [D] | [nextion_upload:175] | Requesting URL: http://192.168.0.225:8123/local/nspanel_eu.tft 20:12:28 | [D] | [nextion_upload:209] | Updating Nextion ... 20:12:28 | [D] | [nextion_upload:235] | Waiting for upgrade response 20:12:28 | [E] | [uart:015] | Reading from UART timed out at byte 0! 20:12:28 | [E] | [uart:015] | Reading from UART timed out at byte 0! 20:12:29 | [E] | [uart:015] | Reading from UART timed out at byte 0! 20:12:29 | [E] | [uart:015] | Reading from UART timed out at byte 0! 20:12:29 | [E] | [uart:015] | Reading from UART timed out at byte 0! 20:12:29 | [E] | [uart:015] | Reading from UART timed out at byte 0! 20:12:29 | [E] | [uart:015] | Reading from UART timed out at byte 0! 20:12:29 | [E] | [uart:015] | Reading from UART timed out at byte 0! 20:12:29 | [E] | [uart:015] | Reading from UART timed out at byte 0! 20:12:29 | [E] | [uart:015] | Reading from UART timed out at byte 0! 20:12:29 | [E] | [uart:015] | Reading from UART timed out at byte 0! 20:12:29 | [E] | [uart:015] | Reading from UART timed out at byte 0! 20:12:30 | [E] | [uart:015] | Reading from UART timed out at byte 0! 20:12:30 | [E] | [uart:015] | Reading from UART timed out at byte 0! 20:12:30 | [E] | [uart:015] | Reading from UART timed out at byte 0! 20:12:30 | [E] | [uart:015] | Reading from UART timed out at byte 0! 20:12:30 | [E] | [uart:015] | Reading from UART timed out at byte 0! 20:12:30 | [E] | [uart:015] | Reading from UART timed out at byte 0! 20:12:30 | [E] | [uart:015] | Reading from UART timed out at byte 0! 20:12:30 | [E] | [uart:015] | Reading from UART timed out at byte 0! 20:12:30 | [E] | [uart:015] | Reading from UART timed out at byte 0! 20:12:30 | [E] | [uart:015] | Reading from UART timed out at byte 0! 20:12:30 | [D] | [nextion_upload:239] | Upgrade response is 20 20:12:30 | [D] | [nextion_upload:242] | Available 0 : 0x00 20:12:30 | [D] | [nextion_upload:242] | Available 1 : 0x00 20:12:30 | [D] | [nextion_upload:242] | Available 2 : 0x00 20:12:30 | [D] | [nextion_upload:242] | Available 3 : 0x00 20:12:30 | [D] | [nextion_upload:242] | Available 4 : 0x00 20:12:30 | [D] | [nextion_upload:242] | Available 5 : 0x00 20:12:30 | [D] | [nextion_upload:242] | Available 6 : 0x00 20:12:30 | [D] | [nextion_upload:242] | Available 7 : 0x00 20:12:30 | [D] | [nextion_upload:242] | Available 8 : 0x00 20:12:30 | [D] | [nextion_upload:242] | Available 9 : 0x00 20:12:30 | [D] | [nextion_upload:242] | Available 10 : 0x00 20:12:30 | [D] | [nextion_upload:242] | Available 11 : 0x00 20:12:30 | [D] | [nextion_upload:242] | Available 12 : 0x00 20:12:30 | [D] | [nextion_upload:242] | Available 13 : 0x00 20:12:30 | [D] | [nextion_upload:242] | Available 14 : 0x00 20:12:30 | [D] | [nextion_upload:242] | Available 15 : 0x00 20:12:31 | [D] | [nextion_upload:242] | Available 16 : 0x00 20:12:31 | [D] | [nextion_upload:242] | Available 17 : 0x00 20:12:31 | [D] | [nextion_upload:242] | Available 18 : 0x00 20:12:31 | [D] | [nextion_upload:242] | Available 19 : 0x00 20:12:31 | [D] | [nextion_upload:248] | preparation for tft update failed 0 "" 20:12:31 | [D] | [nextion_upload:310] | Restarting Nextion
gintonic26 commented 1 year ago

Okay we are are proceeding. I downloaded the Nextion Editor and soldered cables to the TF_TX and TF_RX and i even get connection. But i guess i am stupid or something was destroyed.

I tried the blank and the EU file, as it is a EU device. But it tries to upload for ages, which can't be right. It does not matter which baudrate I use.

It looks like this every time, for over an hour. Connected! Com:COM3,baudrate:115200,Model:NX4832F035_011C(CTP),firmware Ver:S51,Device serial number:C18C340174F1603E,CPUID:61744,Flash Size:16777216(16MB)address:0 Forced upload baudrate:9600 Start uploading

Blackymas commented 1 year ago

not sure what you are doing :)

I think the best thing is to start from the beginning. In the wiki you will find a detailed guide and tutorial videos

gintonic26 commented 1 year ago

I have everything done! Everything works fine, the link between the NSPanel is there, I can do OTA updates, I can see the logs. But as stated in the guide I have to update the TFT-File. And that does not work. Not over air nor via nextion editor.

gintonic26 commented 1 year ago

This is the screenshot: https://ibb.co/Cs03tHF

cjdavo commented 1 year ago

I Have the same issues with two different brand new devices

andytuinman3 commented 1 year ago

I have the same issue. I thought it updated fine but it's stuck on loading screen.

I can go to the web interface and update tft. But get the log like this:

09:41:46    [E] [uart:015]  
Reading from UART timed out at byte 0!
09:41:46    [E] [uart:015]  
Reading from UART timed out at byte 0!
09:41:46    [E] [uart:015]  
Reading from UART timed out at byte 0!
09:41:46    [E] [uart:015]  
Reading from UART timed out at byte 0!
09:41:46    [E] [uart:015]  
Reading from UART timed out at byte 0!
09:41:46    [E] [uart:015]  
Reading from UART timed out at byte 0!
09:41:47    [E] [uart:015]  
Reading from UART timed out at byte 0!
09:41:47    [E] [uart:015]  
Reading from UART timed out at byte 0!
09:41:47    [E] [uart:015]  
Reading from UART timed out at byte 0!
09:41:47    [E] [uart:015]  
Reading from UART timed out at byte 0!
09:41:47    [E] [uart:015]  
Reading from UART timed out at byte 0!
09:41:47    [E] [uart:015]  
Reading from UART timed out at byte 0!
09:41:47    [E] [uart:015]  
Reading from UART timed out at byte 0!
09:41:47    [E] [uart:015]  
Reading from UART timed out at byte 0!
09:41:47    [E] [uart:015]  
Reading from UART timed out at byte 0!
09:41:48    [E] [uart:015]  
Reading from UART timed out at byte 0!
09:41:48    [E] [uart:015]  
Reading from UART timed out at byte 0!
09:41:48    [E] [uart:015]  
Reading from UART timed out at byte 0!
09:41:48    [D] [nextion_upload:121]    
Nextion reported new range 5701632
09:41:48    [D] [nextion_upload:302]    
Heap Size 98940, Bytes left 789556
09:41:48    [D] [nextion_upload:048]    
Requesting range: bytes=5701632-5767167
09:41:54    [D] [nextion_upload:302]    
Heap Size 102804, Bytes left 724020
09:41:54    [D] [nextion_upload:048]    
Requesting range: bytes=5767168-5832703
09:42:00    [D] [nextion_upload:302]    
Heap Size 102804, Bytes left 658484
09:42:00    [D] [nextion_upload:048]    
Requesting range: bytes=5832704-5898239
09:42:06    [D] [nextion_upload:302]    
Heap Size 102804, Bytes left 592948
09:42:06    [D] [nextion_upload:048]    
Requesting range: bytes=5898240-5963775
09:42:12    [D] [nextion_upload:302]    
Heap Size 102804, Bytes left 527412
09:42:12    [D] [nextion_upload:048]    
Requesting range: bytes=5963776-6029311
09:42:19    [D] [nextion_upload:302]    
Heap Size 102804, Bytes left 461876
09:42:19    [D] [nextion_upload:048]    
Requesting range: bytes=6029312-6094847
09:42:25    [D] [nextion_upload:302]    
Heap Size 102804, Bytes left 396340
09:42:25    [D] [nextion_upload:048]    
Requesting range: bytes=6094848-6160383
09:42:31    [D] [nextion_upload:302]    
Heap Size 102804, Bytes left 330804
09:42:31    [D] [nextion_upload:048]    
Requesting range: bytes=6160384-6225919
09:42:37    [D] [nextion_upload:302]    
Heap Size 102804, Bytes left 265268
09:42:37    [D] [nextion_upload:048]    
Requesting range: bytes=6225920-6291455
09:42:43    [D] [nextion_upload:302]    
Heap Size 102804, Bytes left 199732
09:42:43    [D] [nextion_upload:048]    
Requesting range: bytes=6291456-6356991
09:42:49    [D] [nextion_upload:302]    
Heap Size 102804, Bytes left 134196
09:42:49    [D] [nextion_upload:048]    
Requesting range: bytes=6356992-6422527
09:42:55    [D] [nextion_upload:302]    
Heap Size 102804, Bytes left 68660
09:42:55    [D] [nextion_upload:048]    
Requesting range: bytes=6422528-6488063
09:43:01    [D] [nextion_upload:302]    
Heap Size 102804, Bytes left 3124
09:43:01    [D] [nextion_upload:048]    
Requesting range: bytes=6488064-6491188
09:43:02    [D] [nextion_upload:302]    
Heap Size 102804, Bytes left -972
09:43:02    [D] [nextion_upload:304]    
Successfully updated Nextion!
09:43:02    [D] [nextion_upload:304]    
Successfully updated Nextion!
09:43:02    [D] [nextion_upload:310]    
Restarting Nextion
09:43:03    [D] [nextion_upload:313]    
Restarting esphome

I don't know how to fix this. I can get to the webinterface but the entity in HA is broken.

ESPHome sees the device just fine.

gintonic26 commented 1 year ago

Did you try an reflash the esp over web interface? I did it with the file generated for legacy mode an it made the NSPanel available for me. Only problem is the UART timed out.

In the release notes it is stated that you should update the TFT-file first before updating the ESP. But how schould you do it if you never hat this blueprint installed first.

andytuinman3 commented 1 year ago

Reflashed the esp via web a lot of times. Didn't work. Also revert back to a previous esp/TFT/blueprint didn't work. I'm pretty much stuck now.

What is the best course of action to start completely fresh?

sdoualle commented 1 year ago

hi the only solution I found is to send the TFT via another web server. It works 100%.

You can try to download nginx on your computer (linux or windows). No need to install anything. Just unzip the file and launch nginx.exe. copy the tft file in the html folder.

once done, change your yaml file as below: nextion_update_url: "http://IP_OF_YOUR_PC/nspanel_eu.tft" # URL to local tft File Send the update to the esp.

Once the update installed, click on the button in order to update the TFT and the nextion will update. If it doesn't' work you can try to firstly send the blank tft and send the nspanel tft after. SD

gintonic26 commented 1 year ago

Will get two units this afternoon and will test.

Okay, I even tried to flash via the TX/RX pins for the nextion on the board directly which did not work.

andytuinman3 commented 1 year ago

For me it's fixed. HA 2023.4 kills esphome. Doesn't work with 2023.4 yet. Reverted to 2023.3 and all works again

Cosemuckel commented 1 year ago

Can you confirm you are talking about 2022.3 ? So an year-old version?

And after install, you reverted back to 2023.x?

andytuinman3 commented 1 year ago

Can you confirm you are talking about 2022.3 ? So an year-old version?

And after install, you reverted back to 2023.x?

My apologies. I mean 2023. It takes me about 6 months to get used to the new year :)

deejaybeam commented 1 year ago

just some feedback/clarification from my side:

In the esphome there are TWO microcontollers:

This, in (other words) means:

Again in other words:

if you have a lot of "error" messages, while looking at esphome-live-log at the begining - ignore it! Important is, that you see a progess, and (hopefully) a success-message

if you don´t see the information-messages about the nextion-display itself in esphome-logs than esphome is not able to talk with nextion, and you can try to change the baud-rate in esphom-config (full-version) to 9600 baud, flash esphome again and try again

if the upload of the tft itself fails:

if your display stuck on "loading..."

if you have problems with uploading TFT:

And last but not least:

Der-Sven commented 1 year ago

Cheers all,

here's how I got it to work after trying everything else I found on the web. Not 100% sure what the reason for initial failure is, though.

Works :-)

Edit: added info on used local webserver.

kerozen54 commented 1 year ago

Hi all. same problem here. first time install on a new fresh nspanel EU. HA 2023.4.1 (tried with 2023.4.0 too) esphome installed but impossible to upload the tft. ESPHome module is 2023.3.2 tried with another web server (nginx) because my HA is using https.

00:47:21 [E] [uart:015]
Reading from UART timed out at byte 0! 00:47:21 [W] [nextion:072]
Nextion is not connected!

tried to change the baud rate to upload the blank tft but same result. the nspanel is on the wifi box, rssi of -13 dBm

cjdavo commented 1 year ago

Hi,

Not sure if I missed something in the instructions or not, but this is what fixed it for me.

Un-comment out the following section from the nspanel_esphome.yaml file.

**##### Functionality for the Nextion display #####

external_components:

- source: github://pr#2956

components: [nextion]

refresh: 1h**

Also created a local web server to pull the nspanel_us.tft file from but not sure if this contributed to the solution.

Cheers Chris

kerozen54 commented 1 year ago

Hi,

Not sure if I missed something in the instructions or not, but this is what fixed it for me.

Un-comment out the following section from the nspanel_esphome.yaml file.

**##### Functionality for the Nextion display #####

external_components:

- source: github://pr#2956

components: [nextion]

refresh: 1h**

Also created a local web server to pull the nspanel_us.tft file from but not sure if this contributed to the solution.

Cheers Chris

Hi, From what you wrote, i understand you created the esphome device with all the code from the nspanel_esphome.yaml, and not only the small part where we just have to change the device name, wifi and url for the tft update. Am i right ? edit: So i tried to update the nspanel with the full nspanel_esphome.yaml. it seems a bit better as i do not have anymore nextion error messages like this: 00:47:15 [W] [nextion:072] Nextion is not connected! 00:47:16 [E] [uart:015] Reading from UART timed out at byte 0!

but the tft upload does not work. i press the button to uplad then: [10:52:35][D][button:013]: 'nspanel1 Update TFT display' Pressed.

[10:52:35][D][nextion_upload:175]: Requesting URL: http://192.168.1.26/nspanel_eu.tft WARNING nspanel1.local: Connection error occurred: [Errno 104] Connection reset by peer INFO Processing unexpected disconnect from ESPHome API for nspanel1.local WARNING Disconnected from API WARNING Can't connect to ESPHome API for nspanel1.local: Error connecting to ('192.168.1.142', 6053): [Errno 111] Connect call failed ('192.168.1.142', 6053) INFO Trying to reconnect to nspanel1.local in the background

and nothing happens, just this message appears soon after: 10:55:54 [W] [nextion:728] Received unknown event from nextion: 0x55 10:55:56 [W] [nextion:341] Nextion reported page ID invalid!

Edit: Finally, it is uploading. This stupid windows firewall was enable and as i use nginx on this computer for the url to upload the file...

So, cjdavo, your solution did it. many thanks.

MaroslavG commented 1 year ago

Hi,

Not sure if I missed something in the instructions or not, but this is what fixed it for me.

Un-comment out the following section from the nspanel_esphome.yaml file.

**##### Functionality for the Nextion display #####

external_components:

- source: github://pr#2956

components: [nextion]

refresh: 1h**

Also created a local web server to pull the nspanel_us.tft file from but not sure if this contributed to the solution.

Cheers Chris

I try this, and I have new issue. Now when I press upload tft, NSPanel showing message: Model does not match Device model: NX4832F035 011C

I tried with blank.tft too but with same result.

One small thing, now when panel starts, i see in logs:

[11:40:02][D][switch:056]: 'panelsyp Nextion inited': Sending state ON
[11:40:04][W][nextion:728]: Received unknown event from nextion: 0x55

So Nextion is connected, but there is this error 0x55.

gintonic26 commented 1 year ago

For me the fix with direct upload via TF-RX / TF-TX worked for me, now I have the problem that I can't flash the ESP32 of my other two new units.

deejaybeam commented 1 year ago

@cjdavo Please don´t enable this section:

##### Functionality for the Nextion display #####
# external_components:
#   - source: github://pr#2956
#     components: [nextion]
#     refresh: 1h

This way a very old version of the nextion component for esphome is used!

I´m pretty sure that using another webserver solved your problem - this is mentionded many times!

MaroslavG commented 1 year ago

Still no luck to upload any tft from repository. For now I flashed Tasmota with their lui-release.tft and that working with no issue. So I think wy no try upload nspanel_eu.tft [and otrhers] from Tasmosta console? And when I try FlashNextion http://<my_local_server>/nspaneleu.tft

every time with every file [blank, eu, us... old version too] screen display message: Model does not match Device model: NX4832F035 011C

Piramidowy commented 1 year ago

After fighting for 2 days, uploading tft file via nginx local server fixed this issue for me. Strange is, that using other http server (hfs) was causing tft uplad fail as well. Try to host files via nginx (windows version in my case). I've upladed blank tft first (very small one, found on another repo) and then nspanel_eu.tft. Both 100% successful. When I was using other http server, upload was going fine till 98-99% then slowing down and finally failing.

I've tried all possible esp configs (with uart configs, external nextion components etc.). With nginx it went well with stock config from this repo. No changes were necessary (for convenience I added only config for left button calling upload service).

edwardtfn commented 1 year ago

Thanks for sharing that, @Piramidowy.

edwardtfn commented 1 year ago

@gintonic26, how are you with this? Still having issues with the other units or are all good now? If it's all good, are you OK about closing this thread?

If you still having issues to upload the TFT, please that a look at this: https://github.com/Blackymas/NSPanel_HA_Blueprint/issues/641#issuecomment-1506772698