Skip to content

Advertise dashboard over mDNS in HA addon mode#1367

Merged
bdraco merged 2 commits into
mainfrom
make-dashboard-discoverable-in-addon
Jun 9, 2026
Merged

Advertise dashboard over mDNS in HA addon mode#1367
bdraco merged 2 commits into
mainfrom
make-dashboard-discoverable-in-addon

Conversation

@bdraco

@bdraco bdraco commented Jun 9, 2026

Copy link
Copy Markdown
Member

What does this implement/fix?

The dashboard now advertises itself over mDNS when running as a Home Assistant addon, so the ESPHome Desktop app can discover that a builder is running on the network. Previously the advertise was skipped entirely in addon mode.

The addon runs with host networking, so the announce carries the host LAN IP and reaches peers. The one wrinkle is that the container also sees the Supervisor hassio bridge (172.30.32.0/23); that address is host internal, so it is now filtered out the same way docker0 already was, and we never advertise an unreachable 172.30.32.x address.

The advertise is discovery only; the peer-link receiver stays default off on the addon, so the announce carries server_version and esphome_version but no pin_sha256 or remote_build_port. The companion frontend PR uses that absence to hide the addon dashboard from the send builds list, since it cannot accept builds.

Related issue or feature (if applicable):

  • No related issue

Types of changes

  • Bugfix (non-breaking change which fixes an issue) — bugfix
  • New feature (non-breaking change which adds functionality) — new-feature
  • Enhancement to an existing feature — enhancement
  • Breaking change (fix or feature that would cause existing functionality to not work as expected) — breaking-change
  • Refactor (no behaviour change) — refactor
  • Documentation only — docs
  • Maintenance / chore — maintenance
  • CI / workflow change — ci
  • Dependencies bump — dependencies

Frontend coordination

Checklist

  • The code change is tested and works locally.
  • Pre-commit hooks pass (ruff, codespell, yaml/json/python checks).
  • Tests have been added or updated under tests/ where applicable.
  • components.index.json / definitions/components/*.json have not been hand-edited (regenerate via script/sync_components.py if a sync is needed).
  • Architecture-level changes are reflected in docs/ARCHITECTURE.md and/or docs/API.md.

The addon runs with host networking, so the mDNS announce reaches the
LAN; the Desktop app can now discover that a builder is running. Filter
the Supervisor hassio bridge out of the announced addresses, the same
way docker0 already was, so we never advertise an unreachable
172.30.32.x address. The advertise is discovery only; the peer-link
receiver stays default off on the addon.
@bdraco bdraco added the enhancement Improvement to an existing feature label Jun 9, 2026
@bdraco bdraco marked this pull request as ready for review June 9, 2026 18:04
Copilot AI review requested due to automatic review settings June 9, 2026 18:04
@codspeed-hq

codspeed-hq Bot commented Jun 9, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 27 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing make-dashboard-discoverable-in-addon (aba4da7) with main (ba5b85d)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

@esphbot

esphbot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

PR Review — Advertise dashboard over mDNS in HA addon mode

Focused, well-tested change — merge-ready.

  • Removes the addon-mode advertise guard cleanly; the rationale (host networking carries the real LAN IP) is captured in the updated comment.
  • hassio added to the virtual-bridge prefix list so the Supervisor 172.30.32.0/23 address never reaches the wire, mirroring the existing docker0 filtering.
  • Test coverage is solid: new test_local_addresses_ha_addon_layout exercises the realistic host-networking adapter mix, and the addon-mode advertise test was correctly inverted (now asserts construction + register await).
  • One minor suggestion: the Supervisor range is suppressed by interface name only; an IP-subnet guard would be a cheap backstop, but the name match is consistent with prior art and not blocking.


Automated review by Kōan (Claude) HEAD=b5dc1e3 1 min 5s

@esphbot esphbot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enables the backend to advertise the Device Builder dashboard over mDNS when running as a Home Assistant add-on, allowing LAN discovery (e.g., by ESPHome Desktop) in add-on deployments. It also avoids advertising host-internal Supervisor networking addresses by filtering the hassio bridge interface out of the address selection used for announcements.

Changes:

  • Remove the HA add-on guard that previously skipped dashboard mDNS advertising, so advertising occurs whenever zeroconf is available.
  • Filter the HA Supervisor hassio bridge interface from _local_addresses() so announcements don’t publish unreachable 172.30.32.0/23 addresses.
  • Extend unit/integration tests to cover the add-on network layout and the “advertise in add-on mode” behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/test_dashboard_advertise.py Adds HA add-on bridge filtering coverage and updates the DeviceBuilder lifecycle test to expect mDNS registration in add-on mode.
esphome_device_builder/helpers/dashboard_advertise.py Treats hassio* interfaces as virtual bridges so their addresses are excluded from advertised A/AAAA records.
esphome_device_builder/device_builder.py Advertises the dashboard in HA add-on mode when zeroconf is available, instead of skipping unconditionally.

Comment thread tests/test_dashboard_advertise.py Outdated
@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.49%. Comparing base (ba5b85d) to head (aba4da7).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1367      +/-   ##
==========================================
- Coverage   99.49%   99.49%   -0.01%     
==========================================
  Files         221      221              
  Lines       16991    16989       -2     
==========================================
- Hits        16906    16904       -2     
  Misses         85       85              
Flag Coverage Δ
py3.12 99.47% <ø> (-0.01%) ⬇️
py3.14 99.49% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
esphome_device_builder/device_builder.py 97.73% <ø> (-0.02%) ⬇️
...home_device_builder/helpers/dashboard_advertise.py 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bdraco bdraco enabled auto-merge (squash) June 9, 2026 18:33
@bdraco bdraco merged commit 3b76c24 into main Jun 9, 2026
19 checks passed
@bdraco bdraco deleted the make-dashboard-discoverable-in-addon branch June 9, 2026 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improvement to an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants