All ESPHome devices show as offline - yet they are online

Every so often I will go into the main ESPHome interface (the bit where each ESPHome device is listed) and all devices (or almost all) show as offline. They are quite plainly actually online or all hell would have broken out in the house - heating failed, control of solar system failed. Timers, plugs, goodness knows what woud all be not working - but they are.

I can’t show the logs and I can’t update the software but yet, they attach quite happily to my HA system and work.

Here’s a thing: a few of my devices have fixed IP addresses (the manual_ip: statement) and they are affected in exactly the same way.

I have tried:

  1. Rebooting HA
  2. Rebooting my router.
  3. Changing the way ESPHome tests them for presence to “ping” (didnt work so reverted to normal

In a few days I have no doubt it will revert to working again like it has in previous episodes. In the meantime I am baffled. Does anyone have any suggestions for further troubleshooting? Has anyone ever had the same issue?

Tell us what is weird about the local network you have set up.

Thanks for moving it to the correct category.

To answer your question: nothing weird at all.

I have a simple home router with WiFi built in. It is connected to a switch with the HA Green box plugged in and my PC and a couple of IP connected printers - oh and a smart TV. I have nothing unusual on the WiFi that I can think of - a number of phones, tablets etc and the solar inverter - and all the ESPHome devices.

OK that is strange. Is the ESPHome add-on up to date?

Yes. 2023.12.9

I just fired up Wireshark. I can see mDNS queries coming from other devices on my network but not a single one from the HA box. How odd.

So, there you go. All of a sudden I notice in Wireshark that HA box is issuing mDNS queries. I go into the ESPHome web ui and all devices are showing as Online.

Very, very odd. It appears that occasionally ESPHome or HA - whichever one issues mDNS queries - just stops. This seems to survive a reboot. After a while it just starts again.

This doesn’t explain why the API is still connected unless the ESPHome device has remembered the IP of the HA server and instigated the connection. I couldn’t see evidence of the ESP devices doing their own mDNS queries but maybe when I was capturing packets all the ESP devices were connected already and didn’t need to issue mDNS queries.

Did you try refreshing the web page and clearing the cache?

That should force an update.

Also why is it using mdns if you have the ping option enabled?

No, I said above I tried ping but it didn’t work so I reverted to normal.

Regarding browser caches etc, No, I didnt refresh cache but I did have the same problems when using the UI on my phone and the PC - so 2 different browsers.

Also see my edit on “(not) resolution” above.

The add-on and HA API are independent, and the ESP device is the API server, not home assistant. So as long as they know where HA is it’s all good.

Your HA server has a static IP right?

It certainly does.

Thanks for the info re the addon vs HA. So, it looks like the addon goes wobbly occasionally. I would have thought a restart of the addon or HA should fix it then but it doesn’t.

Next time it happens I will just leave everything alone and double check it resolves itself. I will monitor network for unusual traffic at the same time.

Do you use the MAC address to build the hostname, for example adding MAC addr as suffix? I have an ESP device where I did this and it caused ESPhome to be unable to find it via mDNS, hence showing it as offline. ESPhome would search for “device.local” but my ESP device would advertise itself as device-MAC.local".

Also don’t use underscores in the name (dashes are ok). Not valid for mDNS even though some routers do allow it.