ESPHome - devices shown as offline

Hi,

I am running an AirGradient connected to latest HA. I ran originally the AirGradient software, but now I managed to flash it with ESPHome from HA.

The problem is that the device is showing “offline” in HA.
My device is in a different network, but I have setup an mDNS forwarder between those two networks and that works just fine.

I puzzled why it doesn’t work for two reasons:

  1. When I do a tcpdump -i XX -nn | grep 224.0.0.251 on my firewall (OPNSense) in either networks, I see the mDNS responses being sent and responded, the responses also get back to the HA network.
  2. In my browser (Vivaldi) I can see the ESPhome integration is sending out /ping, and their result is HTTP 200 OK, but the response header is "{"airgradient-office.yaml": false}". I take it that this is why it is seen as being offline.

I am aware I could use status_ping or something, but in my case I can’t see why it doesn’t work. I read everywhere that it relies on mDNS, but it appears to me this is working ok on my network - yet, ESPHome still shows it as offline?

Any cunning idea or thought’s what I have missed?

Cheers

Tom

Offline in HA ? ESPHome or both ? Offline in ESPHome is not big deal out if you need to reflash !
In HA it does not detect the ESP but if you put its IP address manually does it work ?
Also answer of local mDNS doesn’t mean IP answered by mDNS is reachable :wink:
May I ask why your devices are not in same LAN as your HA instance ?

It’s shown only in ESPhome as “offline”.
The device is on DHCP, but with an extra long lease time, a week or so.
By manual IP do you mean like that: WiFi Component — ESPHome ? I just did,
then saved it - but ESPHome still shows it as offline. Do I need to reflash?

I have setup a VLAN just for any “SMART” or “IOT” device along with its own SSID on my wifi AP. HA and “my” machine are on a seperate VLAN and the only ones allowed access. This is that no device can ever go off and report data elsewhere, but also use IP based security on any device on the “SMART” VLAN - I connect it to the SMART SSID and don’t have to worry. In short, the SMART VLAN can only be accessed from specific IPs outside of it and any device within can’t access anything else (except DNS, NTP,…). Oh yeah, I built a little jail…
Maybe I will move HA onto its own /30 VLAN when I have the need to make it remotely accessible from the internet, right now I could also OpenVPN back home and access the web interface through there.

I haven’t used mDNS before - maybe I should read up about it. But I thought the way it works is “anybody with a name of airgradient.local out there?” “oh yes, that’s me on IP a.b.c.d” - so can’t you infer then it is “online” by the response? Why else would it need to use multicast, when it floods the network to search for THE ONE (white rabbit?)?

Hi TOM

i had the same situation like you, with the error : Error resolving IP address: [Errno -5] No address associated with hostname

As you mentioned my HAA is on a diferent VLAN rather than the SSID for the ESPhome device, did you found any solution?

Thanks

Ether fix mDNS across your VLAN’s or disable mDNS (use ICMP pings) like the documentation tells you :point_down:

2 Likes

Your problem is very different to mine.
In your case, it can’t resolve the hostname.

A few months after I raised this issue an upgrade fixed it and I have just checked it and it shows ONLINE ever since.