How to escape when OTA fails mid upload

Sometimes when uploading through a weak connection (WiFi) it fails mid-way. Then the target is locked in some sort of loop waiting forever. The only solution is to trek out to the remote device, unbolt stuff, hit the reset button (or cycle power).

Is there a better way? Some sort of OTA watchdog?

Using Esphome 2025.12.5

Probably a stupid answer, but - fix the shabby wifi? :blush:

1 Like

Until you find a better way, try safe mode. I add it to all my ESP’s just in case (or should I say: especially when in case :slight_smile: ):

If i read it well then this case will be solved with the latest esphome builder update. The change log stated that there will be an automatic rollback when ota fails and a valid reboot isn’t reached.

Uhm, the issue is when the OTA never finishes due to weak WiFi (yeah, yeah).

The OTA loop needs a timeout and exit if the next packet doesn’t arrive. Right now it is stuck until hard reset.

Api has a timeout, why not ota?

You may find reporting it in GitHub may get the attention of the developers better than here.

This sounds like newer behavior (or something unique in your setup). I know in the past (it’s been a while), I had a couple devices on the edge of WiFi coverage that would usually take a couple of OTA attempts before it could finish the transfer. I definitely never had to manually intervene, I’d just ‘re-compile’ and try again immediately.

2 Likes