UPnP Services
Sonos devices offer several UPnP services which are accessible from classes in
the soco.services
module.
soco.services.AlarmClock
soco.services.MusicServices
soco.services.DeviceProperties
soco.services.SystemProperties
soco.services.ZoneGroupTopology
soco.services.GroupManagement
soco.services.QPlay
soco.services.ContentDirectory
soco.services.MS_ConnectionManager
soco.services.RenderingControl
soco.services.MR_ConnectionManager
soco.services.AVTransport
soco.services.Queue
soco.services.GroupRenderingControl
All services take a soco.SoCo
instance as their first parameter.
Inspecting
To get a list of supported actions you can call the service’s
soco.services.Service.iter_actions()
. It yields the service’s actions
with their in_arguments (ie parameters to pass to the action) and out_arguments
(ie returned values).
Each action is an soco.services.Action
namedtuple, consisting
of action_name
(a string), in_args
(a list of
soco.services.Argument
namedtuples consisting of name
and
argtype
), and out_args (ditto), eg:
Events
You can subscribe to the events of a service using the
soco.services.Service.subscribe()
method. See Events for details.