Repository navigation
Description
Summary
Device Builder shows Offline (or stays Unknown then goes Offline via ping) for ESPHome nodes configured with name_add_mac_suffix: true, even when:
- Home Assistant's ESPHome integration is healthy and entities update normally
- The device is reachable on the LAN (ICMP to its IP succeeds)
- mDNS resolution of the suffixed hostname works from inside the add-on container
The root cause is a name mismatch between the YAML catalog key (esphome.name, e.g. example-node) and the mDNS broadcast name ({name}-{mac_suffix}, e.g. example-node-aabbcc).
Environment
| Item | Value |
|---|---|
| Device Builder backend | esphome-device-builder 1.7.0 |
| ESPHome CLI / add-on | 2026.7.3 |
| Add-on image | ghcr.io/esphome/esphome-hassio:2026.7.3 |
host_network |
true |
| Device | ESP32-S3 class board |
YAML esphome.name |
example-node |
| YAML | name_add_mac_suffix: true |
| mDNS broadcast | example-node-aabbcc._esphomelib._tcp.local. |
Steps to reproduce
- Configure any ESPHome device with
name_add_mac_suffix: trueand a short base name (under 24 chars). - Flash and confirm HA integration works.
- Open Device Builder in the HA add-on ingress UI.
- Observe the device card shows Offline (reachability drawer: "via ping").
Expected behavior
Device shows Online (via mDNS) once the _esphomelib._tcp service is visible, matching HA integration health.
Actual behavior
- Pre-fix log line (repeated every ping sweep):
Device example-node (example-node.yaml): unknown → offline (via ping) - Post-fix (with patch applied):
unknown → online (via mdns)within ~1s of browser start.
Evidence (from inside the add-on container)
mDNS resolution:
split ('example-node', 'aabbcc')
suffixed ['192.168.x.x'] # example-node-aabbcc.local
base None # example-node.local — does not exist
Zeroconf browse finds example-node-aabbcc._esphomelib._tcp.local. at a routable LAN address.
Ping to that address succeeds from the container.
Cross-VLAN mDNS is enabled on the relevant VLANs — not a network/reflector issue.
Root cause
Two code paths assume the mDNS service instance name equals the configured esphome.name:
-
MdnsSource._on_esphomelib_service_state_change(mdns.py~484):_find_device_by_name(device_name_from_service(...))looks upexample-node-aabbccin the catalog; configured name isexample-node→ short-circuit, announcement ignored. -
Ping sweep (
ping.py): resolvesdevice.address≈example-node.local(from StorageJSON fallback in_loading.py). That hostname does not exist whenname_add_mac_suffix: true— only{name}-{suffix}.localis registered.
The adopt flow already handles broadcast ≠ catalog name via probe_device(name, service_name=mdns_name) (importable.py ~279), but there is no equivalent for ongoing name_add_mac_suffix monitoring.
PTR ownership: _apply_service_info also gates ONLINE on _has_live_ptr(device_name, ...) using the catalog name; with mac suffix the live PTR is under the broadcast name, so even a partial fix must use the broadcast label for PTR checks.
Proposed fix
-
Add
_find_device_for_mdns_broadcast(broadcast_name)onDeviceStateMonitor: exact match first, then strip a trailing-{6hex}MAC suffix when it matches a unique configured base name (disambiguate duplicate names by MAC when known). -
Route esphomelib/http browser callbacks through that mapper; apply state against the catalog name, but check PTRs against the broadcast name.
-
In the ping sweep, when
device.addressfails to resolve, also try{name}-{mac_suffix}.localfrom the device's known MAC (once mDNS TXT has populated it).
I have a working patch + pytest repro (test_handler_marks_mac_suffix_broadcast_online) validated locally and hot-patched on a live HA add-on (log: unknown → online (via mdns)).
Notes
status_use_pingwas removed from the add-on schema in Device Builder 2026.6+; the FAQ still mentions it. There is no UI toggle — ping fallback is always active when ICMP works.- Setting
wifi.use_addressto a static IP does not fix the offline badge (tested); the mDNS name mismatch is the blocker. - Workaround: set
name_add_mac_suffix: falseand use a unique literal name (or adopt with suffix baked intoesphome.name).
Activity
aioue commentedon Aug 1, 2026
Patch tested on live system, restores "Online"
aioue commentedon Aug 1, 2026
Draft patch for the behaviour described above (not proposed as the definitive fix): #2481
bdraco commentedon Aug 1, 2026
The current design is that when you adopt a device in the dashboard it removes
name_add_mac_suffix: trueand flashes the device to remove it. Its intended for provisioning devices out of the box, and than adopting them in the dashboard. We don't have a way to link the specific device to the mac suffix and picking the first possible match would potentially promote the wrong device online.bdraco commentedon Aug 1, 2026
Thanks for the thorough writeup and the patch, the investigation quality here is genuinely appreciated.
After looking at this carefully we're going to keep the current behavior.
name_add_mac_suffixis a provisioning feature; it exists so a factory can flash one image to many units and each one shows up on the network with a unique name. Once a device is adopted, the dashboard bakes the suffixed name intoesphome.nameas a literal and turns the option off, and that's the intended production state. A managed config that keeps the option on is one YAML that can be running on any number of physical units at once, and the dashboard's device model is one row per YAML file; there's no safe way to bind that row to a specific unit. Mapping suffixed broadcasts back to the base name means whichever unit announces first gets promoted, and its IP, version and config hash get stamped onto the row; with more than one unit the row flaps between them, and the MAC can't disambiguate because we only learn a device's MAC through paths that require the name to have matched already. For what it's worth the legacy dashboard had the same limitation; its status tracking was also keyed on the configured name.The supported paths are to adopt the device, which bakes the suffix in for you, or to give the config a unique literal name; you already found the second one as your workaround.
Good catch on the FAQ still mentioning
status_use_ping, that reference is stale and we'll get it cleaned up.bdraco commentedon Aug 1, 2026
Looks like esphome/esphome.io#7070 already dropped the FAQ item.
aioue commentedon Aug 1, 2026
Appreciate your thorough reply. I didn't fully absorb that the Dash is not a representation of specific units - that just happens to be my use case.
Again, thank you for taking the time to explain. Have a great weekend 🖖