fix: flow VERSION=2 for new entries; optional ENTER gains the ADB keyevent-66 fallback; CI installs androidtvremote2 for the real-library tests (F4, F5, F6)

This commit is contained in:
James Mackay committed 2026-10-08 10:12:12 +01:00
1 parent 8462ad494c
commit 5f8c3290cc
6 files changed
+50 -6

No files matched your search

@@ -96,7 +96,7 @@ def _build_selectors():
class NvidiaShieldConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
"""Handle a config flow for Nvidia Shield."""
VERSION = 1
VERSION = 2
def __init__(self):
self._user_data = {}
@@ -451,6 +451,12 @@ class ShieldConnectionManager:
return False
return await self._poller.send_digit_keyevent(digit)
async def send_enter_key(self) -> bool:
"""ENTER via the ADB keyevent path (KEYCODE_ENTER = 66, §7 fallback)."""
if not self.available:
return False
return await self._poller.send_enter_keyevent()
# ── Lifecycle ──
async def async_start(self) -> None:
@@ -174,6 +174,14 @@ class AdbClientBase:
_LOGGER.debug("ADB digit keyevent %d (%s)", 7 + int(digit), digit)
return result is not None
async def send_enter_keyevent(self) -> bool:
"""Send ENTER via `input keyevent` (KEYCODE_ENTER = 66) — the ENTER
fallback for the §7 channel sequence."""
result = await self.shell("input keyevent 66")
if result is not None:
_LOGGER.debug("ADB ENTER keyevent (66)")
return result is not None
async def bring_to_foreground(self, package: str) -> bool:
"""Bring an app to the foreground using monkey command."""
result = await self.shell(
@@ -834,9 +834,15 @@ class NvidiaShieldMediaPlayer(MediaPlayerEntity):
media={"media_content_id": digit, "media_content_type": "channel"},
)
await asyncio.sleep(delay)
if send_enter:
_LOGGER.debug("play_media(channel): optional ENTER key sent")
await self._manager.send_protocol_key("KEYCODE_ENTER")
if (
send_enter
and self._manager is not None
and not await self._manager.send_protocol_key("KEYCODE_ENTER")
):
# ENTER fallback chain: protocol key → ADB keyevent 66.
# (No legacy-entity tier: the external androidtv_remote has
# no ENTER service to delegate to.)
await self._manager.send_enter_key()
except asyncio.CancelledError:
raise