Jump to content
c4forums | The Control4 Community

Changing Sonos music channels using variables


ScottGA

Recommended Posts

I have a Sonos Connect tied in to our house-wide speaker system using an C4 audio matrix with an EV driver.  Using a button on 6-button keypads in various rooms, we can cycle through a pre-set list of 6+ music channels (primarily Pandora stations and XM Sirius Radio stations that have been saved as Sonos Favorites).  If I want to update the list of music channels that get cycled through, I have to update programming for that keypad button in each room.

 

It would be a heck of a lot easier to do it in a macro by directly setting the Sonos Current_Station system variable using a user variable with script such as:

 

  ? If Variables->Music Playlist EQUAL TO 1

         Set Variables->Desired Sonos Station = "68 - Spa"

  ? If Variables->Music Playlist EQUAL TO 2

         Set Variables->Desired Sonos Station = "2 - SiriusXM Hits 1"

 Set Equipment Closet->Main System Sonos->Current_Station to the value of Variables->Desired Sonos Station

 

And then I could just have the value of that variable change with the keypad button press regardless of which room that keypad is located in.   

 

I set that the system variable is changing as desired using the above script.  However, there is no actual change in the Sonos channel that is playing.  

 

Am I missing something or is there another way to do this?

 
Link to comment
Share on other sites


I would create a single macro and apply it to each keypad button. Then create a second string or number variable before executing the macro.

 would look like this

 

On Button Press

     Set variable to Living Room

     Execute macro

 

Macro Programming

    If variable is 1

          IF variable is living room

                  play favorite 1 in living room

           if variable is master bed

                  play favorite 1 in master bed

           Add 1 to number variable

  If Variable is 2

IF variable is living room

                  play favorite 1 in living room

           if variable is master bed

                  play favorite 1 in master bed

Etc to the number of playlist

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...