Cannot control multiple Sonos speakers

Hi :slight_smile:
I have finally got around to fixing some of my earlier issues and one that I am stumped on is that when I have multiple Sonos speakers setup I cannot control the one I target.

Setup below

things

Thing sonos:PLAY3:blah1[udn="blah1", refresh=60, notificationVolume=25]

Thing sonos:PLAY1:blah2[udn="blah2", refresh=60, notificationVolume=25]

items

Group Sonos <player>

Player Sonos_Controller   "Controller"  (Sonos) {channel="sonos:PLAY3:blah1:control"}

Group Sonos2 <player>

Player Sonos_Controller_Kitchen   "Kitchen Controller"  (Sonos2) {channel="sonos:PLAY1:blah2:control"}

Habpanel template

<style>
   .sonosbutton {width: 90%; height: 4em; border: 0; color: white; background-color: transparent;}
   .sonosctrl {width: 90%; height: 3em; border: 0; color: white; background-color: transparent;}
   .sonosbuttontxt_white {width: 100%;height: 4em; border: 0; color: white;font-size: 10pt; background-color: transparent;}
   .sonosbuttontxt_red {width: 100%;height: 4em; border: 0; color: red;font-size: 10pt; background-color: transparent;}
   .butticon {font-size:1em;}
</style>

<div  class="row">
      <div class="col-md-3 modgrid">
         <button class="sonosctrl" style="background-size: contain; background-repeat: no-repeat;background-position: center center;font-size:40px;" 
            ng-click="sendCmd('Sonos_Controller_Kitchen', 'PREVIOUS')">
         <i class="glyphicon glyphicon-step-backward butticon" alt="Step Backward"></i>
         </button>
      </div>
      <div class="col-md-3 modgrid">
         <button class="sonosctrl" style="background-size: contain; background-repeat: no-repeat;background-position: center center;font-size:40px;" 
            ng-click="sendCmd('Sonos_Controller_Kitchen', 'PAUSE')">
         <i class="glyphicon glyphicon-pause butticon" alt="PAUSE"></i>
         </button>
      </div>
      <div class="col-xs-3 modgrid">
         <button class="sonosctrl" style="background-size: contain; background-repeat: no-repeat;background-position: center center;font-size:40px;" 
            ng-click="sendCmd('Sonos_Controller_Kitchen', 'PLAY')">
         <i class="glyphicon glyphicon-play butticon" alt="Play"></i>
         </button>
      </div>
      <div class="col-xs-3 modgrid">
         <button class="sonosctrl" style="background-size: contain; background-repeat: no-repeat;background-position: center center;font-size:40px;" 
            ng-click="sendCmd('Sonos_Controller_Kitchen', 'NEXT')">
         <i class="glyphicon glyphicon-step-forward butticon" alt="Step Forward"></i>
         </button>
      </div>
   </div>

<div  class="row">
      <div class="col-md-3 modgrid">
         <button class="sonosctrl" style="background-size: contain; background-repeat: no-repeat;background-position: center center;font-size:40px;" 
            ng-click="sendCmd('Sonos_Controller', 'PREVIOUS')">
         <i class="glyphicon glyphicon-step-backward butticon" alt="Step Backward"></i>
         </button>
      </div>
      <div class="col-md-3 modgrid">
         <button class="sonosctrl" style="background-size: contain; background-repeat: no-repeat;background-position: center center;font-size:40px;" 
            ng-click="sendCmd('Sonos_Controller', 'PAUSE')">
         <i class="glyphicon glyphicon-pause butticon" alt="PAUSE"></i>
         </button>
      </div>
      <div class="col-xs-3 modgrid">
         <button class="sonosctrl" style="background-size: contain; background-repeat: no-repeat;background-position: center center;font-size:40px;" 
            ng-click="sendCmd('Sonos_Controller', 'PLAY')">
         <i class="glyphicon glyphicon-play butticon" alt="Play"></i>
         </button>
      </div>
      <div class="col-xs-3 modgrid">
         <button class="sonosctrl" style="background-size: contain; background-repeat: no-repeat;background-position: center center;font-size:40px;" 
            ng-click="sendCmd('Sonos_Controller', 'NEXT')">
         <i class="glyphicon glyphicon-step-forward butticon" alt="Step Forward"></i>
         </button>
      </div>
   </div>

Gives the following view.

The controls on the top should control the kitchen speakers and the controls at the bottom should control the other speaker (Lets say dining room) Whats actually happening is that all controls are having an effect on the kitchen speakers

If I press pause (Already playing) and then play on the top controls I get the following entries

events.log

2018-10-27 17:12:08.860 [ome.event.ItemCommandEvent] - Item 'Sonos_Controller_Kitchen' received command PAUSE

2018-10-27 17:12:14.116 [ome.event.ItemCommandEvent] - Item 'Sonos_Controller_Kitchen' received command PLAY

2018-10-27 17:12:14.136 [vent.ItemStateChangedEvent] - Sonos_Controller_Kitchen changed from PAUSE to PLAY

2018-10-27 17:12:14.465 [vent.ItemStateChangedEvent] - Sonos_State_Kitchen changed from STOPPED to TRANSITIONING

2018-10-27 17:12:14.469 [vent.ItemStateChangedEvent] - Sonos_Controller_Kitchen changed from PLAY to UNDEF

2018-10-27 17:12:19.695 [vent.ItemStateChangedEvent] - Sonos_State_Kitchen changed from TRANSITIONING to PLAYING

2018-10-27 17:12:19.704 [vent.ItemStateChangedEvent] - Sonos_Controller_Kitchen changed from UNDEF to PLAY

Doing the same on the bottom controls yields the following

events.log

2018-10-27 17:13:56.097 [ome.event.ItemCommandEvent] - Item 'Sonos_Controller' received command PAUSE

2018-10-27 17:13:56.470 [vent.ItemStateChangedEvent] - Sonos_State_Kitchen changed from PLAYING to STOPPED

2018-10-27 17:13:56.485 [vent.ItemStateChangedEvent] - Sonos_Controller_Kitchen changed from PLAY to PAUSE

2018-10-27 17:14:06.179 [ome.event.ItemCommandEvent] - Item 'Sonos_Controller' received command PLAY

2018-10-27 17:14:06.194 [vent.ItemStateChangedEvent] - Sonos_Controller changed from PAUSE to PLAY

2018-10-27 17:14:06.421 [vent.ItemStateChangedEvent] - Sonos_State_Kitchen changed from STOPPED to TRANSITIONING

2018-10-27 17:14:06.427 [vent.ItemStateChangedEvent] - Sonos_Controller_Kitchen changed from PAUSE to UNDEF

2018-10-27 17:14:07.218 [vent.ItemStateChangedEvent] - Sonos_State_Kitchen changed from TRANSITIONING to PLAYING

2018-10-27 17:14:07.224 [vent.ItemStateChangedEvent] - Sonos_Controller_Kitchen changed from UNDEF to PLAY

Am I missing something really obvious here?

ALSO !!

Forgot to add that I CAN control volume, Mute etc. all album art etc. It is just the play, pause, next and previous commands.

The same results as posted above are also present in paper UI

Your missing a lot of the items for each Sonos. Here’s a link which goes into great detail of the items.

Keep in mind; there is a LocalCoordinator that at any given time controls a pair of speakers in a group.

Best, Jay

Thanks for that, I’ll check the link out in the morning.

I omitted a lot of the items as they are not relevant to the issue.

The second of my players is actually a stereo pair controller that I discovered is very particular in terms of control i.e. I need to specifically address “blah2” rather than “blahb” (The second player in the group)

I have a lot pairs (6x) of Play:1 speakers; here’s my items file for one of the pairs.


Player Sonos_Basement_Controller  				"Controller"                        				        { channel="sonos:PLAY1:Basement:control" }
Dimmer Sonos_Basement_Volume      				"Volume [%.1f %%]" <soundvolume>    				(Sonos) { channel="sonos:PLAY1:Basement:volume" }
Switch Sonos_Basement_Mute        				"Mute"             <soundvolume_mute>				(Sonos) { channel="sonos:PLAY1:Basement:mute" }
String Sonos_Basement_CurrentTrack				"Now playing [%s]" 			        				(Sonos) { channel="sonos:PLAY1:Basement:currenttrack" }
String Sonos_Basement_CurrentAlbumCoverArtURL	"URL [%s]"			    							(Sonos) { channel="sonos:PLAY1:Basement:currentalbumarturl" }
Switch Sonos_BasementPlayOrPause				"Basement [MAP(sonos_play_pause.map):%s]"			(Sonos)	[ "Switchable" ]
Switch Sonos_Basement_StandAlone            	"Stand Alone"               								{ channel="sonos:PLAY1:Basement:standalone" }
String Sonos_Basement_ZoneGroupID           	"Zone Group ID [%s]"               							{ channel="sonos:PLAY1:Basement:zonegroupid" }
String Sonos_Basement_ZoneName              	"Zone Name [%s]"                    						{ channel="sonos:PLAY1:Basement:zonename" }
String Sonos_Basement_Coordinator           	"Coordinator [%s]"          								{ channel="sonos:PLAY1:Basement:coordinator" }
String Sonos_Basement_Remove                	"Remove [%s]"                           					{ channel="sonos:PLAY1:Basement:remove" }
Switch Sonos_Basement_LocalCoordinator      	"Local Coordinator"                     					{ channel="sonos:PLAY1:Basement:localcoordinator" }
Switch Sonos_Basement_Stop        				"Stop Player"                     							{ channel="sonos:PLAY1:Basement:stop", autoupdate="false" }
Switch Sonos_Basement_ClearQueue      			"Clear Queue"                     							{ channel="sonos:PLAY1:Basement:clearqueue" }

Player Sonos_Basement2_Controller  				"Controller"                        				        { channel="sonos:PLAY1:Basement2:control" }
Dimmer Sonos_Basement2_Volume      				"Volume [%.1f %%]" <soundvolume>    				(Sonos) { channel="sonos:PLAY1:Basement2:volume" }
Switch Sonos_Basement2_Mute        				"Mute"             <soundvolume_mute>				(Sonos) { channel="sonos:PLAY1:Basement2:mute" }
String Sonos_Basement2_CurrentTrack				"Now playing [%s]" 			        				(Sonos) { channel="sonos:PLAY1:Basement2:currenttrack" }
String Sonos_Basement2_CurrentAlbumCoverArtURL	"URL [%s]"			    							(Sonos) { channel="sonos:PLAY1:Basement2:currentalbumarturl" }
Switch Sonos_Basement2PlayOrPause				"Basement [MAP(sonos_play_pause.map):%s]"			(Sonos)	[ "Switchable" ]
Switch Sonos_Basement2_StandAlone            	"Stand Alone"               								{ channel="sonos:PLAY1:Basement2:standalone" }
String Sonos_Basement2_ZoneGroupID           	"Zone Group ID [%s]"               							{ channel="sonos:PLAY1:Basement2:zonegroupid"}
String Sonos_Basement2_ZoneName              	"Zone Name [%s]"                    						{ channel="sonos:PLAY1:Basement2:zonename"}
String Sonos_Basement2_Coordinator           	"Coordinator [%s]"          								{ channel="sonos:PLAY1:Basement2:coordinator"}
String Sonos_Basement2_Remove                	"Remove [%s]"                           					{ channel="sonos:PLAY1:Basement2:remove" }
Switch Sonos_Basement2_LocalCoordinator      	"Local Coordinator"                     					{ channel="sonos:PLAY1:Basement2:localcoordinator" }
Switch Sonos_Basement2_Stop        				"Stop Player"                     							{ channel="sonos:PLAY1:Basement2:stop", autoupdate="false" }
Switch Sonos_Basement2_ClearQueue      			"Clear Queue"                     							{ channel="sonos:PLAY1:Basement2:clearqueue" }

Best, Jay

Thanks Jay,

My issue yesterday appeared to be cache related. I accidentally added all speakers into the same group initially and subsequently changed them to their own groups but the original group was still in effect hence the reason for the controls not controlling the correct speakers.

I restarted openhab this morning and all is good … BUT

You’re absolutely right with your pointer on the LocalCoordinator as this morning it was blahb not blah2 in control.

I’m going to rewrite my solution to set the group coordinator on each relevant screen.