ESPHome Devices "Offline" but only for dashboard status

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

24 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
2 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

Not sure if this thread is still active, but I struggled also with the devices showing as offline is ESPHome.
My solution was to allow “unregistered forward” in the multicast filter-rule of my switch.

Regards,
Uli

1 Like

Only fix for me is to go and “reconnect” then in Unifi controller. Then they’re back to being online.

The marked solution works only for the HA appliance environment.
For those who run esphome dashboard in a separate docker environment (e.g. local PC), on the same network, using mDNS resolver:

  • use host networking
  • attach dbus and avahi daemon sockets
  • install avahi-utils in container

In details:

An example docker configuration:

    $ docker run -it --name esphome-db --network=host \
        -v "$PWD":/config \
        -e ESPHOME_DASHBOARD_USE_PING=true \
        -v /var/run/dbus:/var/run/dbus \
        -v /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket \
        esphome/esphome

    esphome-db$ apt -qq update && apt -y install avahi-utils # in container

Yes, installing avahi-utils manually in every container is inconvenient. You can use your own ‘forked’ images or whatever, but at least it works.

1 Like

This isn’t really necessary with modern OS (eg Windows/Ubuntu 22.04…) as mDNS is already propagated to the container. I spent a good while trying to fix my container setup (including the steps described above) before realizing that the docker host resolver is looking for .home rather than .local (the ESPHome default). All I needed to do was add a domain: .home entry to the wifi section of the device config and all is well
Alternatively one could modify the host resolver to handle .local searches (I didn’t want to do that)