Skip to content

Instantly share code, notes, and snippets.

@KennethNielsen
Last active May 6, 2016 07:50
Show Gist options
  • Save KennethNielsen/a89564d61b5064a34871731a13a4984d to your computer and use it in GitHub Desktop.
Save KennethNielsen/a89564d61b5064a34871731a13a4984d to your computer and use it in GitHub Desktop.
List all actions available from Sonos via SoCo
from __future__ import print_function
import inspect
import soco
zone = soco.discovery.any_soco()
# Get the base service class
service_class = soco.services.Service
# Loop over all members in soco.services ...
for _, member in inspect.getmembers(soco.services):
# ... and skip everything that isn't and class and a subclass of Service
if not (inspect.isclass(member) and issubclass(member, service_class)):
continue
# Instantiate the service and print out all its actions
service_instance = member(zone)
for action, in_args, out_args in service_instance.iter_actions():
print(action, in_args, out_args)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment