Last active
May 6, 2016 07:50
-
-
Save KennethNielsen/a89564d61b5064a34871731a13a4984d to your computer and use it in GitHub Desktop.
List all actions available from Sonos via SoCo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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