Verify Roku HDMI selection through active input status
This commit is contained in:
1 parent
df631c921c
commit
b888fa5bc7
2 files changed
+16
-3
No files matched your search
+15
-2
@@ -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 "<app id=\"$input\""
|
||||
}
|
||||
|
||||
send() {
|
||||
reply=$(cec "$@")
|
||||
if printf '%s\n' "$reply" | grep -qi 'Tx, Not OK'; then
|
||||
@@ -57,8 +66,12 @@ case "$1" in
|
||||
printf 'requested_source=%s\n' "$address"
|
||||
sleep 1
|
||||
status
|
||||
if [ "${source:-unknown}" != "$address" ]; then
|
||||
echo 'Kodi source selection was not confirmed by HDMI-CEC.' >&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
|
||||
;;
|
||||
|
||||
@@ -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)
|
||||
Reference in new issue
Block a user