soco.groups module¶
This module contains classes and functionality relating to Sonos Groups.
-
class
soco.groups.
ZoneGroup
(uid, coordinator, members=None)[source]¶ A class representing a Sonos Group. It looks like this:
ZoneGroup( uid='RINCON_000FD584236D01400:58', coordinator=SoCo("192.168.1.101"), members={SoCo("192.168.1.101"), SoCo("192.168.1.102")} )
Any SoCo instance can tell you what group it is in:
>>> device = soco.discovery.any_soco() >>> device.group ZoneGroup( uid='RINCON_000FD584236D01400:58', coordinator=SoCo("192.168.1.101"), members={SoCo("192.168.1.101"), SoCo("192.168.1.102")} )
From there, you can find the coordinator for the current group:
>>> device.group.coordinator SoCo("192.168.1.101")
or, for example, its name:
>>> device.group.coordinator.player_name Kitchen
or a set of the members:
>>> device.group.members {SoCo("192.168.1.101"), SoCo("192.168.1.102")}
For convenience, ZoneGroup is also a container:
>>> for player in device.group: ... print player.player_name Living Room Kitchen
If you need it, you can get an iterator over all groups on the network:
>>> device.all_groups <generator object all_groups at 0x108cf0c30>
A consistent readable label for the group members can be returned with the
label
andshort_label
properties.Parameters: -
uid
= None¶ The unique Sonos ID for this group
-