Sonos API

Module for interacting with the Sonos node.js API.

class dashboard.sonos.Sonos(session, api_host=None, api_base=None)[source]

A module for querying the node.js Sonos API:

sonos = Sonos(uvhttp.session.Session(5, asyncio.get_event_loop()))
zones = await sonos.api('zones')
print(zones)

It will automatically find the API if it is reachable on localhost, the default gateway, or docker.for.mac.local. If it is not one of these, it should be indicated in the api_host argument.

api(method)[source]

Make a request to the Sonos API, returning the JSON.

find_api()[source]

Find the Sonos API running on localhost or the host server.