Simplified Sonos Station Manager

@stephack After messing around, I have added a couple of lines of code to your Virtual Container and Virtual Momentary Switch that can be used as a simplified Sonos Station Manager. Using the parent/child relationship, I can trigger Sonos PlayTrack events based on one single parent attribute changing, and then create unlimited child devices without having to modify any code, apps, or other devices. Simply create a child device and set the Station uri inside that child device configuration. When the device is turned on momentarily, it changes the parent's uri to match the child's uri. An app then looks for a change to the parent apps uri only and acts upon it. I wonder if you or @Cobra might consider this method to add to your apps so that it is cleaner and can be used by the community.

Add to Virtual Container:
attribute "uri", "String" //INSIDE DEFINITION

Add to Virtual Momentary Switch:
attribute "uri", "String" //INSIDE DEFINITION

  input "trackuri", "String", title: "Station URI",  defaultValue: false,  displayDuringSetup: true, required: false //INSIDE PREFERENCES

parent.sendEvent(name: "uri", value: trackuri, isStateChange: true) //INSIDE THE PUSH() STATEMENT

A rule (wc rule currently, but want to convert to RM or other) is triggered by a change to parent.device.uri and then issues a command to sonos to playtrack "parent.device.uri".

I would appreciate your help or guidance getting this logic out of WC and into RM or another supported app. It is very simple and what I like is the speed at which i can create new stations versus other options.

Take a look in my github test folder below.
I have a newer Vcontainer driver and Sonos Preset Control App that should accomplish what you need. I haven't had time to complete it and setup can be a bit wonky. PM me directly if you have questions as I have no plans to release this officially anytime soon.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.