Reconnect to ESPHome devices after changing HA Server address

I’ve been rebuilding my home network to use OPNsense firewall, Cisco switch, and using my old router as AP now. In doing so my Home Assistant server has changed IP address, and is also on a different VLAN than my Wifi AP (and by extension, all my esphome devices). None of my esphome devices are now connected to Home Assistant, although I can see they did get IP addresses from DHCP on OPNsense.

I had intended to manage the changeover assuming I might have to reflash OTA to the espHome devices, but looking at the yaml now, I can only see settings for wifi which has not changed.

So my question is, what do esphome devices use to communicate to the server? Hostname? IP address? Which part have I likely broken, and need to look at to fix?

For info, my firewall currently has a temporary rule to allow all communications, so can rule out firewall. I have moderately well learned and can investigate my DNS, NATs, DHCP, etc. I’m just looking for clues where to start, as examining the esphome device’s yaml gives no clues as to how the devices are trying to find the server. I am even able to get onto the web GUI of the Athom smart plugs, which means I’ll be able to OTA reflash those at least, but can’t find any clues there.

If you have SH or CLI access for HA, I would try just pinging the devices first to make sure your networks are routable to each other.

Thanks for the quick response, good suggestion.
Yes I can ping smart plugs from HA CLI.

Ok. What about by the mDNS name? Should be esp_name.local

In HA go to Open your Home Assistant instance and show your devices. and add them as new esp devices.

If they are still in your HA config from earlier, remove them first

In esphome, the esp device is the server for the API. HA is the client. HA has to know about the server.

Thanks for this, you saying .local reminding me I’ve changed domain name.
In the yaml, wifi section, I’ve added:
domain: .mydomain
use_address: 192.168.x.x

I’ve been able to successfully flash OTA, and ESPHome now shows the device as online! One step closer.
The entities however (inputs and outputs for buttons) still show unavailable, I’m investigating that.

Thanks also for this, this was the second step.
Deleted the ESP home device, added new device by known IP address, and voila - it comes back live and happy, and already links to the buttons on my dashboard.
Final thing out of place; I can see this device in Settings->Devices and Services-ESPHome, but do not see it in the ESPHome button from the main page sidebar. As far as I’m aware, that’s the only place I can flash new YAML OTA, so now although my device is working I don’t see any way to edit it’s configuration if I need to. Is there a way to get it back into the ESPhome page on the sidebar, or alternatively is there a way to edit and flash YAML from the Device info page?

Assuming you are running HAOS, put the yaml file that you used to flash it in the first place into /config/esphome. That will get you an entry in the addon (ie when you click the sidebar)

If there is a panel there for the yaml file, but it is saying offline, it may be due to your networking. mDNS does not broadcast over subnet boundaries.

Thanks to FriedCheese and nickrout for speedy help! Summarizing here so I can mark as complete solution.

  1. make sure you specify any custom DNS name by specifying domain: in yaml
  2. Can re-flash to existing device on the network by specifying use_address: in yaml
  3. Backup device yaml before deleting
  4. Remove the ESP home device, and re-add it by known IP address
  5. Add backed up yaml back into /config/esphome
  6. Reflash (if desired) specifying manual_ip: after which you can remove use_address:
1 Like