ESP32 no longer connecting to WiFi after OTA update

I have an ESP32 that been fine.

However, it now no longer re-connects to wifi after using OTA update.

If I upload via USB using ESPHome flasher, suing the same config file, it then reconnects to WiFi and API OK.

If I subsequently do an OTA update, the update completes but then it won’t reconnect to Wifi and I have to update using USB again.

Any idea what’s going on or where to look for the cause?

========================= [SUCCESS] Took 15.49 seconds =========================
INFO Successfully compiled program.
INFO Resolving IP address of stepper-test.local
INFO  -> 10.0.1.101
INFO Uploading /data/stepper-test/.pioenvs/stepper-test/firmware.bin (1057200 bytes)
Uploading: [============================================================] 100% Done...

INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from stepper-test.local using esphome API
WARNING Can't connect to ESPHome API for stepper-test.local: Timeout while connecting to ('10.0.1.101', 6053)
INFO Trying to reconnect to stepper-test.local in the background

How long do you wait?

Indefinitely. It never connects. I last flashed it 11h:30m ago. Still no connection.

It’s a puzzle. I know if I flash it using USB right now, it will then connect straight away.

I should add that it has booted up OK and is preforming as expected - it just has no WiFi connection.

I have an ESP32 which seems to need a power cycle after every update before it comes back online, give that a try. I don’t know why this is happening to mine but the reboot fixes it every time.

Yes, I’ve tried that, and resetting it. Still no WiFi connection.

I’m re-flashing it now and I just know that it’ll be fine until the next OTA update.

Very frustrating.