Library for MicroPython to communicate with the Google Chromecast.
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pichromecast-0.2.tar.gz
(3.9 kB
view hashes)
Built Distribution
Close
Hashes for pichromecast-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09a7aaf93e2b98b968dadf2bbba4e773e97ac5700fa24ace4b86d97b22749c4e |
|
MD5 | 3ecb823c072d9d5de7d6a7a54b9417b9 |
|
BLAKE2b-256 | 97e085d7bd55bd501badfd0c0d12e6e9d8113a3b349e79d0343877591b794e16 |