Skip to content

Wait for the panel to load instead of falling back to entity discovery - #46

Merged
cayossarian merged 4 commits into
mainfrom
feat/remove-entity-fallback
Nov 23, 2026
Merged

cayossarian merged 4 commits into
mainfrom
feat/remove-entity-fallback

Conversation

@cayossarian

@cayossarian cayossarian commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

What

The dashboard card no longer builds a topology from the device and entity registries when panel_topology fails. While the integration is still loading the panel, the card says it is waiting and asks again once the panel's config entry has loaded.

Why

  • The card ships only inside the integration, and from integration 2.3.3 panel_topology answers every logged-in user. The reasons the fallback existed are gone.
  • What still sent the card to the fallback was Home Assistant starting or restarting, a panel in setup retry, or a lost connection. The fallback failed in those cases too, so the card showed "Unable to connect to SPAN Panel" until Retry was pressed or the dashboard was opened again.
  • Where the fallback did build a panel, it marked every circuit controllable and carried no control_access or ratings, and later refreshes kept to it.

Changes

  • Waiting instead of failing: panel_topology refused with not_loaded, no_data or unknown_command, or a lost connection, is not retried. The card shows "Waiting for SPAN Panel to load..." and asks again when the panel's entry reaches loaded (config_entries/subscribe, whose first batch and each reconnect's re-seed report an entry already loaded).
  • Final failures: any other failure stays until Retry or a config change. Home Assistant state updates no longer ask again, and a failure cancels any ask still in flight.
  • One source: refreshes always ask panel_topology. The fallback-only code, types and the card.panel_size_error string are removed, and DiscoveryResult.topology is no longer nullable.
  • Library floor: recovery across a restart relies on home-assistant-js-websocket 9.8.0, which the frontend of every supported Home Assistant (2026.11.0 and later) pins.

Changelog (0.12.1, Fixed)

  • A SPAN Panel card opened while Home Assistant is starting or restarting, or while the integration retries a panel it cannot reach, says it is waiting for the panel to load and draws the panel once it has loaded, where it showed "Unable to connect to SPAN Panel" until Retry was pressed or the dashboard was opened again.

Tests

  • New tests/span-panel-card-entry-wait.test.ts: waiting on each refusal that waits, asking again on the entry's load and on a re-seed, the owning entry versus any entry for a device id from before 2026.8, a final failure across hass updates and re-attach, Retry, detach and setConfig during a wait, and a failure landing while an ask is in flight.
  • isTopologyPending table and the RetryManager pass-through in tests/card-discovery.test.ts and tests/retry-manager.test.ts.
  • npm test: 1696 passed. Lint, typecheck and i18n validation are clean.

dist/ is rebuilt in its own commits. The branch sets the version to 0.12.1-beta.1, released as the pre-release v0.12.1-beta.1 from 244e937, which SpanPanel/span#384 bundles for the integration's beta.

… to entity discovery

The card built a topology from the registries whenever panel_topology failed.
With the card shipped only inside the integration, and 2.3.3 answering
panel_topology for every user, that fallback ran only while Home Assistant was
starting, while a panel was in setup retry, or after a lost connection. In those
cases it failed too and left "Unable to connect" until Retry. The card now waits
for the panel's entry to load in those cases, and any other failure stays until
Retry or a config change.
@cayossarian
cayossarian merged commit 3dc5723 into main Nov 23, 2026
3 checks passed
@cayossarian
cayossarian deleted the feat/remove-entity-fallback branch November 23, 2026 21:48
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