vmichalak / sonos-controller

Java API for controlling SONOS players
MIT License
43 stars 9 forks source link

Identify coordinator of a group #6

Closed mguntli closed 6 years ago

mguntli commented 6 years ago

Hi Valentin

Great library - looking forward to your future extensions! In order to play music in a stereo pair, I need to find the coordinator which I can send the playUri command. Any hints how I can accomplish this?

My first attempt was to loop through the list, compare the zone name and find the one where "isJoined" returns false. However this does not seem to work when a pair of speakers is linked together as stereo pair.

Example:

vmichalak commented 6 years ago

Hi Michael,

Thanks for your message.

This week i have to finish the integration of Sonos Playbar / Playbase specifics feature, it's hard for me to check your case before. Do you have some ideas of where i can find the information of who is the coordinator ? (perhaps around the zone group but i'm not sure)

mguntli commented 6 years ago

Hi Valentin

No worries - I'm not in a rush. I am still learning the UPNP structure of the Sonos players, but I was able to get the coordinator with the UPNP Sonos library: https://github.com/jishi/Jishi.Intel.SonosUPnP/blob/d855f385449a194d45a1ed55d1e34957c7f453b5/Jishi.Intel.SonosUPnP/SonosZone.cs#L20

vmichalak commented 6 years ago

Done, i implement it and it's finally pretty simple : the Zone UID starts with the UID of the coordinator speaker. 😊

Could you test it on your Sonos system ?

mguntli commented 6 years ago

Thanks it looks good - let me test it with more complex setups but I think this works 👍