feat: entry.runtime_data ShieldConnectionManager lifecycle — passive when ADB unavailable, close on HA stop + unload; adb_session adapter docstring

This commit is contained in:
James Mackay committed 2026-10-08 08:59:07 +01:00
1 parent ec2db2ae58
commit 63f76f5328
3 files changed
+94 -6

No files matched your search

@@ -115,6 +115,21 @@ class ShieldConnectionManager:
self._failures = 0
self._down_since = False # listeners already told the connection is down
# ── One-shot connection test (pairing UX) ──
@staticmethod
async def test_connect(host: str, port: int, key_path: str) -> bool:
"""Single-shot ADB connect used by the config-flow pairing step.
Throws away the poller immediately — the config flow runs before any
entry exists, so it must never touch an entry's persistent socket.
"""
poller = AdbMediaSessionPoller(host, port, key_path)
try:
return await poller.connect()
finally:
await poller.disconnect()
# ── Introspection (thin views for entities) ──
@property