Variable substitution of Sonos Volume action

Posted on
Sat Aug 12, 2017 4:34 am
elov offline
Posts: 20
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))

Posted on
Thu Aug 22, 2019 12:03 pm
elov offline
Posts: 20
Joined: Dec 27, 2016

Re: Variable substitution of Sonos Volume action

I'd like to bump this request Nick.

I've been manually modifying this line once you release an update for the last 2 years. Would be great if you could add this functionality in your releases.

Posted on
Sat Mar 28, 2020 9:29 am
nlagaros offline
Posts: 1646
Joined: Dec 20, 2010

Re: Variable substitution of Sonos Volume action

This will be in the next release.

Posted on
Sun May 03, 2020 10:11 am
wideglidejrp offline
User avatar
Posts: 555
Joined: Jan 15, 2012
Location: Danbury, CT

Re: Variable substitution of Sonos Volume action

I see in the release notes that v1.0.17 includes "Variable substitution for Volume and Group Volume actions.". What does that mean? How do you use this functionality? I do not see anything new in the plugin actions menu.

John R Patrick
Author of
Home Attitude

Posted on
Mon May 04, 2020 9:01 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Variable substitution of Sonos Volume action


Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon May 04, 2020 11:16 am
wideglidejrp offline
User avatar
Posts: 555
Joined: Jan 15, 2012
Location: Danbury, CT

Re: Variable substitution of Sonos Volume action

Does this mean instead of entering a value for a zone player volume, I can enter %%v:living_room_volume%% assuming that variable has a value between 0 and 100?

John R Patrick
Author of
Home Attitude

Posted on
Tue May 05, 2020 8:11 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Variable substitution of Sonos Volume action

I don't know since I don't use the plugin, but why don't you try it and see? And, it should be the ID of the variable, not the name...

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue May 05, 2020 8:24 am
wideglidejrp offline
User avatar
Posts: 555
Joined: Jan 15, 2012
Location: Danbury, CT

Re: Variable substitution of Sonos Volume action

Ok, now I get it. Thanks. I had tried it before asking the question, but using name instead of ID. I should have known better because I am using Python scripts to control thermostats. I tried again with the ID and it works perfectly. This is a really great addition to the functionality of the Sonos plugin. I will establish a variable for each Sonos player. I can think of many uses. There are probably other variables which could be useful. What I am understanding is that Indigo has enabled this ability and it can work for any variable if the plugin developer enables it. Thanks.

John R Patrick
Author of
Home Attitude

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests