SolvedSoCo Group broken by Sonos version 10.1

I updated my Sonos to version 10.1 today and noticed that some of my scripts that rely on SoCo seem to have broken.

Seems to be a problem with groups. When trying to find coordinator of a group with

device.group.coordinator.player_name

I get error:

Traceback (most recent call last): File "./test", line 7, in <module> print(device.group.coordinator.player_name) AttributeError: 'NoneType' object has no attribute 'coordinator'

and print(device.group) just gives output of:

None

I'm assuming this is the 10.1 upgrade. Does anybody else see this, and know if it is fixable?

47 Answers

✔️Accepted Answer

I found a fix that work in my small network sonos system.

--- soco/core.py	(revision 671937e07d7973b78c0cbee153d4f3ad68ec48c6)
+++ soco/core.py	(date 1554404884029)
@@ -949,7 +949,7 @@
         self._all_zones.clear()
         self._visible_zones.clear()
         # Loop over each ZoneGroup Element
-        for group_element in tree.findall('ZoneGroup'):
+        for group_element in tree.find('ZoneGroups').findall('ZoneGroup'):
             coordinator_uid = group_element.attrib['Coordinator']
             group_uid = group_element.attrib['ID']
             group_coordinator = None

I'm not sure if the ZoneGroups is not multiple.

Other Answers:

Same here. soco.discover() returns the empty set.