Permalink
Find file Copy path
82639c3 Oct 28, 2017
2 contributors

Users who have contributed to this file

@stefankoegl @hugovk
61 lines (37 sloc) 1.27 KB

Speaker Topologies

Sonos speakers can be grouped together, and existing groups can be inspected.

Topology is available from each :class:`soco.SoCo` instance.

>>> my_player.group
ZoneGroup(
    uid='RINCON_000E5879136C01400:58',
    coordinator=SoCo("192.168.1.101"),
    members={SoCo("192.168.1.101"), SoCo("192.168.1.102")}
)

A group of speakers is represented by a :class:`soco.groups.ZoneGroup`.

Zone Group

Each ZoneGroup contains its coordinator

>>> my_player.group.coordinator
SoCo("192.168.1.101")

which is again a :class:`soco.SoCo` instance

>>> my_player.group.coordinator.player_name
Kitchen

A ZoneGroup also contains a set of members.

>>> my_player.group.members
{SoCo("192.168.1.101"), SoCo("192.168.1.102")}

For convenience, ZoneGroup is also a container:

>>> for player in my_player.group:
...   print(player.player_name)
Living Room
Kitchen

If you need it, you can get an iterator over all groups on the network:

>>> my_player.all_groups
<generator object all_groups at 0x108cf0c30>