google-tv
This skill controls a Chromecast with Google TV via ADB to play YouTube/Tubi or perform Google TV global-search UI automation. It runs local CLI tools (adb, uv, yt-api, scrcpy) and connects to LAN device addresses like 192.168.4.64:5555, storing .last_device.json in the skill folder.
Chromecast with Google TV Skill
CLI tooling for controlling a Chromecast with Google TV over ADB. It plays YouTube or Tubi directly, and falls back to Google TV global search for other streaming apps.
Requirements
- macOS/Linux host with
adbanduvon PATH - Python 3.11+
- Optional:
yt-apiCLI for resolving YouTube titles to video IDs
Quick start
./run status --device 192.168.4.64 --port 5555
./run play "7m714Ls29ZA" --device 192.168.4.64 --port 5555
./run play "family guy" --app hulu --season 3 --episode 4 --device 192.168.4.64 --port 5555
./run pause --device 192.168.4.64 --port 5555
./run resume --device 192.168.4.64 --port 5555
Commands
status: showadb devicesoutputplay <query_or_id_or_url>: play via YouTube, Tubi, or global-search fallbackpause: send media pauseresume: send media play
Device selection
The CLI accepts --device (IP) and --port (ADB port).
- If only one of
--deviceor--portis provided, the other is pulled from cache when available. - If neither is provided, the tool uses the last successful device from
.last_device.json. - If no cache exists, it attempts ADB mDNS discovery and uses the first result.
- No port scanning is performed. Only explicit, cached, or mDNS-provided ports are tried.
Content routing
- If
playlooks like a YouTube ID or URL, it launches YouTube directly. - If it looks like a Tubi URL, it launches Tubi directly.
- Otherwise it tries to resolve the query to a YouTube ID with
yt-api. - If that fails and
--app,--season, and--episodeare provided, it uses global search.
Global search fallback
Global search is implemented in play_show_via_global_search.py. It expects the device to already be connected by the main CLI and only runs UI automation.
Use it by providing --app, --season, and --episode to play:
./run play "family guy" --app hulu --season 3 --episode 4 --device 192.168.4.64 --port 5555
Environment variables
CHROMECAST_HOST: default device IPCHROMECAST_PORT: default ADB portYOUTUBE_PACKAGE: YouTube app package override (defaultcom.google.android.youtube.tv)TUBI_PACKAGE: Tubi app package override (defaultcom.tubitv)
Caching
The last successful device is stored in .last_device.json in this folder:
{"ip": "192.168.4.64", "port": 5555}
Tests
uv run test_google_tv_skill.py
uv run test_google_tv_skill.py -v
uv run test_google_tv_skill.py TestYouTubeIDExtraction
Troubleshooting
- If
adb connectfails, verify the current port:adb connect IP:PORT. - If connection is refused while running interactively, the CLI will prompt for a new port and update the cache on success.