Created
May 4, 2015 21:59
-
-
Save leroix/60fba542c5f8b4e32229 to your computer and use it in GitHub Desktop.
Getting and setting the chromecast volume
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
import sys | |
import time | |
import pychromecast | |
requested_volume = float(sys.argv[1]) if len(sys.argv) > 1 else None | |
cast = pychromecast.get_chromecast() | |
time.sleep(0.5) | |
if requested_volume != None: | |
cast.set_volume(requested_volume) | |
else: | |
print cast.status.volume_level |
What units/range is the volume? 0 to 1 or 0 to 100?
My testing is saying 0.0 to 1.0
Looks like its a double between 0 to 1. I set it at 0.45, slept 1 second, then queried, it was set at 0.44999998807907104
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Have you tried cast.wait() instead of sleeping?