Skip to content

fix(supervisor): register the advertised address as the discovery host - #21

Merged
cayossarian merged 2 commits into
mainfrom
fix/supervisor-discovery-host
Aug 29, 2026
Merged

fix(supervisor): register the advertised address as the discovery host#21
cayossarian merged 2 commits into
mainfrom
fix/supervisor-discovery-host

Conversation

@cayossarian

Copy link
Copy Markdown
Member

Follow-on to #20, which merged before this was ready. Released as 2.5.2 rather
than folded into 2.5.1 -- see Why a new version below.

Discovery registered a hostname no certificate names

register_panel published the container hostname, on the reasoning that HA
Core resolves it via Docker DNS. It does resolve -- but under
host_network: true that hostname is a per-add-on alias for the host, not a
name the panel's leaf was issued for, so a consumer that reaches us by it has
no way to verify us.

Worse, the integration's async_step_hassio deliberately rewrites an existing
entry's host to whatever the add-on registers. Observed on ha-test: an entry
the user had configured by IP (192.168.65.19) was silently re-pointed at the
simulator's add-on hostname, and the later swap to PanelBench then failed
hostname verification. The alias also changes when a panel moves between
add-ons where the address does not, so it is the wrong thing to pin an entry
to even when verification would have passed.

Now registers the advertised address -- what the leaf names, and what stays
constant across the simulator/PanelBench swap -- threaded in from app.py,
which already holds the address it hands to the certificate generator and the
mDNS advertiser. All three now name the panel the same way.

The container hostname stays as the fallback when no advertise address is
configured: Docker DNS still resolves it, and a panel with no address to
publish should stay discoverable rather than register a host of None.

The simulator is receiving the identical change, with the same constructor
shape (advertise_address: str | None = None).

Why a new version

2.5.1 merged and its add-on image built successfully from main before this
fix was ready. Home Assistant offers an add-on update only when the version
string changes, so a second image labelled 2.5.1 would never reach anyone
already running it -- the fix would ship and nobody would receive it. Hence
2.5.2, with its own changelog entry.

Testing

Two cases cover the registered host, one per branch: with an address
configured it is the address and specifically not the container alias, and
with none configured it falls back to the alias rather than registering
nothing.

Full suite 392 passed; pre-commit run --all-files green across all eight
hooks; uv lock --check passes after regenerating the lock for the bump.

Note on the HTTPS port convention

The task flagged that the simulator is adopting PanelBench's
http + HTTPS_PORT_OFFSET convention (const.py:20-31) and asked whether any
PanelBench doc claims the two differ. Checked: none does. README.md:73-78
describes the offset-1000 pairing as PanelBench's own behaviour without
contrasting it against the simulator, so no doc change was needed.

Registration published the container hostname, on the reasoning that HA Core
resolves it via Docker DNS. It does resolve -- but under `host_network: true`
that hostname is a per-add-on alias for the host, not a name the panel's leaf
certificate was issued for, so a consumer that reaches us by it has no way to
verify us.

Worse, the integration's `async_step_hassio` deliberately rewrites an existing
entry's host to whatever the add-on registers. Observed on ha-test: an entry
the user had configured by IP (192.168.65.19) was silently re-pointed at the
simulator's add-on hostname, and the later swap to PanelBench then failed
hostname verification. The alias also changes when a panel moves between
add-ons, where the address does not -- so it is the wrong thing to pin an
entry to even when verification would have passed.

The advertised address is what the leaf names and what stays constant across
the simulator/PanelBench swap, so it is what gets registered. The container
hostname remains the fallback when no advertise address is configured: Docker
DNS still resolves it, and a panel with no address to publish should stay
discoverable rather than register a host of `None`.

Threaded from `app.py`, which already holds the address it hands to the
certificate generator and the mDNS advertiser, so all three now name the panel
the same way.
2.5.1 merged and its add-on image built before this fix was ready, so the fix
needs a version of its own: Home Assistant offers an add-on update only when
the version string changes, and a second image labelled 2.5.1 would never
reach anyone already running it.

Version synced across pyproject, config.yaml, Dockerfile and __init__.py by
scripts/sync-version.sh from pyproject as the source of truth, and uv.lock
regenerated so the recorded project version matches.
@cayossarian
cayossarian merged commit 6e2a8ec into main Aug 29, 2026
2 checks passed
@cayossarian
cayossarian deleted the fix/supervisor-discovery-host branch August 29, 2026 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant