esphome / esphome/feature-requests
Improve OTA for devices with small flash memory size
- Dominant language
- No language data
- Stars
- 450
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the problem you have/What new integration you would like**
I want to suggest some improvements to the way ESPHome handles OTA Updates, especially for devices with small flash memory sizes like the esp8266. I understand that for OTA to work it is required that there is enough space free for the new firmware, old and new firmware need to fit on the flash memory together.
Currently you don't get any warning if the firmware is too big and would prevent future OTA updates. Also when uploading a new firmware with the Home Assistant Addon and there is not enough space it doesn't tell you this.
My suggestions are:
1. When uploading a firmware through the ESPHome Addon and it fails because there wasn't enough space, the error message should also tell you that
2. Issue a warning and add a prompt before uploading a firmware that would occupy more than 50% of the available flash memory of the target device.
3. To better handle OTA on devices with small memory, the OTA component could have an option to upload an intermediate firmware only with the components required, similar to an OTA safe mode. This way it would free up space to upload the actual firmware afterwards. (This would also increase the above mentioned threshold to more than 50%)
**Please describe your use case for this integration and alternatives you've tried:**
I had the problem, that after updating to a newer ESPHome Version the Firmware for one of my ESP8266-based devices (Sonoff S20) grew to about 536kb, which is more than 50% of the 1MB flash this device has. The next time i tried to upload a new firmware the upload failed and the error message was unclear about what happened. After some tries i downloaded the bin file and uploaded it to the device through the web server component i had on this device. There i finally received a meaningful error message (not enough space).
After i figured out that the firmware was too big for OTA i tried to reduce the size by removing some components (like the web server component) but only managed to reduce it to slightly less than 50% but was still bigger than the space left on the device because of the previous firmware.
To avoid disassembling the device for programming I tried building a very minimalistic firmware and removed almost everything unnecessary except whats needed for the OTA component. This way i managed to upload a new much smaller firmware to the device and then i had enough space for the new firmware.
**Additional context**
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.