Light

class knut.apis.Light

Interact with light services.

This class extends the KnutAPI to handle the following requests:

Note

Each light service back-end add to backends must subclass the base Light class.

add_backend(backend)

Adds the backend to the backends dictionary.

backends = None

A dictionary with all back-ends where the keys are the identifiers of the back-ends and the values are the corresponding light objects Light.

notifier(uid)

Pushes the status() of the back-end with the uid to all listeners of the on_push() event.

request_handler(msg_id, msg)

Return the tuple (response_id, response) upon a request.

Handle the request msg of type msg_id and return a corresponding response of type response_id. If either no valid request msg was passed, or the request does not expect any response, the response (0x0000, {}) is returned.

This method checks the supported dictionary and calls the corresponding callback function if found.