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.4.tar.gz
(3.9 kB
view details)
Built Distribution
File details
Details for the file pichromecast-0.4.tar.gz
.
File metadata
- Download URL: pichromecast-0.4.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5ef7e47192bd88896599b1c358d354dfe0bd04eebd4b72ef5ab5fc0a744932a |
|
MD5 | 7f4738be8ca6c2a0401de2ee942634c9 |
|
BLAKE2b-256 | a5a8c5d1eb183c9a525cd0b02250bdd78c78a020fb73d90b76ec456542df6e0c |
Provenance
File details
Details for the file pichromecast-0.4-py3-none-any.whl
.
File metadata
- Download URL: pichromecast-0.4-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e70a84fbc15e9af2845fad2c9e93edccea04d47b950d3181834b816fe47e564 |
|
MD5 | 2ac7b02423991c561c8de91fe5ed3803 |
|
BLAKE2b-256 | e7ee52a75cfd7cb7374c7d2fc99481676be2bb9039b6c00a9bcd86f6ff8783f5 |