Skip to content

Instantly share code, notes, and snippets.

@rhyskeepence
Created June 25, 2017 13:50
Show Gist options
  • Save rhyskeepence/a709208e4d66211698f70abdd02af65f to your computer and use it in GitHub Desktop.
Save rhyskeepence/a709208e4d66211698f70abdd02af65f to your computer and use it in GitHub Desktop.
Limit sonos volume
# 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