Variable substitution of Sonos Volume action

Posted on
Sat Aug 12, 2017 4:34 am
elov offline
Posts: 10
Joined: Dec 27, 2016

Variable substitution of Sonos Volume action

Hi,

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))

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests