From b888fa5bc7a5e182d56fe8d28ca771edca472035 Mon Sep 17 00:00:00 2001 From: Ziad Arafat Date: Sun, 29 Nov 2026 00:42:39 -0700 Subject: [PATCH] Verify Roku HDMI selection through active input status --- bin/roku-tv | 17 +++++++++++++++-- config/skills/roku-tv/SKILL.md | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/bin/roku-tv b/bin/roku-tv index e29ea8d..a406d19 100755 --- a/bin/roku-tv +++ b/bin/roku-tv @@ -38,6 +38,15 @@ status() { printf 'tv_power=%s\nactive_source=%s\nkodi_source=%s\n' "${power:-unknown}" "${source:-unknown}" "$address" } +roku_reports_kodi() { + case "$address" in + [1-4].0.0.0) input="tvinput.hdmi${address%%.*}" ;; + *) return 1 ;; + esac + active_app=$(curl -fsS --max-time 4 http://10.56.5.46:8060/query/active-app 2>/dev/null) || return 1 + printf '%s\n' "$active_app" | grep -Fq "&2 + if [ "${source:-unknown}" = "$address" ]; then + printf '%s\n' 'source_verified_by=cec' + elif roku_reports_kodi; then + printf '%s\n' 'source_verified_by=roku_active_app' + else + echo 'Kodi source selection could not be confirmed.' >&2 exit 1 fi ;; diff --git a/config/skills/roku-tv/SKILL.md b/config/skills/roku-tv/SKILL.md index 8130a39..310c23e 100644 --- a/config/skills/roku-tv/SKILL.md +++ b/config/skills/roku-tv/SKILL.md @@ -9,6 +9,6 @@ Run `~/.dotfiles/bin/roku-tv` on a machine with the configured `bounsweet` SSH a - `roku-tv kodi` asks the TV to wake and selects Bounsweet's HDMI input. - `roku-tv standby` sends standby directly to the TV. Use when the user asks to turn off the TV. -Use the action that matches the user's request. An active source matching `kodi_source` confirms CEC source selection. If the source is `unknown`, report that the selected source could not be confirmed. If the Roku still reports `0.0.0.0`, check **Settings → System → Control other devices (CEC) → 1-touch play** on the TV before retrying. CEC does not provide Roku Home navigation or app launching via this tool. +Use the action that matches the user's request. An active source matching `kodi_source` confirms CEC source selection. A successful switch reports `source_verified_by=cec` or `source_verified_by=roku_active_app`. The latter uses a read-only Roku LAN query when the CEC broadcast does not confirm the switch. If the command fails, report that source selection was unconfirmed. If the Roku still reports `0.0.0.0`, check **Settings → System → Control other devices (CEC) → 1-touch play** on the TV before retrying. CEC does not provide Roku Home navigation or app launching via this tool. [Hardware and troubleshooting notes](https://wiki.godemperordoge.org/homelab/reference/clients/kodi-bounsweet#roku-tv-hdmi-cec)