From 49cf402bbeeb95c02827eb86652b5b8568f05e43 Mon Sep 17 00:00:00 2001 From: James Mackay Date: Thu, 8 Oct 2026 09:25:25 +0100 Subject: [PATCH] feat(pyproject): androidtvremote2 dev dependency; manager docstring covers both transports --- custom_components/nvidia_shield/connection.py | 14 +++++++++++++- pyproject.toml | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/custom_components/nvidia_shield/connection.py b/custom_components/nvidia_shield/connection.py index e4e6263..eefa81d 100644 --- a/custom_components/nvidia_shield/connection.py +++ b/custom_components/nvidia_shield/connection.py @@ -123,11 +123,23 @@ class StateStore: class ShieldConnectionManager: - """Owner of one entry's persistent ADB connection and state. + """Owner of one entry's persistent connections (both transports) + state. + + Transport A — ADB (adb_shell): the watchdog keeps a persistent socket, + pulls heartbeats and reconnects with its own backoff ladder. + Transport B — remote protocol (androidtvremote2, Phase 2): the library + owns reconnection (``keep_reconnecting`` with internal backoff), pushes + ``is_on``/``is_available``/``current_app``/``volume_info`` into the state + store, and surfaces invalid certs (device hard reset) via a reauth hook. :param poller_factory: builds the ADB poller when the watchdog starts; skipped entirely for entries without ADB (passive manager) or tests that inject a ready-to-use ``poller`` directly. + :param protocol_factory: builds the AndroidTVRemote client; instead pass + ``protocol_settings`` (host/client_name/certfile/keyfile) and the + manager builds it, or ``protocol`` directly (tests). + :param invalid_auth_callback: called when the device rejects our + certificates (hard reset) — the entry-owned reauth hook (t9). """ def __init__( diff --git a/pyproject.toml b/pyproject.toml index ea6a46a..16ea41b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,7 @@ dev = [ "pytest>=8.0", "pytest-asyncio>=0.23", "ruff>=0.4", + "androidtvremote2>=0.2.0", ] # The shared ADB helpers are vendored at # custom_components/nvidia_shield/ha_adb_common/ — the only consumed copy in