Hi
I noticed that in ESPhome I have devices offline which are in fact online and visible in HA. Even in ESPhome I can install firmware and start logging without an issue. Still the device appear offline. How can that be?
Hi
I noticed that in ESPhome I have devices offline which are in fact online and visible in HA. Even in ESPhome I can install firmware and start logging without an issue. Still the device appear offline. How can that be?
Esphome uses mDNS to say its online. There are other posts with same problem and solutions.
Make mdns work or you may try āstatus_use_pingā: true
Note
By default, ESPHome uses mDNS to resolve device IPs on the network; this is used to determine online/offline state in the ESPHome Device Builder. In order for this feature to work, you must use Dockerās host networking mode.
The host networking driver only works on Linux hosts; it is available on Docker Desktop version 4.29 and later.
If you donāt want to use the host networking driver, you have to use an alternate method as described below.
Note that mDNS might not work if your Home Assistant server and your ESPHome nodes are on different subnets and/or VLANs. If your router supports Avahi, you can configure mDNS to work across different subnets. For example, in OpenWRT or pfSense:
- Enable Avahi on both subnets (install Avahi modules on OpenWRT or pfSense).
- Enable UDP traffic from your ESPHome deviceās subnet to 224.0.0.251/32 on port 5353.
Alternatively, you can configure the ESPHome Device Builder to use ICMP pings to check the status of devices by setting
"status_use_ping": true
or, with Docker:-eESPHOME_DASHBOARD_USE_PING=true
See also Dashboard status light not working across subnets/zones Ā· Issue #641 Ā· esphome/issues Ā· GitHub.
Thank you guys! I have enough to investigate. Quite a number of suggestions of which I was not aware at all! Thank you again
I have set my router settings from Unicast to Multicast and now we waitā¦ but it seems it solved the issue. I am always a bit afraid that something else pops up but so far so good! Thanks again!
I was wrong. It didnt solve the issue. I thought it was the router settings but its still happening. What else could I miss out on?
What is install method?
Ping works
Thank you! Yes I found that option in the add-on setup. I switched it on. Letās see if that works. Although itās not a life threatening issue I still like to have it working consistently!
My set up is a RPI4 Supervised.
Not HAOS?
In the end it is mdns issue. Esphome is not seeing broadcast. Ping get around this but not sure of drawbacks
I have esphome in Docker and all say offline. Maybe I have it in wrong network but itās no different than my ha in docker. Maybe there is some small diffenvevwith esphome. Maybe I check today
indeed HAOS. I thought my router settings would do it but unfortunately it didāt In itself it doesnāt cause any issue but I just want to resolve itā¦
so i decided to look into why devices are offline for me and clarified at least this point
using my ratgo as an example. its hostname is ratgo02 and my domain is localdomain
HA can ping ratgo.localdomain
esphome cannot ping ratgo.localdomain
so obvioulsy it is not resolving the address but why? need to look into this as it shouldnt be an issue.
MDNS work for me
esphome resolves external addresses and local host on docker network
let you know when I get a clue
EDIT
checked again. I made mistake. esphome resolve hostname
Mr wise cracker - know it all. Why is the apparently recurrent issue not resolved a long time ago?
You marked this āissueā as resolved just with the first answer from @Spiro
Most of this recurring āissuesā seem to be caused by misunderstandings from users including not differenciating between DNS and mDNS. This paired with the aversion to make use of the FAQ or widely available search functions leads to posts like this
So if we look at your āissueā
And consult the FAQ - we find the following
Notes on disabling mDNS
Some of ESPHomeās functionality relies on mDNS, so, naturally, disabling it will cause these features to stop working.
[ā¦]
- Because status detection in the ESPHome Device Builder uses mDNS by default, nodes with mDNS disabled will always appear as āofflineā. This does not affect any functionality; however, if you want to see the online/offline status of your nodes, you may configure the ESPHome Device Builder to ping each node instead. See the notes in the Docker Reference section for more information.
Kind like the perfect explanation - isnāt it?
Yes on paper. But I have mDNS enabled and even the Ping option and still have the issue that it appears offline while itās not. Itās not a big issue but I just like to understand why!
If you really want to understand start by reading about networking basics it probably clarifies things for you.
If there is no API activity, for example it the sensor only reads data once a minute, or the device is asleep, then there is no mDNS or ping. Iāve just learned to ignore āofflineā because it is remarkably unreliable. Unless I am low on memory, I always put the web server component on my ESPHome devices.
web_server:
port: 80
Click on āvisitā and if your browser says: āCanāt reach this pageā, then the device is offline.
I found this thread a few days ago whilst experiencing a smilar problem.
I have since made a post elsewhere on the forum, related to mDNS settings not being available on some routers. (Icotera i4882).
According to the FAQ (thanks for the link), āNotes on disabling mDNSā indicate major issues with comms to each ESP and the Offline / Online will always return Offline. So the notes imply, multicast must be selected or operational or at least not disabled, otherwise they would NEVER show Online.
In my instance at least, that is not the case.
HA running on a Pi4
Core 2025.1.4
Supervisor 2025.02.0
Operating System 14.0
Frontend 20250109.2
Iāve never set a static ip address in the router or on an ESP device.
It is random when some ESP devices show Offline in ESP Home but still seem fully functional otherwise. They all provide values multiple times per minute so canāt be asleep.
I would also like to understand why this happens.
mDNS disabled ? - Unlikely.
If you can ping homeassistant.local
, mDNS is working.
It sometimes replies with an IPv4 address and sometimes with an IPv6 addressā¦
Is this expected?
I wonder if thatās a clue as to why the Online / Offline is intermittant?
Is HA sometimes using IPv6 addresses to ping ESP32?
Fairly sure it wonāt replyā¦