Hack · Chromecast and Chromecast with Google TV
Cast and control it from your own script
Find it on the network by mDNS and send it a video URL, a pause command or a volume change, all over the local Cast protocol.
Finding the Chromecast on your network and sending it a video URL, a pause command or a volume change, all from your own Python script, over the local network.
Does it work on mine
Chromecast and Chromecast with Google TV's models, not checked against this hack specifically yet
What it costs
pychromecast relies on mDNS, so the README's own network requirements matter before anything else: multicast UDP must be forwarded by your Wi-Fi router, the machine running the script must allow inbound and outbound traffic on port 5353, and it must sit on the same subnet as the Chromecast, since mDNS packets are not routed across subnets. When any of that is not possible, the README's fallback is to pass known IP addresses straight to the discovery functions instead of relying on mDNS.
Steps
- Install the library from PyPI with
pip install PyChromecast, per its own PyPI listing; the project's README lists requests, protobuf and zeroconf as its dependencies. - Call
get_listed_chromecasts()with the device's friendly name to find and connect to it, as shown in the same README's quick start. - Call
cast.wait()to wait for it to be ready, then send a video URL or control playback and volume through its media controller, per the same README. - If a media center device nearby misbehaves over CEC, add it to pychromecast's
IGNORE_CEClist, as documented in the same README.
Risks and undo
Nothing is flashed on the device. The
worst case the README describes is a CEC incompatibility with another
media center device, worked around with IGNORE_CEC rather than fixed
on the Chromecast itself. Undo is closing the script and casting from
the official app exactly as before.
Projects used
Sources
- pychromecast README
Guide· home-assistant-libs· Read on Oct 26, 2026
- PyChromecast on PyPI
Guide· PyPI· Read on Oct 26, 2026