Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. # pip install soco
  2.  
  3. import soco
  4. import time
  5.  
  6. start_time = time.time()
  7. sonos_zones = list(soco.discover())
  8.  
  9. while True:
  10. time.sleep(0.25 - ((time.time() - start_time) % 0.25))
  11.  
  12. for zone in sonos_zones:
  13. current_volume = zone.volume
  14. if current_volume > 40:
  15. print("Current volume is {}, reducing to 25".format(current_volume))
  16. zone.volume = 25
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement