Open pfichtner opened 2 years ago
No ideas/help for this issue available?
Here some additional information, I added
logger:
level: VERY_VERBOSE
so this is the output during the ota-update:
[D][ota:147]: Starting OTA Update from ::FFFF:192.XXX.XXX.XXX...
[V][ota:178]: OTA features is 0x01
[V][ota:198]: Auth: Nonce is efXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[V][ota:218]: Auth: CNonce is 0011YYYYYYYYYYYYYYYYYYYYYYYYYYYY
[V][ota:225]: Auth: Result is 08150815081508150815081508150815
[V][ota:233]: Auth: Response is 08150815081508150815081508150815
[V][ota:261]: OTA size is 864704 bytes
[VV][scheduler:026]: set_timeout(name='onerror', timeout=5000)
[V][component:200]: Component ota took a long time for an operation (0.06 s).
[V][component:201]: Components should block for at most 20-30ms.
[VV][scheduler:196]: Running timeout 'onerror' with interval=5000 last_execution=376391 (now=381392)
[VV][scheduler:196]: Running interval 'update' with interval=60000 last_execution=337571 (now=397571)
[VV][scheduler:196]: Running interval 'update' with interval=60000 last_execution=339147 (now=399148)
I fear unfortunately little purposeful, exciting it would be, what happens inside ota_backend_esp_idf.cpp
(I guess at least), there are however unfortunately no log calls.
Add https://esphome.io/components/ota.html#on-error to see what the error is.
Added
ota:
on_error:
then:
- logger.log:
format: "OTA update error %d"
args: ["x"]
on_state_change:
then:
- logger.log:
format: "OTA state change %d"
args: ["state"]
result is
[D][ota:147]: Starting OTA Update from ::FFFF:192.xxx.xxx.xxx...
[D][main:183]: OTA state change 1
[V][ota:178]: OTA features is 0x01
[V][ota:198]: Auth: Nonce is a6XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[V][ota:218]: Auth: CNonce is e23aYYYYYYYYYYYYYYYYYYYYYYYYYYYY
[V][ota:225]: Auth: Result is 08150815081508150815081508150815
[V][ota:233]: Auth: Response is 08150815081508150815081508150815
[V][ota:261]: OTA size is 866016 bytes
[VV][scheduler:026]: set_timeout(name='onerror', timeout=5000)
[D][main:183]: OTA state change 3
[D][main:189]: OTA update error 255
[V][component:200]: Component ota took a long time for an operation (0.11 s).
[V][component:201]: Components should block for at most 20-30ms.
[VV][scheduler:196]: Running timeout 'onerror' with interval=5000 last_execution=269076 (now=274076)
[VV][scheduler:196]: Running interval 'update' with interval=60000 last_execution=219889 (now=279889)
Did you find a solution @pfichtner?
No, I didn't. I added the things suggested by @ssieb and added the logs to the issue. The problem still occurs: After flashing ESPHome to the device it's no longer updateable via OTA (which is really bad especially for Shelly-Devices that are usually mounted inside walls)
Same here with a Shelly Plus i4. I flashed it with the basic example configuration and now I get the same error whenever I try to flash it with a new version OTA. I really don't want to dismount the wall switch whenever I would like to update the firmware 😕 .
Edit: This issue was opened for Shelly-Plus-1PM, which I misread; I have a Shelly 1PM (no plus), and so my issue is likely different. Sorry for the noise.
I just ran into the same issue with a new Shelly 1PM. I'm using the esphome/esphome
Docker image.
But it seems that I was able to work around it. I'm not entirely certain of the exact sequence of events that led to it, but considering how recent the comments above are, I want to write a reply before any further investigation in the hope that it may be of some help.
api
and logging
, to use with HomeAssistant. I received the error ERROR Error binary size: Unknown error from ESP
.The tl;dr of this post is: I was able to get a web interface flashed via the CLI, and then used that web interface to upload a full firmware image. See below for the actual error from the OTA from the logs.
Edit: This issue was opened for Shelly-Plus-1PM, which I misread; I have a Shelly 1PM (no plus), and so my issue is likely different. Sorry for the noise.
I decided to try flashing my second Shelly 1PM, using the same process I did before:
esphome/esphome
Docker image.This time, OTA via the CLI seems to be working every time.
Just to remove any doubt in constructing my configuration from my above message, here it is, without secrets:
Why are you using esp01_1m
as the board? That only lets you use 1MB of flash which is going to cause you major OTA flashing problems.
Also, this issue was opened for the Shelly-Plus-1PM which is an ESP32, so the Shelly 1PM is not applicable here.
this issue was opened for the Shelly-Plus-1PM which is an ESP32
Ah shoot, I'm sorry for the noise, and it even says ESP32 in the title. I edited my above posts to note that.
Why are you using esp01_1m as the board? That only lets you use 1MB of flash which is going to cause you major OTA flashing problems.
I was wondering why that board was used, but I only used it because of the example config that I linked; I wanted to have a working flash before I messed with the configuration. The Shelly 1 (non-PM) configuration example on that site also uses esp01_1m
, so I wondered if there might be something specific to the Shellys that caused people to use it; I'm new to Shelly devices. I was going to try changing the board later.
But surely 1M is enough flash for OTA? The nondeterminism with these errors with the same firmware images suggests something else. But I don't want to muddy this issue further since my issue is not relevant. Sorry again for the noise.
Maybe that device does only have 1MB. Remember that to OTA, you have to have enough room for the current running firmware and space to write the new firmware as well. When you compile, there's a summary of flash space used. OTA supports compression now, so that helps some, but you're still really limited with only 1MB.
Hi,
It seems that I have the same issue here with Shelly plus 2PM. Used code from here: https://www.esphome-devices.com/devices/Shelly-Plus-2PM. My version of Shelly is PCB v0.1.9 with ESP32-U4WDH (Single core, 160MHz, 4MB embedded flash) - i.e. needed to add this:
`# For Single Core ESP32 esphome: name: shelly-plus-2pm platformio_options: board_build.f_cpu: 160000000L
esp32: board: esp32doit-devkit-v1 framework: type: esp-idf sdkconfig_options: CONFIG_FREERTOS_UNICORE: y CONFIG_ESP32_DEFAULT_CPU_FREQ_160: y CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ: "160"`
Any advice what I can try to make OTA work? Flashing via serial is possible but painful..
As an update to above:
docker compose run esphome run --device /dev/ttyUSB0 /path_to_node/config.yaml
The difference is that in the beggining I uploaded *.bin from Tasmota web UI. Apparently this method wasn't ok for further OTA updates with esphome via --device IP.
As an update to above: [OTA works when flash initially via serial ttyUSB] The difference is that in the beggining I uploaded *.bin from Tasmota web UI. Apparently this method wasn't ok for further OTA updates with esphome via --device IP.
Thanks for this hint! I also flashed the EspHome-bin via tasmota WebUI Have to check if an initial flash via serial works for me as well.
Maybe one of the maintainers already has an idea what this difference does.
1. Pulled out relay from the wall, flashed with esphome via serial (CH340) using: `docker compose run esphome run --device /dev/ttyUSB0 /path_to_node/config.yaml` 2. OTA works normally now
The difference is that in the beggining I uploaded *.bin from Tasmota web UI. Apparently this method wasn't ok for further OTA updates with esphome via --device IP.
I can confirm that the solution described by @flexmatics works for me as well. If you flash EspHome using serial OTA will work, if you flashed EspHome on an ESP32 where tasmota was flashed via tasmota's OTA it won't. So is this a workaround or is this "works as expected"?
It works a described but after each OTA flash I have to repower the shelly (which is of course problematic for this kind of devices put in walls). I am not sure but I think this worked before I updated to v2022.12.8 (docker version). @flexmatics do you use another version? Can you confirm the problem?
Update: Sometimes it does, sometimes it doesn't in non-deterministic way
I see that the tasmota OTA is updated after this issue cropped up. Any idea if it still means we can't go tasmota -> esphome -> esphome via OTA?
I'm reticent to take my Shelly out of the wall, but kinda want to use it as another BLE tracker.
I can confirm that I have the same issue with my Shelly 1PM Mini.
I followed this manual to get tasmota flashed on to the device: https://github.com/tasmota/mgos32-to-tasmota32
Then I flashed ESPhome which worked without any issue. But now the update seems to be broken
I can confirm that I have the same issue with my Shelly 1PM Mini.
Same here with a Shelly 1Plus mini. Followed the tasmota32 steps and flashed afterwards with a miniman ESPHome config allowing OTA.
Device booted, but whenever I try to send a new firmware, I got the message "Error binary size"
And with the mini series, serial flashing isn't a real option...
Same issue here with a Shelly Plus 1PM. I really wish that I'd found this bug report before going down this rabbit hole. I have a Shelly Plus 1PM connected to the charger for a cordless vacuum. I wanted to run ESPHome on the Shelly so that I could have automations on the device itself but with hindsight, I wish I'd left it as a native Shelly device.
UPDATE: having removed the Shelly from the pattress box (I wish I hadn't used hot glue on the back 🤣) and downloaded the firmware via serial then we are once again 'cooking with gas' and OTA updates are working just fine 😀 One of my friends likes the saying "Every day should be a learning day" - today certainly has been!
I'm basically in the same situation as the others. My problem, however, is that I'm using a Shelly Plug Plus S which doesn't expose a serial interface.
I assume as well that the safeboot partition consumes too much space to allow for ESPHome OTA updates. Currently I'm stuck with this semi-bricked device. Does anyone know if and how I can launch Safeboot there?
Is the only fix for this to pull it and flash via serial?
esp8266:
restore_from_flash: True
board: esp01_1m
restore_from_flash was the issue
So removing restore_from_flash
lets an OTA upgrade work after going the Tasmota route @axute ?
I used the OTA file from this link. After that, I set up a minimal ESPHome configuration (only OTA, WiFi, and board). Then, I used gzip to compress it to 355KB and uploaded it via the Tasmota interface. After that, I completed the configuration and added several features, such as timeout scripts for automatic off and a virtual switch for toggle/button mode (alsways ESPHome OTA).
I realized that the states of my virtual switches were not being saved, so I decided to enable "restore_from_flash". After enabling this, I encountered an error. Removing this setting resolved the issue. It might also be related to the .bin file size.
I used this guide. It worked fine, except that I'm now stuck with a esphome that I can't update:
INFO Uploading /config/.esphome/build/bell002/.pioenvs/bell002/firmware.bin (813712 bytes)
ERROR Error binary size: Unknown error from ESP
I notice, that my file size is similar to the one from the original post. @axute how big is your bin when your remove your restore_from_flash
feature?
Is there maybe a way back to tasmota via OTA?
I now reduced my config to the bare minimum, meaning just wifi and ota, no other features. This reduced the file size, but I'm still not able to install:
INFO Uploading /config/.esphome/build/bell002/.pioenvs/bell002/firmware.bin (657232 bytes)
ERROR Error binary size: Unknown error from ESP
The problem
After flashing a Shelly-Plus-1PM via Tasmota OTA (initially installed Tasmota on that device) using a stripped configuration (see "Example YAML snippet") linked there, the ESP boots successfully the built firmware. But when trying to push an newly build firmware using ESPHome's OTA mechanism the log output is:
Even worse: The workaround described in https://github.com/esphome/issues/issues/2514#issuecomment-935920531 does not work because including
web_server
as well ascaptive_portal
result inThis feature is only available with frameworks ['arduino'].
error messages.Which version of ESPHome has the issue?
2022.11.1
What type of installation are you using?
Docker
Which version of Home Assistant has the issue?
no HA and not relevant
What platform are you using?
ESP32-IDF
Board
Shelly-Plus-1PM
Component causing the issue
core
Example YAML snippet
Anything in the logs that might be useful for us?
No response
Additional information
No response