20 lines
485 B
Bash
Executable File
20 lines
485 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Toggle TV power and switch to Computer (HDMI1) input when turning on
|
|
|
|
set -euo pipefail
|
|
|
|
ROKU_IP="10.0.1.93"
|
|
ROKU_ECP="http://${ROKU_IP}:8060"
|
|
|
|
# Send Power toggle
|
|
curl -s -X POST "${ROKU_ECP}/keypress/Power" > /dev/null
|
|
|
|
# Wait for TV to process the power command
|
|
sleep 5
|
|
|
|
# Switch to Computer (HDMI1) input
|
|
# This will fail silently if the TV is off, which is fine
|
|
curl -s -X POST "${ROKU_ECP}/launch/tvinput.hdmi1" > /dev/null || true
|
|
|
|
echo "TV power toggled"
|