Esp32 not working after router change

Tags: #<Tag:0x00007fc3f51c0fc8>

Guy’s forgive me if this is a stupid question but it’s been a long while since I created my system and I’ve long forgotten he little I knew.

I have a couple of esp32 boards that are no longer working in esphome since an enforced router change. I don’t think these had a static ip assigned so that maybe the problem but is it fixable without re-flashing the boards from scratch?
The error says unable to contact host.

Had a similar issue with another platform that would have been a pain to re-program from scratch.

Easiest way is to whip out your phone, enable tethering and set the SSID and Passphrase to the old one.
They should connect right up. Now, connect your laptop to the same hotspot and connect to the ESP.
Depending on the circumstances, auto-discovery might not work, but you should be able to scan (or just guess) the right IP.

If the SSID is the same as your current router, disable it for the time of the change.

1 Like

Thanks fedot. What would I then need to do to port the esp32’s to the new router?

I think what he’s saying here is the hotspot tethering on your phone allows your devices to become available again in HA. You could then update the wifi credentials in your ESPHome code and push that down to each of your devices effectively moving them to the new router network. Another option from the phone tethering in case you don’t have it is to setup a guest network on your router with the same name as the old network (both methods of course assume you can’t just make the new routers network name and password the same as the old one).

Home assistant will try to connect to IP that was assigned to esp in the old router. You should use static ip for these devices. DHCP can change the IP and then you have more or less the same situation.

As others mentioned, use same ssid and password in the new router and esp will connect. Remove esp from the homeassistant integrations and add back when rediscovered.

Reflashing won’t help. Only way without touching home assistant core files is to assing same ip to esp in router to what it was in the old router.

Thanks for your help :+1:

Thanks for your help, much appreciated.

I’m not sure what steps to take after creating a temporary ssid & connecting, how do I reconfigure to the new ssid & password?

When the devices are recognized in ESPHome again it’s a matter of updating the WiFi credentials in the code and pushing down to the devices again. Now interestingly after my reply above I needed to do this myself with a couple devices since I’m doing a planned router migration and eliminating a cascaded backhaul router with a different set of WiFi credentials. When I just updated the ssid & password in the code and do an OTA flash none of them ever reconnected and required me to use the fallback AP. To fix this after a trip to the ESPHome documentation I changed the structure of my WiFi code a bit and added the use_address: as well. After doing this it worked perfect on all my devices the first time. Here’s an example from one of my devices.

  name: espcam
  platform: ESP32
  board: esp32dev

  - ssid: NewWiFiSSID
    password: Supersecretpassword
  #- ssid: OldWiFiSSID
  #  password: oldpassword

  # This is the name of your device with dot local appended to it
  use_address: espcam.local

    static_ip: 10.0.0.XXX

  # Enable fallback hotspot (captive portal) in case WiFi connection fails
    ssid: "FallbackWiFi"
    password: "Fallbackpassword"

Hope this helps someone

1 Like

Thanks again.

I resolved it by updating Wi-fi settings in secrets file and using esp flasher to overwrite previous flash.
Then just recompiled binaries & loaded via serial port. After a restart all worked fine.

Hope it helps someone else.