Sonos Plugin Setup

Posted on
Thu Jan 14, 2016 9:08 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Sonos Plugin Setup

nlagaros wrote:
Jay/Matt - is there anything I can do to expose the device name? I'm not sure it is possible, but please advise.

Yes. It is a bit hackish, but try the the following. First in your Actions.xml <ConfigUI> create a hidden <Field> to hold a description text value:

Code: Select all
         <Field id="description" type="textfield" hidden="true">
            <Label>runtime calculated</Label>
         </Field>

Next, in your plugin's validateActionConfigUi method have it calculate the UI description you want displayed and stuff that into the "description" value:

Code: Select all
   def validateActionConfigUi(self, valuesDict, typeId, devId):
      errorsDict = indigo.Dict()

      # Calculate a good UI description based on all of the action values.
      valuesDict[u"description"] = u"some runtime calculated description; you can lookup the device name and use it here"

      if len(errorsDict) > 0:
         return (False, valuesDict, errorsDict)
      return (True, valuesDict)

Note that this won't automatically add good descriptions for all the actions already in someone's database, but as they open and save out of the action dialogs the descriptions should be filled in and then they are cached off and saved in the database.

Image

Posted on
Thu Jan 14, 2016 9:20 am
wideglidejrp offline
User avatar
Posts: 555
Joined: Jan 15, 2012
Location: Danbury, CT

Re: Sonos Plugin Setup

I don't understand this precisely but I get the idea and can see how such modifications could be quite helpful. Having to open and save out of the action dialogs is a small price to pay for the benefits.

John R Patrick
Author of
Home Attitude

Posted on
Fri Jan 15, 2016 9:32 am
nlagaros offline
Posts: 1646
Joined: Dec 20, 2010

Re: Sonos Plugin Setup

I gave this a shot and it did not work. In the Action Settings editor, when I click "Save", I get the error: "Error validating fields. Hover of the red field labels above to see the error reason." There is nothing in to hover over as I don't have any other fields in the ConfigUi for the action. There are no errors in the Event Log. Also -- for actions that require no additional Action Settings, the user must Edit a blank window and hit save for this "hack" to work. Unfortunately not ideal in all circumstances.

matt (support) wrote:
nlagaros wrote:
Jay/Matt - is there anything I can do to expose the device name? I'm not sure it is possible, but please advise.

Yes. It is a bit hackish, but try the the following. First in your Actions.xml <ConfigUI> create a hidden <Field> to hold a description text value:

Code: Select all
         <Field id="description" type="textfield" hidden="true">
            <Label>runtime calculated</Label>
         </Field>

Next, in your plugin's validateActionConfigUi method have it calculate the UI description you want displayed and stuff that into the "description" value:

Code: Select all
   def validateActionConfigUi(self, valuesDict, typeId, devId):
      errorsDict = indigo.Dict()

      # Calculate a good UI description based on all of the action values.
      valuesDict[u"description"] = u"some runtime calculated description; you can lookup the device name and use it here"

      if len(errorsDict) > 0:
         return (False, valuesDict, errorsDict)
      return (True, valuesDict)

Note that this won't automatically add good descriptions for all the actions already in someone's database, but as they open and save out of the action dialogs the descriptions should be filled in and then they are cached off and saved in the database.

Posted on
Sat Sep 17, 2016 7:47 pm
rgspb offline
Posts: 217
Joined: Apr 24, 2009
Location: Florida

Re: Sonos Plugin Setup

I just added a second Sonos Play3 and created a stereo pair. Prior to this my setup was working with the single Sonos Play3. Now that I've got the pair, using the same name, I'm getting this error:

Sep 17, 2016, 9:38:10 PM
Action Group Ocean On Sonos
Sonos Error Error in plugin execution ExecuteAction:

Traceback (most recent call last):
File "plugin.py", line 153, in actionZP_LIST
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Sonos.indigoPlugin/Contents/Server Plugin/Sonos.py", line 1373, in actionDirect
UnboundLocalError: local variable 'CoordinatorIP' referenced before assignment

Not sure what I'm doing wrong!

Who is online

Users browsing this forum: Google [Bot] and 11 guests

cron