Skip to content

feat(ws_bridge): support declaring entity types ESPHome has no domain… - #283

Merged
eigger merged 1 commit into
masterfrom
feat/ws-bridge-manual-declare
Aug 3, 2026
Merged

feat(ws_bridge): support declaring entity types ESPHome has no domain…#283
eigger merged 1 commit into
masterfrom
feat/ws-bridge-manual-declare

Conversation

@eigger

@eigger eigger commented Aug 3, 2026

Copy link
Copy Markdown
Owner

… for

Home Assistant supports entity types ESPHome has no platform for — the immediate one being device_tracker (GPS location). Since there's no ESPHome device_tracker: domain to hang a platform: ws_bridge off, these have to be declared by calling the protocol directly from a lambda. Two things were missing for that:

  • send_state_object(), for states that aren't a single scalar (device_tracker carries latitude+longitude together).
  • an on_declare trigger. Declarations are re-sent both on connect and on every periodic re-announce, but on_connected only fires for the former — so a hand-built declaration hooked there would be silently left behind by a re-announce that heals a lost HA-side registration, which is precisely what the re-announce exists to fix. on_declare fires from declare_all_entities_() itself, keeping manual declarations in lockstep with the registered platform entities.

Nothing here is device_tracker-specific: any future HA platform is reachable from YAML without further firmware changes.

… for

Home Assistant supports entity types ESPHome has no platform for — the
immediate one being device_tracker (GPS location). Since there's no
ESPHome device_tracker: domain to hang a `platform: ws_bridge` off,
these have to be declared by calling the protocol directly from a
lambda. Two things were missing for that:

- send_state_object(), for states that aren't a single scalar
  (device_tracker carries latitude+longitude together).
- an on_declare trigger. Declarations are re-sent both on connect and
  on every periodic re-announce, but on_connected only fires for the
  former — so a hand-built declaration hooked there would be silently
  left behind by a re-announce that heals a lost HA-side registration,
  which is precisely what the re-announce exists to fix. on_declare
  fires from declare_all_entities_() itself, keeping manual
  declarations in lockstep with the registered platform entities.

Nothing here is device_tracker-specific: any future HA platform is
reachable from YAML without further firmware changes.
@eigger
eigger merged commit 73eaa96 into master Aug 3, 2026
@eigger
eigger deleted the feat/ws-bridge-manual-declare branch August 3, 2026 23:33
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