Created
June 25, 2017 13:50
-
-
Save rhyskeepence/a709208e4d66211698f70abdd02af65f to your computer and use it in GitHub Desktop.
Limit sonos volume
This file contains 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
# pip install soco | |
import soco | |
import time | |
start_time = time.time() | |
sonos_zones = list(soco.discover()) | |
while True: | |
time.sleep(0.25 - ((time.time() - start_time) % 0.25)) | |
for zone in sonos_zones: | |
current_volume = zone.volume | |
if current_volume > 40: | |
print("Current volume is {}, reducing to 25".format(current_volume)) | |
zone.volume = 25 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment