Add a controller connectivity binary sensor#8
Closed
ptr727 wants to merge 2 commits into
Closed
Conversation
Why: the integration exposed no reliable signal for whether the InFusion controller is reachable. The hub-level switch/update entities never go unavailable, and the per-object entities only drop one by one as their polls fail, staggered over ~15 min, so offline-detection automations had to watch a single module's power going unavailable as a fragile proxy. How: add VantageControllerConnectivityEntity, a per-master binary_sensor with device_class connectivity (diagnostic), registered via add_entities_from_controller over vantage.masters. It tracks the aiovantage event_stream Connected/Reconnected/Disconnected events and defaults to on after a successful initialize(). It does not poll and never marks itself unavailable, so it stays available and reports off during an outage, unlike the per-object entities. Tested: ruff check, ruff format --check, and pyright (strict) all pass. Real-hardware outage test on a live controller still pending. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Run the lint/type-check job on Python 3.13 and 3.14 (current Home Assistant supports 3.14). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds a diagnostic binary sensor that provides a single, reliable “controller reachable” signal by reflecting the aiovantage event-stream connection state, avoiding the staggered unavailable behavior of per-object entities during controller outages.
Changes:
- Add
VantageControllerConnectivityEntity(binary_sensor,device_class: connectivity,entity_category: diagnostic) per master/controller, driven byConnected/Reconnected/Disconnectedevents. - Register the new connectivity binary sensor during
binary_sensorplatform setup. - Expand the GitHub Actions lint workflow to run for both Python 3.13 and 3.14.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
custom_components/vantage/binary_sensor.py |
Adds an event-driven connectivity binary sensor entity per master and wires it into platform setup. |
.github/workflows/lint.yml |
Runs linting in a matrix across Python 3.13 and 3.14. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Owner
Author
|
Superseded by upstream PR loopj#378 (same branch). This fork-internal PR was only for the Copilot review pass. |
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.
Why
The integration has no entity that reflects whether the Vantage controller (the InFusion master) is reachable. Existing entities only drop to
unavailableas their individual object polls fail, staggered, so there is no single prompt signal that the controller itself is offline (powered off, crashed, or network-isolated). That makes it hard to alert on or automate around a controller outage.How it is implemented
Adds a
binary_sensorper master (vantage.masters),VantageControllerConnectivityEntity:device_class: connectivity,entity_category: diagnostic, attached to the controller device.Connected/Reconnected(on) andDisconnected(off) inasync_added_to_hass.offwhile disconnected, giving one clear signal independent of per-object availability.unique_idis{vid}:connectivity, consistent with the existing "object id plus optional suffix" convention.Also adds Python 3.14 to the lint matrix (current Home Assistant supports 3.14).
Note on detection latency: the events already exist in the pinned aiovantage, so this entity works as-is, but prompt detection depends on aiovantage surfacing
Disconnectedquickly. A companion aiovantage change (a read timeout on the event stream) brings a hard power-off down from about 15 minutes to about 2 minutes.How it was tested
Validated against a real InFusion controller (with the companion aiovantage read-timeout fix applied), correlating the entity against ground-truth ICMP reachability across several power-off / power-on cycles:
offabout 2 minutes after the controller becomes unreachable, and stays available (notunavailable).onwithin seconds of the controller returning.Lint (ruff check, ruff format, pyright strict on 3.13 and 3.14) and hassfest run on this PR.