feat(ws_bridge): support declaring entity types ESPHome has no domain… - #283
Merged
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… 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_bridgeoff, these have to be declared by calling the protocol directly from a lambda. Two things were missing for that:Nothing here is device_tracker-specific: any future HA platform is reachable from YAML without further firmware changes.