PLEG control of Sonos


New to PLEG so hope this is not too much of a stupid question! I posted a question previously about initiating a one time switch on of radio in the morning. I think I now get how to implement this logic in PLEG, however what I failed to mention is that the action is to start sonos playing a favourite radio station. This involves passing a few variables to Sonos. Can I do this directly in PLEG, or do I have to set up my scene separately and trigger the scene from PLEG?


If the actions to control Sonos are available in the Advanced Tab of a Scene … they can be called from PLEG and you can pass variables to them as part of the arguments.

Yes they are… so if I want to pass the following variables:

URIToPlay=FR:BBC Radio 4

Would I just specify them in the condition section?

I am also a little confused about whether I have to specify anything in Action section… I have read the details on your site, but its not completely clear to me if I have to put something in there to make something happen, or if that is only for certain scenarios?

The Actions are where you actually send commands to other devices as part of your logic. It’s like setting up a scene. In the case of Sonos … it would be similar to setting up a Scene using the Advanced tab to access Sonos commands. The advanced tab allows for the specification of commands that take arguments that are not graphically settable via the device page.

If you had a Variable Container Plugin with the following variables:

You would bind these in PLEG using the Device Properties Input … I would use PLEG variable names with the same name.

Maybe a Wakeup timer called AlarmClock for 6:00AM and a Weekday schedule (M-F for most westerners).

A condition:
PlayAlarm AlarmClock and Weekday

Then in the Actions for PlayAlarm you would select the Sonos play command and set the arguments:

You could add logic to increase the volume over timer.

I was able to get my PLEG conditions set via help from another thread (thanks).

One of the actions I want is for Sonos to play audio based on alarm disarming.

On a normal Vera scene, without Pleg, I have to use the Advanced tab to get Sonos to do anything; I can’t get it by simply clicking the icons on the scene builder.

Via PLEG, I choose the Action tab. The scene builder is there, and Sonos has the “ghostbusters” emblem on top of it (like it does on the normal scene builder). I click the Advanced tab, select the Sonos, click Add, but nothing happens. This is with both Firefox and IE.

Any idea why this is?

Try adding any action from the device page first … you can always remove it from the advanced page.