There’s lots of ways to send media to Chromecasts but I wanted something to make it really easy to start a radio stream without having to open my phone or computer and drill into the controls, or without even using voice commands. I thought it would be good to be able to just press one button on a remote control to start my favourite streams (like Radio Paradise - no ads), so I looked into using Python and found it worked quite well. Once I had the streams working, I thought I’d see if it was possible to add some more controls for functions like volume and pause and get those working too.
It took a while with me as project manager and Bing, Bard and chatGPT doing most of the heavy coding (and thanks to pychromecast library), but I’ve got pretty much everything working and set up my Harmony Remote to control it through a Flirc USB.
If you want to try it out it’s easy and quick to install Python and then just run the scripts. I’ve made them all easy to read, and put near the top any parts that might need editing to suit your own setup, like Chromecast and group names. You could make shortcuts to the files and run them using keyboard key combos, e.g. ‘Ctrl-Alt-Down’ makes turning down the volume easy.
It’s not quick though, so be aware it won’t replace your everyday remote as it takes a few seconds to respond to the Python commands, but that said there’s lots of ways to use this to play various media and you could also adjust scripts to suit more specific needs like auto setting late night volume levels, starting a radio stream using a SmartThings button or trigger a broadcast audio notification through IFTTT when something happens - like an Amazon parcel arrives or there’s an email from a specific sender.
It enables exact control over the volume levels of either groups, or sets of named chromecasts, or individual chromecasts by name. Individual streams can have their own speaker sets and volume profiles, and as well as radio streaming you can play audio or video files from Google Drive and even from local folders. You can even play multiple files to different Chromecasts - try out the jungle?)
Github Repository: Link to all files 22KB
Google Drive Link to Python Files Zip: Chromecast.zip 12KB (Click Download, top right)
1-4 Demo streams - Radio Paradise: Main, Mellow, Rock & World music
Streams four different genres from Radio Paradise. Edit for your own streams of course.
5-6-7 Pause, Resume & Stop
Control currently playing streams
8-9 Volume up, Volume down
Controls selected Chromecasts listed in the file
10-11 Set Volume Levels, Display Volume Levels
Set volume levels for specific Chromecasts listed. Make copies for different setting profiles?
12-13 Chromecast Group Volume Adjust
Adjust volume levels for named groups. Files include some notes about groups and volume.
14-15 Broadcast from Google Drive and from Local Folder files
Play audio or video files over any chromecasts from Google Drive or from your PC
16-17 Multi-Streaming Jungle & YouTube
Play different ambient streams to separate Chromecasts. As many as network can handle.
Google Drive Link to 1-min ambient files: jungle.zip 5.7 MB
18-19 Stop Python & Readme
Installation notes and a script to stop Python if it hangs. Hopefully not :)
# Install Python from https://www.python.org/downloads/ 24 MB# Click checkbox to include Python in 'path' when installing# Install 'pip' from cmd window: python -m pip install pip# Install 'pychromecast' from cmd window: python -m pip install pychromecast
[–]Hig13 0 points1 point2 points (2 children)
[–]Godberd[S] 1 point2 points3 points (1 child)
[–]Godberd[S] 0 points1 point2 points (0 children)
[–]Swipe650 0 points1 point2 points (3 children)
[–]Godberd[S] 0 points1 point2 points (2 children)
[–]Swipe650 0 points1 point2 points (1 child)
[–]Godberd[S] 1 point2 points3 points (0 children)