Variable substitution of Sonos Volume action

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

Variable substitution of Sonos Volume action


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 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" % (, current_volume, new_volume))

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest