ESPHome Devices "Offline" but only for dashboard status

I recently swapped out my network equipment. I was using UniFi APs, switches, and a UDM-Pro. I am now using Eero Pro 6 and an unmanaged switch.

ESPHome now shows all of my nodes as “Offline”. If I use the visit button on each node from the dashboard, it opens the page correctly and I can interact with the node. I can click the logs button on the dashboard and it will connect and show me logs directly from the node. The node responds to ping and nslookup via hostname from my computer on the same network. The node can also be seen by and controlled from HA regardless of IP address (static or DHCP). It’s just the dashboard for ESPHome is saying the node is offline which is preventing me from doing OTA updates.

My setup is this:

  • ESPHome (2022.3.0) and HA (2022.3.5) in docker on a Synology NAS
  • ESPHome docker using ports (opened 6123 and 6052)
  • ESPHome docker with variable ESPHOME_DASHBOARD_USE_PING="true"
  • HA docker using --net=host
  • “Flat” network architecture, no VLANs, no guest wireless networks, everything in the same subnet
  • ESPHome nodes are a mix of ESP8266 and ESP32
  • ESPHome nodes have a DHCP reservation

Things I have tried:

  • All nodes have static IP addresses assigned through a DHCP reservation, but this also occurs when they just receive a random IP address. HA can still talk to them, but ESPHome dashboard shows it is offline
  • Reconfigured ESPHome docker container to use --net=host, but there was no change and nodes still show as offline
  • created a brand new node with a basic configuration. it connects to my WiFi and HA says it found a new device, but ESPHome dashboard still shows it is offline.
  • downgraded ESPHome docker to 2022.2.5 which is what I was running before I swapped my network equipment and the dashboard still shows the nodes as offline.

I’m starting to think Eero is doing something with mDNS/Avahi. Has anyone else encountered this before or have any ideas I can try out?

The error I get when attempting an OTA update is:

======================== [SUCCESS] Took 124.96 seconds ========================
INFO Successfully compiled program.
INFO Resolving IP address of office_cabinet_lights.local
ERROR Error resolving IP address of office_cabinet_lights.local. Is it connected to WiFi?
ERROR (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
ERROR Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -2] Name or service not known

If I go to the node “office_cabinet_lights.local” in a browser, it connects and I can interact with the node. I have also tried this with a node that has a one word name (I’ve seen the warnings about using underscores in a name) and the dashboard still cannot find the node or resolve the name, but otherwise the node is working.

This is the error when trying to connect to view logs from the ESPHome dashboard:

INFO Starting log output from office_cabinet_lights.local using esphome API
WARNING Can't connect to ESPHome API for office_cabinet_lights.local: Error resolving IP address: [Errno -2] Name or service not known
INFO Trying to reconnect to office_cabinet_lights.local in the background

My lan has a dhcp server and tied dns server (pihole, which uses dnsmasq). All devices get a name ending .lan

I specify my domain in esphome to “.lan” and all is well.

I’ve never had to specify the domain in ESPHome before. It defaults to “.local” anyway according to the docs. My whole network is “.local” and everything else responds via ping and nslookup to its hostname.local. Just the ESPHome Dashboard can’t for some reason?

EDIT: adding domain: .local to my ESPHome code changed nothing. Dashboard still shows as offline and clicking the logs button just says it could not resolve .local and pinging the same from a computer works.

so after some very in-depth research, eero does not run its own DNS. it forwards any lookup requests to upstream DNS servers, either the ones handed out by my ISP, or any that I set manually. But upstream external servers cannot resolve any “.local” address. This means I must run my own DNS locally to handle these lookups. Enter PiHole, but really any DNS server package like on my Synology.

1 Like

Hi - could you provide the steps you took to resolve please? I have a similar set-up, running ESPHome on docker in unraid and not getting online status despite being reachable for logs etc. I am also running a pi-hole but don’t have much experience of DNS stuff or using .local addresses.

Thanks for updating your thread that you had it resolved but some more detail about the steps to fix would be massively appreciated.

Hi,

I had a similair issue. All my noded were reachable via name e.g. desklamp.home.lan. after i set the domain to .home.lan . Esphome kept showing the devices as offline. It didnt seem capable of resolving the devices. This is how ended up on this forum post. after some googling i found the esphome faq docker references. there is enviromental variable to be set.

ESPHOME_DASHBOARD_USE_PING=true

In my case as i was running esphome from within home assistant. After a bit of searching in the new settings menu i found the setting needed.

go to: settings → addons → EspHome → configuration
then click on Show unused optional configuration options
Enable status_use_ping .
restart the esphome addon and the device now show as online.

Hope this helps somebody else

27 Likes

Thank you sooooooo much. I have wasted hours trying to fix this issue!!! All of my “older” ESP devices (9) worked perfectly, just when attempting to add a new device did I encounter this “OFFLINE” issue. All is now working perfectly.

1 Like

wow, what a can of worms I just opened. did an update to home assistant this morning - home assistant os 8 and core 2022.5.4. after update, esphome shows no errors in logs, but all devices offline, and lights and everything is not working. I tried this use the ping setting above and after restarting devices show online for a couple seconds and start falling off one at a time.

restored backup from yesterday, and lights are working again, but still showing offline in esphome dashboard. tried ping enabled, disabled, restart ha, nothing.

now I’m not sure how long this issue has been happening, because I haven’t visited my esphome dashboard in weeks or more?

weird thing is even after restoring from yesterday, my ha os is still showing 8. will try to see if I can restore a backup from a week or so ago, since I don’t think I have anything else to lose as far as work I have done on my setup.

one more detail that may be relevant is I run pfsense as my firewall router, and it totally forbids the use of .local, so my local network domain is casanet set at pfsense router.

also discovered, the visit button in the esphome dashboard doesn’t work any more either, but if I go look up the ip address of a bulb on my router, I can pull the bulb up and it is fine, so, my guess about all this so far is…

IT’S DNS! IT’S ALWAYS DNS!, LOL

edit: just checked the logs on my bulb and it says can’t connect to lohas1.local, so definitely dns. not sure how to fix this, why it’s broke, or why it ever worked before.

when looking at logs for a bulb…

INFO Reading configuration /config/esphome/lohas1.yaml...
INFO Starting log output from lohas1.local using esphome API
WARNING Can't connect to ESPHome API for lohas1.local: Error resolving IP address: [Errno -5] No address associated with hostname
INFO Trying to reconnect to lohas1.local in the background

docs say…

  • domain (Optional, string): Set the domain of the node hostname used for uploading. For example, if it’s set to .local, all uploads will be sent to <HOSTNAME>.local. Defaults to .local.

but not still not sure what to do to fix this.

@MSe-5-14

Blockquote
go to: settings → addons → EspHome → configuration
then click on Show unused optional configuration options
Enable status_use_ping .
restart the esphome addon and the device now show as online.

this worked for me on ESPHome

Home Assistant Core 2022.5.5
Home Assistant Supervisor 2022.05.2
Home Assistant OS 8.1
Kernel version 5.15.32-v8
ESPHome Current version: 2022.3.1

2 Likes

Worked for me. I’m busy migrating to Truenas Scale and this was the answer for my ESPHome devices.

Thank you!

The status_use_ping sort of worked for me in a similar situation. I think under the hood there are some IP/hostname issues with ESPHome+HA; but what I did find worked for some devices that were online in ESPHome but not HA, was to delete the integration (nb: this tripped me up the first time too, when you ‘delete the integration’ you’re really just deleting the one device – search in your integrations for the affected device so under the ESPHome card you only see the offender, then click the ellipsis and choose ‘delete’) and then immediately re-add it using it’s hostname (i.e. devicename.local). Then they work fine, and generally they’ll be assigned the same entity_id so all your automations/dashboards/scripts etc will work fine.

HTH!

Edit: actually, simply disabling (via the same ellipsis) and re-enabling the device seems to work. At least in my situation, it seems like HA/ESPHome is confusing devices together (maybe they had the same IP at one point? I did do some major network rework recently and my devices all got new IPs). So far I’m transitioning my devices to FQDNs as I run a MS AD – so after adjusting my DHCP server to enforce DNS name registration, I seem to be having OK luck setting up devices using [devicename].ad.mydomain.com. Will report back any further info.

thanks a lot. This worked like a charm.

This should be the default or at least mentioned in the install guide

Hi Guys, I am running esphome in docker, and I had same “Error resolving address with mDNS” issue, and my esp32 devices are always on offline state.
After tinkering a lot, I finally fixed it by installing flungo/avahi container, and enable REFLECTOR_ENABLE_REFLECTOR=yes, this is my docker-compose.yaml

  esphome:
    container_name: esphome
    image: esphome/esphome
    network_mode: host
    # ports:
      # - 6052
    volumes:
      - ./esphome/config:/config:rw
      - ./esphome/cache:/cache:rw
    environment:
#      - ESPHOME_DASHBOARD_USE_PING="true"
      - PLATFORMIO_CORE_DIR=/cache/platformio
      - PLATFORMIO_GLOBALLIB_DIR=/cache/platformio/lib
      - PLATFORMIO_SETTING_ENABLE_TELEMETRY=No
      - PLATFORMIO_SETTING_CHECK_PLATFORMIO_INTERVAL=665
      - PLATFORMIO_SETTING_CHECK_PLATFORMS_INTERVAL=666
      - PLATFORMIO_SETTING_CHECK_LIBRARIES_INTERVAL=667
    user: "${PUID}:${PGID}"
    restart: unless-stopped  
  avahi:
    container_name: avahi
    image: flungo/avahi:latest
    restart: "always"
    network_mode: bridge
    environment:
      - REFLECTOR_ENABLE_REFLECTOR=yes
3 Likes

Funny. In my case it was the exact opossite.
All devices were showing offline although I could ping them over .local address.
Turning the “status_use_pingoff fixed the issue for me.

Sorry I never responded. Here is what I did to solve my problem and why I marked my own answer as the solution.

Create a DHCP reservation in your router for every device by assigning an IP address by MAC address outside of the DHCP range.

Then in Pi-hole in the local DNS records page, create a record with whatever name you want access the node by and the static IP address.

Pi-hole now translates the hostname of the esphome node into the IP address for any client that uses it as a DNS server. Because my docker container uses the synology NAS host networking and my Synology NAS uses Pi-hole for DNS, the docker can now resolve the hostname to the IP address and the viewing of live logs as well as the online status works.

So, for everyone telling me to turn on the “…USE_PING” option, you clearly did not read my post. I have that enabled already. As I stated in the post that is marked as the answer, this is purely a case of eero not running its own dnsmasq service. Eero forwards all DNS requests to an upstream DNS service. Period. And because your ISP or google, or OpenDNS, or whatever DNS you’re using cannot resolve any “.local” hostnames, you MUST run your own DNS server internally. This issue only affects eero as far as I know. Maybe other networking equipment, but I don’t know.

The whole idea of mDNS (.local) is that it doesn’t need any name server.

Also there should be no way that any .local hostname is send to a upstream DNS servers from your ISP, google or OpenDNS as by specification (RFC 6762: Multicast DNS) they are limited to local area networks only.

Maybe contact the manufacture of your device ([email protected]) and ask them how they handle mDNS or if they are aware of it at all? The websites knowledge base isn’t aware of it at least…

1 Like

I also had to use the Ping workaround to have my ESP nodes come online.
But after correcting my firewall configuration and especially the Multicast part, the nodes are now appearing online (Ping option disabled).
Have a look a the note just above this faq link of esphome.
Basically, you need to forward multicast packets (224.0.0.251) from HA network to your ESP nod network.

Tim

2 Likes

This didn’t work for me. After switching it to ping, and rebooting the ESP32, it showed as Home, then after 10 or 15 minutes, as usual, it switched to “Away”. I can still ping the ESPHome device just fine. Data from the device still comes in just fine also.

I am late to the party, but maybe this could help someone if other methods do not work.
I have a similar setup with a dedicated vlan for IOT devices which all of my esphome nodes are on.
My esphome dashboard was showing all devices offline.
All I did was:

  1. in unifi network, go to Settings > Networks
  2. select the IOT network that is used for the esphome nodes
  3. scroll down, under DHCP section, DHCP Service Management, and expand the Show Options dropdown menu
  4. untick the DHCP DNS Server checkbox
  5. enter the DNS server ip you want to use {I use the same gateway ip as my UDMPro ip)
  6. apply the changes, and you should see the dashboard updating the nodes status to online within a couple of minutes.
1 Like