Closed tomatensaus closed 8 months ago
error 131 is 083x and is OTA_RESPONSE_ERROR_WRITING_FLASH
from ota_component.h
I can see that some change has been made to OTA 3 weeks ago at https://github.com/esphome/esphome/pull/6066
Can you try with:
ota:
version: 1
I will try to have a closer look in the next days.
I was not able to reproduce using esphome 'release' (2023-12-9) or 'dev' branch.
I've tested http
on esp32dev
board, with arduino
framework. Can you give me more details about your config ?
Yes you tested with the correct framework, these are the relevant pieces of config (all urls are https)
esp32:
board: esp32dev
external_components:
- source: github://pr#5586
components: [ ota_http ]
ota_http:
safe_mode: fallback
version is not valid for this version of esphome
Failed config
ota: [source <unicode string>:96]
password: !secret ota_password
[version] is an invalid option for [ota]. Please check the indentation.
version: 1
09:08:40 [E] [ota_http:096] Incorrect file size (-1) reported by http server (http status: -7). Aborting
Also getting this error.
[09:52:16][I][ota_http:111]: Progress: 0.1%
[09:52:16][E][ota_http:103]: Error code (131) writing binary data to flash at offset 4000 and size 1493968
[09:52:16][E][ota_http:150]: Abort OTA backend
[09:52:16][E][ota_http:153]: Abort http con
[09:52:16][E][ota_http:155]: previous safe mode didn't succed. ota_http skipped
Tried all three the options below
safe_mode: false
safe_mode: true
safe_mode: fallback
Using ESP32 devkitC that I use for all my testing with 4MB flash
INFO ESPHome 2023.12.9
INFO Reading configuration bootstrap.yaml...
INFO Detected timezone 'Africa/Johannesburg'
INFO Generating C++ source...
INFO Compiling app...
Processing inverterdemo (board: esp32dev; framework: arduino; platform: platformio/espressif32@5.4.0)
------------------------------------------------------------------------------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
- toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
I added more logging. I also cleaned all downloaded source to force a refresh from github. Cleaned all compiled binaries. changed url to example.com
11:34:09 [D] [button:010] 'Firmware Upgrade' Pressed.
11:34:09 [V] [ota_http:048] restored pref ota_http_state: 40
11:34:09 [V] [ota_http:052] setting mode to progress
11:34:09 [D] [esp32.preferences:114] Saving 1 preferences to flash...
11:34:09 [V] [esp32.preferences:126] sync: key: 99380598, len: 261
11:34:09 [V] [esp32.preferences:126] sync: key: 99380598, len: 261
11:34:09 [D] [esp32.preferences:143] Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
11:34:09 [D] [ota_http:054] Trying to connect to https://example.com/firmware.bin
11:34:09 [D] [ota_http:054] Trying to connect to https://example.com/firmware.bin
11:34:09 [V] [ota_http:072] http begin successfull.
11:34:09 [V] [ota_http:080] http headers collected.
11:34:11 [V] [ota_http:086] http GET finished.
11:34:11 [D] [ota_http:101] firmware is 1493968 bytes length.
11:34:11 [V] [ota_http:079] md5sum from received data initialized.
11:34:11 [V] [ota_http:087] OTA backend begin
11:34:11 [I] [ota_http:111] Progress: 0.1%
11:34:11 [E] [ota_http:103] Error code (131) writing binary data to flash at offset 4000 and size 1493968
11:34:12 [E] [ota_http:150] Abort OTA backend
11:34:12 [E] [ota_http:153] Abort http con
11:34:16 [E] [ota_http:155] previous safe mode didn't succed. ota_http skipped
firmware size looks good, but can you double check that it's correctly handled by the http server ?
If you fetch it by wget
and make an hex dump (for ex with ghex
), does it start with byte E9
?
Just downgraded to 10.6 and it failed with the same error.
If you fetch it by
wget
and make an hex dump (for ex withghex
), does it start with byteE9
?
lol.. I don't know if I should laugh or cry... I copied from a shell script and was using firmware-factory.bin which is obviously the wrong file. Should have known when the previous version also gave the same error.
Is there any way you could give an error message that gives you a hint that the file flashed does not have the correct header.
Thank you so much for the help. I am sorry I wasted your time
ah!
I was checking for magic byte 0xE9 in the past, but I've stopped checking it, because the firmware.bin
can ben zipped (so it doesn't starts with 0xE9).
I think that in the future, we will also be able to flash the firmware-factory.bin
file.
Giving a more understandable message would be better, but I think it should be handled from ota
backend, not ota_http
.
I recompiled known working yaml file on the latest esphome (Version: 2023.12.9) I recently upgraded esphome (was on 10.6 before)
Same yaml code that used to work. I tried looking at the branch and do not see many changes.
Relevant log below:
Perhaps changes in OTA backend that are not compatible with ota_http?