We have moved at community.getvera.com

Author Topic: Pseudo-discovery of new Sonos zones  (Read 10480 times)

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Pseudo-discovery of new Sonos zones
« on: March 14, 2013, 03:10:50 pm »
I am now working on a new device that will help to maintain a device for each Sonos zone; each new Sonos will be automatically discovered and added as a new Vera device.

It will be released soon.

My code is based on calls to http://<ip>:1400/status/topology with <ip> the IP of one Sonos zone.

Can someone confirm that the result of the HTTP request lists all the Sonos zones in SonosNet, even the Sonos that are not temporarly disconnected (not powered) ?

Offline big517

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 576
  • Karma: +1/-4
Re: Pseudo-discovery of new Sonos zones
« Reply #1 on: March 14, 2013, 03:44:40 pm »
Yes and No, The result is a page that has 2 options, when you click either one it will expand to show you the Players, and servers respectively;

Zone Players URL: javascript:toggle('idp2587584'):
Media Servers URL: javascript:toggle('idp2586752')

I hope this helps.

Offline hek

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 714
  • Karma: +60/-1
Re: Pseudo-discovery of new Sonos zones
« Reply #2 on: March 14, 2013, 05:17:20 pm »

I have two play:3 configuged as a stereo-pair in the kitchen (K?k). I only want one device to show up for this in Vera because they always plays the same thing.
This might be a "special case" you'll have to handle in the topology plugin.


Zone Players
Zone Name   Coordinator   Group   Location   UUID   Version   MinCompatVer   Compat
K?k   false   RINCON_000E587E838C01400:2   http://192.168.178.34:1400/xml/device_description.xml   RINCON_000E587E83B801400   21.4-61160c   21.1-00000   
BRIDGE   true   RINCON_000E58E4096401400:0   http://192.168.178.30:1400/xml/device_description.xml   RINCON_000E58E4096401400   21.4-61160c   21.1-00000   
K?k   true   RINCON_000E587E838C01400:2   http://192.168.178.33:1400/xml/device_description.xml   RINCON_000E587E838C01400   21.4-61160c   21.1-00000   

Media Servers
Name   Location   UUID   Version   CanBeDisplayed   Unavailable   Type   Ext
Plex Media Server: Henrik & Jenny NAS   http://192.168.178.36:32469/DeviceDescription.xml   de74f70e-71c7-b190-405e-eb0fdee944b9   0.9.7.9   false   false   0   
AVM FRITZ!Mediaserver   http://192.168.178.1:49000/MediaServerDevDesc.xml   fa095ecc-e13e-40e7-8e6c-c025062a85c2   avme   false   false   0   
iPad   192.168.178.35:3401   mobile-iPad-74E2F51E7F82      false   false   0   


Offline dinkeldorf

  • Jr. Member
  • **
  • Posts: 55
  • Karma: +0/-9
Re: Pseudo-discovery of new Sonos zones
« Reply #3 on: March 14, 2013, 05:37:33 pm »
Hope this is useful. Plethora of zones, sources. Good on plugin!

Code: [Select]
<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="/xml/review.xsl"?><ZPSupportInfo><ZonePlayers><ZonePlayer group='RINCON_000E587E0FAE01400:12' coordinator='false' location='http://192.168.0.124:1400/xml/device_description.xml' version='21.4-61160c' mincompatibleversion='21.1-00000' bootseq='50' uuid='RINCON_000E58510AC601400'>The Gym</ZonePlayer><ZonePlayer group='RINCON_000E584001E001400:0' coordinator='true' location='http://192.168.0.123:1400/xml/device_description.xml' version='21.4-61160c' mincompatibleversion='21.1-00000' bootseq='107' uuid='RINCON_000E584001E001400'>UtilityRmBridge</ZonePlayer><ZonePlayer group='RINCON_000E587E0FAE01400:12' coordinator='true' location='http://192.168.0.162:1400/xml/device_description.xml' version='21.4-61160c' mincompatibleversion='21.1-00000' bootseq='7' uuid='RINCON_000E587E0FAE01400'>Kitchen</ZonePlayer><ZonePlayer group='RINCON_000E587E0FAE01400:12' coordinator='false' location='http://192.168.0.134:1400/xml/device_description.xml' version='21.4-61160c' mincompatibleversion='21.1-00000' bootseq='82' uuid='RINCON_000E58138D0601400'>Whole house</ZonePlayer></ZonePlayers><MediaServers><MediaServer location='http://192.168.0.187:2170/' uuid='EAEB-C82A14233ABB-01-656C6761746F04' version='562' canbedisplayed='false' unavailable='false' type='0' ext=''>EyeConnect (the-big-mac)</MediaServer><MediaServer location='192.168.0.106:3401' uuid='mobile-iPad-74E1B685B3B4' version='' canbedisplayed='false' unavailable='false' type='0' ext=''>Rennerpad</MediaServer><MediaServer location='192.168.0.155:3401' uuid='mobile-iPhone-885395347BDC' version='' canbedisplayed='false' unavailable='false' type='0' ext=''>Craig&apos;s Phone</MediaServer><MediaServer location='192.168.0.143:3401' uuid='mobile-iPhone-30F7C567CDCF' version='' canbedisplayed='false' unavailable='false' type='0' ext=''>Lynn&apos;s iPhone</MediaServer></MediaServers></ZPSupportInfo>
« Last Edit: March 14, 2013, 05:40:08 pm by dinkeldorf »

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Pseudo-discovery of new Sonos zones
« Reply #4 on: March 14, 2013, 06:40:06 pm »
Yes and No, The result is a page that has 2 options, when you click either one it will expand to show you the Players, and servers respectively;

Zone Players URL: javascript:toggle('idp2587584'):
Media Servers URL: javascript:toggle('idp2586752')

I hope this helps.

What I use is the Zone Players part.
I need to know if it lists always all your zones, even if one of them is disconnected (unpowered - if it is the correct english word) ?

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Pseudo-discovery of new Sonos zones
« Reply #5 on: March 14, 2013, 06:50:33 pm »

I have two play:3 configuged as a stereo-pair in the kitchen (K?k). I only want one device to show up for this in Vera because they always plays the same thing.
This might be a "special case" you'll have to handle in the topology plugin.


Zone Players
Zone Name   Coordinator   Group   Location   UUID   Version   MinCompatVer   Compat
K?k   false   RINCON_000E587E838C01400:2   http://192.168.178.34:1400/xml/device_description.xml   RINCON_000E587E83B801400   21.4-61160c   21.1-00000   
BRIDGE   true   RINCON_000E58E4096401400:0   http://192.168.178.30:1400/xml/device_description.xml   RINCON_000E58E4096401400   21.4-61160c   21.1-00000   
K?k   true   RINCON_000E587E838C01400:2   http://192.168.178.33:1400/xml/device_description.xml   RINCON_000E587E838C01400   21.4-61160c   21.1-00000   

Might be not easy.
I see that your two Play:3 have the same group: RINCON_000E587E838C01400:2
They have the same strange name "K?k". Is it the real name you gave to your zones ?
stereo-pair is a special Sonos feature, isn't it ?
Can you help me to identify a stereo-pair ?
Could you unpair your 2 Play:3 and then provide me the new topology ?

Note: I have to handle the special case of the bridge too.
Note 2: please unplug one of your 2 Play:3 and tell me if the topology is updated.
« Last Edit: March 14, 2013, 07:14:11 pm by lolodomo »

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Pseudo-discovery of new Sonos zones
« Reply #6 on: March 14, 2013, 07:06:06 pm »
Hope this is useful. Plethora of zones, sources. Good on plugin!

Code: [Select]
<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="/xml/review.xsl"?><ZPSupportInfo><ZonePlayers><ZonePlayer group='RINCON_000E587E0FAE01400:12' coordinator='false' location='http://192.168.0.124:1400/xml/device_description.xml' version='21.4-61160c' mincompatibleversion='21.1-00000' bootseq='50' uuid='RINCON_000E58510AC601400'>The Gym</ZonePlayer><ZonePlayer group='RINCON_000E584001E001400:0' coordinator='true' location='http://192.168.0.123:1400/xml/device_description.xml' version='21.4-61160c' mincompatibleversion='21.1-00000' bootseq='107' uuid='RINCON_000E584001E001400'>UtilityRmBridge</ZonePlayer><ZonePlayer group='RINCON_000E587E0FAE01400:12' coordinator='true' location='http://192.168.0.162:1400/xml/device_description.xml' version='21.4-61160c' mincompatibleversion='21.1-00000' bootseq='7' uuid='RINCON_000E587E0FAE01400'>Kitchen</ZonePlayer><ZonePlayer group='RINCON_000E587E0FAE01400:12' coordinator='false' location='http://192.168.0.134:1400/xml/device_description.xml' version='21.4-61160c' mincompatibleversion='21.1-00000' bootseq='82' uuid='RINCON_000E58138D0601400'>Whole house</ZonePlayer></ZonePlayers><MediaServers><MediaServer location='http://192.168.0.187:2170/' uuid='EAEB-C82A14233ABB-01-656C6761746F04' version='562' canbedisplayed='false' unavailable='false' type='0' ext=''>EyeConnect (the-big-mac)</MediaServer><MediaServer location='192.168.0.106:3401' uuid='mobile-iPad-74E1B685B3B4' version='' canbedisplayed='false' unavailable='false' type='0' ext=''>Rennerpad</MediaServer><MediaServer location='192.168.0.155:3401' uuid='mobile-iPhone-885395347BDC' version='' canbedisplayed='false' unavailable='false' type='0' ext=''>Craig&apos;s Phone</MediaServer><MediaServer location='192.168.0.143:3401' uuid='mobile-iPhone-30F7C567CDCF' version='' canbedisplayed='false' unavailable='false' type='0' ext=''>Lynn&apos;s iPhone</MediaServer></MediaServers></ZPSupportInfo>

You have 4 Sonos and 3 of them are grouped with the one named "UtilityRmBridge" being the coordinator for this group.
Is it correct ?

Offline hek

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 714
  • Karma: +60/-1
Re: Pseudo-discovery of new Sonos zones
« Reply #7 on: March 15, 2013, 02:10:26 am »
When one unit is unplugged it disappears from the topology... Which seems to be logical.


Zone Players
Zone Name   Coordinator   Group   Location   UUID   Version   MinCompatVer   Compat
BRIDGE   true   RINCON_000E58E4096401400:0   http://192.168.178.30:1400/xml/device_description.xml   RINCON_000E58E4096401400   21.4-61160c   21.1-00000   
K?k   true   RINCON_000E587E838C01400:2   http://192.168.178.33:1400/xml/device_description.xml   RINCON_000E587E838C01400   21.4-61160c   21.1-00000   


Also not that one of my units has coordinator = true (in the previous post). That one is the "master" of the stereo-pair.


Offline hek

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 714
  • Karma: +60/-1
Re: Pseudo-discovery of new Sonos zones
« Reply #8 on: March 15, 2013, 02:49:39 am »
And when i split them up both has coordinator = true.

Zone Players
Zone Name   Coordinator   Group   Location   UUID   Version   MinCompatVer   Compat
Vardagsrum   true   RINCON_000E587E83B801400:16   http://192.168.178.34:1400/xml/device_description.xml   RINCON_000E587E83B801400   21.4-61160c   21.1-00000   
BRIDGE   true RINCON_000E58E4096401400:0   http://192.168.178.30:1400/xml/device_description.xml   RINCON_000E58E4096401400   21.4-61160c   21.1-00000   
K?k   true RINCON_000E587E838C01400:2   http://192.168.178.33:1400/xml/device_description.xml   RINCON_000E587E838C01400   21.4-61160c   21.1-00000

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Pseudo-discovery of new Sonos zones
« Reply #9 on: March 15, 2013, 05:38:05 am »
When one unit is unplugged it disappears from the topology... Which seems to be logical.

Bad news even if it seems to be logical as you said.
If I delete the Vera device when the zone is unplugged and create it again when the zone is plugged again, it will break scenes using this device.

3 possibilities:
1 - I maintain the Vera devices to be conform to the Sonos network topology
2 - I create new devices but never suppress devices
3 - I suppress devices only after a certain delay of inactivity => how much time ?

What are your suggestions ?

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Pseudo-discovery of new Sonos zones
« Reply #10 on: March 15, 2013, 05:49:47 am »
And when i split them up both has coordinator = true.

Zone Players
Zone Name   Coordinator   Group   Location   UUID   Version   MinCompatVer   Compat
Vardagsrum   true   RINCON_000E587E83B801400:16   http://192.168.178.34:1400/xml/device_description.xml   RINCON_000E587E83B801400   21.4-61160c   21.1-00000   
BRIDGE   true RINCON_000E58E4096401400:0   http://192.168.178.30:1400/xml/device_description.xml   RINCON_000E58E4096401400   21.4-61160c   21.1-00000   
K?k   true RINCON_000E587E838C01400:2   http://192.168.178.33:1400/xml/device_description.xml   RINCON_000E587E838C01400   21.4-61160c   21.1-00000

I could assume that if they are grouped with the same name, they are paired. But that is not satisfying.

Could you compare the result of http://192.168.178.34:1400/xml/device_description.xml when paired and not paired ?

Offline hek

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 714
  • Karma: +60/-1
Re: Pseudo-discovery of new Sonos zones
« Reply #11 on: March 15, 2013, 06:06:49 am »
When stereo-paired they both have the same group-id (RINCON_000E587E838C01400:2). The master unit has coordinator=true, and slave unit have coordinator=false.

When unpaired they have different group id (RINCON_000E587E83B801400:16, RINCON_000E587E838C01400:2) and both has the coordinator property = true.

I have not tried grouping units in any other way (like you do when playing same content in different rooms).


I would suggest you create all devices you find (use UUID as the unique identifier?) as slave devices. The plugin never deletes a device but it could update it's "state" to "SLAVE" or something.
When beeing slave you cannot control it (all buttons disappear etc) and status is Slave.  When beeing offline it could have the same disabled GUI and have status offline visible.

If user *REALLY* want to delete an auto-created device they use the trashcan on the devicetab. If the deleted sonos show up in the the network the unit will be auto-created again.


Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Pseudo-discovery of new Sonos zones
« Reply #12 on: March 15, 2013, 06:49:46 am »
When stereo-paired they both have the same group-id (RINCON_000E587E838C01400:2). The master unit has coordinator=true, and slave unit have coordinator=false.

When unpaired they have different group id (RINCON_000E587E83B801400:16, RINCON_000E587E838C01400:2) and both has the coordinator property = true.

I have not tried grouping units in any other way (like you do when playing same content in different rooms).

That's not enough as it is what you got with a normal grouping. Check dinkeldorf's data. I need to find something else to distinguish stereo pair. Name could be an idea but I assume there is something better in the description file.

Quote
I would suggest you create all devices you find (use UUID as the unique identifier?) as slave devices. The plugin never deletes a device but it could update it's "state" to "SLAVE" or something.
When beeing slave you cannot control it (all buttons disappear etc) and status is Slave.  When beeing offline it could have the same disabled GUI and have status offline visible.

Yes, I use UUID as unique identifier.
Good idea with the SLAVE and OFFLINE state.
Even in SLAVE state, certain actions are probably allowed, like volume adjustment. But I could disable "normal"l actions  and update accordingly the GUI.

Quote
If user *REALLY* want to delete an auto-created device they use the trashcan on the devicetab. If the deleted sonos show up in the the network the unit will be auto-created again.

It seems to be logical. I will do that.
« Last Edit: March 15, 2013, 07:11:53 am by lolodomo »

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Pseudo-discovery of new Sonos zones
« Reply #13 on: March 15, 2013, 07:17:39 am »
For SLAVE and OFFLINE state and the impact on GUI, I can certainly do it without using the network topology but with normal UPnP calls.

OFFLINE state is already detected with the displayed message "Cannot contact...", I just have to update the Player tab.
For SLAVE state, I have to search a proper way to get the info and then adjust the Player tab.

By the way, I will not be able to "grey" (disable) buttons in the Control tab and buttons on the device, it is not something possible with the MCV flash GUI.

Offline hek

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 714
  • Karma: +60/-1
Re: Pseudo-discovery of new Sonos zones
« Reply #14 on: March 15, 2013, 07:49:57 am »
That's not enough as it is what you got with a normal grouping. Check dinkeldorf's data. I need to find something else to distinguish stereo pair. Name could be an idea but I assume there is something better in the description file.

Agreed. There is no way of distinguish paired from grouped using this info.

How do I fetch the descriptor file? I could post them when i'm back home from work tonight.