Registry / communication / pychromecast

pychromecast

JSON →
library14.0.10pypypi✓ verified 89d ago

Python module to talk to Google Chromecast. v14.0.10 requires Python >=3.11. Active development by Home Assistant team.

pip install pychromecast
INSTALL
IMPORT
SIG · PYCHROMECAST
P
pychromecast
communicationpythonv14.0.10
Install
3.4s avg
Import
982ms
Disk
28MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v13.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 1.152s · 29.3MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 3.4s · import 0.812s · 30MB
28MB installed
● package 28MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Chromecast
✓ from pychromecast import Chromecast
✗ import pychromecast; Chromecast()
Not a top-level attribute in the package module.
get_chromecasts
✓ from pychromecast import get_chromecasts
✗ from pychromecast.discover import get_chromecasts
get_chromecasts moved to top-level in v14.
ChromecastInfo
✓ from pychromecast import ChromecastInfo

Discovers Chromecasts on the network, connects to the first found, and plays a test video.

import os import time import pychromecast casts, browser = pychromecast.get_chromecasts() if casts: cast = casts[0] cast.wait() print(cast.device.friendly_name) mc = cast.media_controller mc.play_media('http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4', 'video/mp4') time.sleep(5) browser.stop_discovery()
Debug
Known issues
breakingBreaking change in v14: optional callback arguments are now keyword-only. Passing positional callbacks will raise TypeError.
fix
Update calls to use keyword arguments, e.g., cast.register_handler(handler, is_registered=True).
affects: >=14.0.0
breakingServiceInfo class replaced with dataclass in v14. Instantiating with positional arguments breaks.
fix
Use keyword arguments: ServiceInfo(uuid=..., services=..., etc.).
affects: >=14.0.0
gotchaget_chromecasts() returns a list and a Browser object. The Browser must be stopped to avoid resource leaks.
fix
Always call browser.stop_discovery() when done, or use context manager: with pychromecast.get_chromecasts() as (casts, browser):
affects: all
gotchaCast device may not be ready immediately after get_chromecasts(). Accessing properties before wait() can cause AttributeError.
fix
Call cast.wait() before using cast.device or other attributes.
affects: all
Errors
Common errors & fixes
AttributeError: module 'pychromecast' has no attribute 'Chromecast'
Importing directly from pychromecast module without knowing the correct import path.
fix
Use from pychromecast import Chromecast or from pychromecast.controllers import Chromecast
TypeError: get_chromecasts() got multiple values for argument 'blocking'
Passing positional arguments that are now keyword-only in v14.
fix
Use keyword arguments: get_chromecasts(blocking=True, callback=my_callback)
zeroconf.BadServiceType: Service type '_googlecast._tcp.local.' is not valid
Running multiple instances of ZeroConf service or incorrect zeroconf version.
fix
Ensure only one zeroconf instance is active per process. Upgrade zeroconf to >=0.118.0.
Upgrade
Version history
14.0.10latest on PyPI · released Mar 7, 2026
Audit
Dependencies
protobufrequiredRequired for Chromecast protocol messages
zeroconfrequiredRequired for discovery
Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
pychromecast — pip install pychromecast · libregistry