Skip to content

Add a controller connectivity binary sensor#8

Closed
ptr727 wants to merge 2 commits into
mainfrom
feat/controller-connectivity-binary-sensor
Closed

Add a controller connectivity binary sensor#8
ptr727 wants to merge 2 commits into
mainfrom
feat/controller-connectivity-binary-sensor

Conversation

@ptr727

@ptr727 ptr727 commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Why

The integration has no entity that reflects whether the Vantage controller (the InFusion master) is reachable. Existing entities only drop to unavailable as 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_sensor per master (vantage.masters), VantageControllerConnectivityEntity:

  • device_class: connectivity, entity_category: diagnostic, attached to the controller device.
  • Reflects the aiovantage event-stream connection: subscribes to Connected / Reconnected (on) and Disconnected (off) in async_added_to_hass.
  • Does not poll, so it stays available and reports off while disconnected, giving one clear signal independent of per-object availability.
  • unique_id is {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 Disconnected quickly. 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:

  • Goes off about 2 minutes after the controller becomes unreachable, and stays available (not unavailable).
  • Returns to on within seconds of the controller returning.
  • Tracks reachability with no flapping.

Lint (ruff check, ruff format, pyright strict on 3.13 and 3.14) and hassfest run on this PR.

ptr727 and others added 2 commits June 1, 2026 08:44
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>
Copilot AI review requested due to automatic review settings June 1, 2026 18:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 by Connected/Reconnected/Disconnected events.
  • Register the new connectivity binary sensor during binary_sensor platform 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.

@ptr727

ptr727 commented Jun 1, 2026

Copy link
Copy Markdown
Owner Author

Superseded by upstream PR loopj#378 (same branch). This fork-internal PR was only for the Copilot review pass.

@ptr727 ptr727 closed this Jun 1, 2026
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.

2 participants