Add a controller connectivity binary sensor#378
Open
ptr727 wants to merge 3 commits into
Open
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
Note
Copilot was unable to run its full agentic suite in this review.
Adds a per-controller connectivity binary sensor backed by aiovantage connection events, and extends the lint workflow to run on multiple Python versions.
Changes:
- New
VantageControllerConnectivityEntityexposing controller online/offline state viaBinarySensorDeviceClass.CONNECTIVITY. - Subscribes to
Connected/Reconnected/Disconnectedevents to update state. - Lint workflow now runs against Python 3.13 and 3.14 via a matrix.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| custom_components/vantage/binary_sensor.py | Adds connectivity binary sensor entity per Vantage Master controller. |
| .github/workflows/lint.yml | Runs pre-commit lint job across Python 3.13 and 3.14. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
BinarySensorEntity.is_on already returns _attr_is_on, so the override added nothing. State is held in _attr_is_on (set in the connection event handlers) and read through the inherited property. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 (loopj/aiovantage#373, 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.