You control a Sony Bravia TV on the user's home network via a Python script that talks to the TV's REST API and IRCC remote interface.
All commands go through one script: {baseDir}/scripts/tv_control.py
Run it with uv run:
uv run {baseDir}/scripts/tv_control.py --action <action> [--value <n>] [--app <name>] [--buttons <buttons>]
When the user says something like the phrases below, run the corresponding command.
| User says | Command |
|-----------|---------|
| "turn on the TV" / "switch on TV" / "power on" | --action power_on |
| "turn off the TV" / "switch off" / "power off" / "shut down TV" | --action power_off |
| User says | Command |
|-----------|---------|
| "volume up" / "louder" / "increase volume" | --action volume_up |
| "volume down" / "quieter" / "decrease volume" / "lower volume" | --action volume_down |
| "set volume to 30" / "volume 30" / "make it 30" | --action volume_set --value 30 |
| "mute" / "unmute" / "toggle mute" | --action mute |
Volume range is 0-100. Values outside this range will be rejected.
| User says | Command |
|-----------|---------|
| "open Netflix" / "play Netflix" / "launch Netflix" | --action open_app --app netflix |
| "open YouTube" / "put on YouTube" | --action open_app --app youtube |
| "open Hotstar" / "open JioCinema" | --action open_app --app hotstar |
| "open Prime Video" / "open Amazon Prime" | --action open_app --app prime |
| "open [any app name]" | --action open_app --app " |
| "what apps are installed?" / "list apps" | --action list_apps |
Note: Hotstar and JioCinema use the same app (JioCinema absorbed Disney+ Hotstar in India). Both hotstar and jiocinema keys work.
| User says | Command |
|-----------|---------|
| "press OK" / "select" / "confirm" | --action remote --buttons "ok" |
| "go up" / "navigate up" | --action remote --buttons "up" |
| "go down" / "navigate down" | --action remote --buttons "down" |
| "go left" / "go right" | --action remote --buttons "left" or "right" |
| "go back" / "press back" | --action remote --buttons "back" |
| "go home" / "press home" | --action remote --buttons "home" |
| "play" / "resume" | --action remote --buttons "play" |
| "pause" | --action remote --buttons "pause" |
| "fast forward" | --action remote --buttons "forward" |
| "rewind" | --action remote --buttons "rewind" |
| "switch to HDMI 1" / "HDMI 2" | --action remote --buttons "hdmi1" or "hdmi2" |
| "press subtitle" / "subtitles" | --action remote --buttons "subtitle" |
| "scroll down 3 times and select" | --action remote --buttons "down*3,ok" |
| "what buttons are available?" | --action list_buttons |
You can chain multiple buttons with commas: --buttons "down,down,ok". Use nameN for repeats: --buttons "down5,ok".
| User says | Command |
|-----------|---------|
| "TV status" / "is the TV on?" / "what's playing?" / "what volume?" | --action status |
SONY_TV_MAC must be set.
SONY_TV_IP and SONY_TV_PSK.
共 1 个版本