Nesting Scenes vs "virtual switches"

I have a few scenes that are exactly the same except for one or two lines. I’d like to modularize these.

For example, I have a scene that turns the Sonos systems and stereo systems on and plays one radio station. I then have another scene that does all the same steps (4 sonos, two stereos, turn them on, set them to point to the right sonos, set the right input on stereos, make sure they are not muted, set default volume etc) except for the step of playing the radio station.

I’d like to make this more portable so it’s easier to make changes (just once!).

I want to create a scene called “Audio On” and then another scene that calls “Audio On” and then sets the station to be played. Obviously Audio On would need to complete first before the next line in the scene ran.

I’ve found LUUP code that shows this in the wiki:

 luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1", "RunScene", {SceneNum = "5"}, 0)

I’ve also been reading on various Virtual Switch plugins, one called multi-switch etc.

Would these be even better ways to do this (keeping in mind the rumored UI7 update in a few months)? Which switch should I play with first, or should I just do these as standard scenes, and use the Luup code to call the startup scene I need?

The Start Scene LUUP call does exactly that … it starts the scene … It does not wait for the scene to complete.
Depending on what the scene does … the calling scene could finish before the scene that you called.

[quote=“RichardTSchaefer, post:2, topic:179003”]The Start Scene LUUP call does exactly that … it starts the scene … It does not wait for the scene to complete.
Depending on what the scene does … the calling scene could finish before the scene that you called.[/quote]

So is this a place I should use one of the Virtual Switch devices? Which one is most appropriate for this task?

You can use the Variable Container plugin to hold your variable data.
Then use a Virtual Switch to trigger your Common Code

To activate … set the Variable in the VariableContainer then Turn on the Virtual Switch

Then have your Common code trigger based on the Virtual Switch being set … You can read the appropriate data from the Variable Container.

I prefer to do automation in PLEG … and use things like MultiSwitch to provide any needed UI.

Sorry I’m still not sure how to proceed.

I want to have a scene called “Turn Stereo on” that turns on both Yamaha’s to the proper zones, sets the correct volume level and input source to the Sonos Connect.

I want a separate scene called “Sonos on and source” that groups all sonos devices and points them to one device as the zone controller.

I suppose both the “Stereo On” and “sonos on” scenes could be combined to one scene. These two are independent so can also run separately in parallel. But at the end I want to tell the Sonos to play a specific URI that is a variable – one of my 5 preset favorites.

So what would I do in the “Sonos on and source” scene to tell the Sonos zone to play a specific URI that is read from a variable container?

I do some with PLEG based on which alarm code I enter that determines what audio to play, but I also have other way so trigger audio that don’t require PLEG (certain NFC tags precoded for certain stations).

Thanks