PiChromecast
Library for MicroPython to communicate with the Google Chromecast.
Install
Tools > Manage packages...
or copy and paste code
https://github.com/GitHub30/pichromecast/blob/main/pichromecast.py
Usage
from pichromecast import play_url
play_url('https://nyanpass.com/nyanpass.mp3', '192.168.10.101')
Connect wifi and play
import network
import time
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect("aterm-SSID-g", "YOUR_PASSWORD")
while not wlan.isconnected() and wlan.status() >= 0:
print("Waiting to connect:")
time.sleep(1)
from pichromecast import play_url
play_url('https://nyanpass.com/nyanpass.mp3', '192.168.10.101')
Lookup host IP
#pip install pychromecast
import pychromecast
services, browser = pychromecast.discovery.discover_chromecasts()
pychromecast.discovery.stop_discovery(browser)
print(services)
[CastInfo(services={ServiceInfo(type='mdns', data='Google-Home-Mini-3b0a32dc5803130351919f8a286e406f._googlecast._tcp.local.')}, uuid=UUID('3b0a32dc-5803-1303-5191-9f8a286e406f'), model_name='Google Home Mini', friendly_name='書斎', host='192.168.10.101', port=8009, cast_type='audio', manufacturer='Google Inc.')]
or use MicroPython MDNS
Demo
Metadata
Release files for pichromecast 0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pichromecast-0.4.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pichromecast-0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.0 kB
Release files / pichromecast-0.4.tar.gz
| Download URL | pichromecast-0.4.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d5ef7e47192bd88896599b1c358d354dfe0bd04eebd4b72ef5ab5fc0a744932a
|
|
BLAKE2b-256 checksum How to use checksums |
a5a8c5d1eb183c9a525cd0b02250bdd78c78a020fb73d90b76ec456542df6e0c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / pichromecast-0.4-py3-none-any.whl
| Download URL | pichromecast-0.4-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3e70a84fbc15e9af2845fad2c9e93edccea04d47b950d3181834b816fe47e564
|
|
BLAKE2b-256 checksum How to use checksums |
e7ee52a75cfd7cb7374c7d2fc99481676be2bb9039b6c00a9bcd86f6ff8783f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|