I modified the current version in my setup to allow for dynamic Volume editing (temporary decrease volume and restore on a doorbell or front door entry).
I edited the this part of sonos.py adding eval(self.plugin.substitute( and the new_volume < 0 condition.
Now I store my current Sonos player volume as variables and have Sonos Volume Actions that make calculations to decrease the current volume and then restore it after a set time.
I hope you can add this permanently.
- Code: Select all
elif action == "Volume":
self.plugin.debugLog("Sonos Action: Volume")
current_volume = dev.states["ZP_VOLUME"]
new_volume = eval(self.plugin.substitute(pluginAction.props.get("setting")))
if new_volume < 0:
new_volume = 0
self.SOAPSend (zoneIP, "/MediaRenderer", "/RenderingControl", "SetVolume", "<Channel>Master</Channel><DesiredVolume>"+str(new_volume)+"</DesiredVolume>")
indigo.server.log(u"ZonePlayer: %s, Current Volume: %s, New Volume: %s" % (dev.name, current_volume, new_volume))