I did not see the last piece of text, so the link was only to the \s warnings.
ESP devices have the flash drive partitioned into sections, like one for runtime data, one for firmware image1, one for firmware image2 and so on.
The ESP device is set to boot up in firmware image1 or image2 and when it is OTA updated, then the image that is not booted up will be overridden and the primary boot image will be switched to that.
OTA updates can be tricky with a large image, because one image will need to be running to handle the OTA update process and changing the partition sizes through OTA might also fail.
Best way is to flash directly through USB or serial connectors, where the ESP device is put into flash mode, since no image needs to be running then, or you can simply make you image smaller, like by removing unneeded or less important things.
The other option using OTA is to flash a minimal image (just what’s needed to make it run with WiFi and OTA) then flash the desired one. I’ve had to do that with some 8266 based smart plugs.
Thank for all the advises.
One thing I‘m wondering about is that the OTA process was successful for more than a year…
So several versions up to 2025.4.0 ??
It is just a matter of time before some bugfix or improvement increase the image size to above the limit for your ESP device.
ESP devices should not be updated unless something needs to be fixed or the update include an improvement that is worth it for the specific setup on that ESP device.
The rule here is truly:
If it ain’t broke, don’t fix it!
Although I really like the ESP8266 and started most of my projects with it, I discovered that it’s relatively limited, especially in terms of memory (only 80 kB total for drivers, programs, and variables).
If memory issues arise, they usually first manifest themselves in problems with flashing and establishing a Wi-Fi connection at me. If there’s not enough memory, the 8266 usually just crashes. As memory becomes increasingly scarce, the frequency of crashes also increases. I’m now considering switching to an ESP32 for one project.
I would first try to save memory. Delete unneeded global variables, delete unneeded lighting effects, delete logs, control fewer LEDs in LED strips, use fewer different components (to save drivers), so don’t connect a Dallas temperature sensor, a BME280, and also a DHT22, shorten text, avoid resource-hungry sensors like the LD2410, and work with strings as little as possible…
(I’ve also heard of various flashing issues when running ESPHome on a computer with insufficient memory, such as a Raspberry Pi with only 1GB of RAM)
Do nothing - it will continue working (or not) as it has been
Flash locally - connected directly you can put in a full size program
Double OTA - create a minimalist program that has only Wi-Fi and OTA. Flash that and then flash the real program you want. Tasmota has been in this state for a decade or so, if you want to OTA, it is a two step process.
I disabled the web server and with that OTA worked:
Linking .pioenvs/wr-lufter-dallas-sensor/firmware.elf
RAM: [==== ] 44.7% (used 36656 bytes from 81920 bytes)
Flash: [====== ] 57.0% (used 583461 bytes from 1023984 bytes)
Building .pioenvs/wr-lufter-dallas-sensor/firmware.bin
/data/cache/platformio/packages/framework-arduinoespressif8266/tools/elf2bin.py:54: SyntaxWarning: invalid escape sequence '\s'
words = re.split('\s+', line)
/data/cache/platformio/packages/framework-arduinoespressif8266/tools/elf2bin.py:73: SyntaxWarning: invalid escape sequence '\s'
words = re.split('\s+', line)
esp8266_copy_factory_bin([".pioenvs/wr-lufter-dallas-sensor/firmware.bin"], [".pioenvs/wr-lufter-dallas-sensor/firmware.elf"])
esp8266_copy_ota_bin([".pioenvs/wr-lufter-dallas-sensor/firmware.bin"], [".pioenvs/wr-lufter-dallas-sensor/firmware.elf"])
========================= [SUCCESS] Took 95.79 seconds =========================
INFO Successfully compiled program.
INFO Connecting to 192.168.178.184 port 8266...
INFO Connected to 192.168.178.184
INFO Uploading /data/build/wr-lufter-dallas-sensor/.pioenvs/wr-lufter-dallas-sensor/firmware.bin (587616 bytes)
INFO Compressed to 403155 bytes
Uploading: [============================================================] 100% Done...
INFO Upload took 4.07 seconds, waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 192.168.178.184 using esphome API
INFO Successfully resolved wr-lufter-dallas-sensor @ 192.168.178.184 in 0.000s
After that I enabled the web server again and tried OTA again.
Obviously web server needs:
RAM: 46%-44.7% = 1.3%
Flash: 60.2% - 57% = 2.8%
Compiling .pioenvs/wr-lufter-dallas-sensor/src/main.cpp.o
Linking .pioenvs/wr-lufter-dallas-sensor/firmware.elf
RAM: [===== ] 46.0% (used 37648 bytes from 81920 bytes)
Flash: [====== ] 60.2% (used 616557 bytes from 1023984 bytes)
Building .pioenvs/wr-lufter-dallas-sensor/firmware.bin
/data/cache/platformio/packages/framework-arduinoespressif8266/tools/elf2bin.py:54: SyntaxWarning: invalid escape sequence '\s'
words = re.split('\s+', line)
/data/cache/platformio/packages/framework-arduinoespressif8266/tools/elf2bin.py:73: SyntaxWarning: invalid escape sequence '\s'
words = re.split('\s+', line)
esp8266_copy_factory_bin([".pioenvs/wr-lufter-dallas-sensor/firmware.bin"], [".pioenvs/wr-lufter-dallas-sensor/firmware.elf"])
esp8266_copy_ota_bin([".pioenvs/wr-lufter-dallas-sensor/firmware.bin"], [".pioenvs/wr-lufter-dallas-sensor/firmware.elf"])
========================= [SUCCESS] Took 12.17 seconds =========================
INFO Successfully compiled program.
INFO Connecting to 192.168.178.184 port 8266...
INFO Connected to 192.168.178.184
INFO Uploading /data/build/wr-lufter-dallas-sensor/.pioenvs/wr-lufter-dallas-sensor/firmware.bin (620704 bytes)
INFO Compressed to 423690 bytes
Uploading: [============================================================] 100% Done...
INFO Upload took 6.06 seconds, waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 192.168.178.184 using esphome API
INFO Successfully resolved wr-lufter-dallas-sensor @ 192.168.178.184 in 0.000s
So the code is now exactly the same like before…
What else beside code size could cause the initial OTA problem ?
Or why did OTA work right now ?
You are on the line between can and can’t. Is this a DIY project? 1Mb of flash is low, like what the ESP8266 contained three or four years ago. If this is a DIY project, change the ESP module (what module are you using) to one with 4Mb of flash.
Well, since you wisely socketed the module, just buy some Wemos D1 Mini modules with 4Mb of flash. They are so cheap I buy them 5 at a time on Ali. Problem solved.