fauxmo.handlers package

Submodules

fauxmo.handlers.hass module

class fauxmo.handlers.hass.HassAPIHandler(host, password, entity, port=8123)[source]

Bases: object

Handler for Home Assistant (hass) Python API.

Allows users to specify Home Assistant services in their config.json and toggle these with the Echo. While this can be done with Home Assistant’s REST API as well (example included), I find it easier to use the Python API.

off()[source]
on()[source]
send(signal)[source]

Send a signal to the hass call_service function, returns True.

The hass Python API doesn’t appear to return anything with this function, but will raise an exception if things didn’t seem to work, so I have it set to just return True, hoping for an exception if there was a problem.

Args:
signal (const): signal imported from homeassistant.const. I have imported SERVICE_TURN_ON and SERVICE_TURN_OFF, make sure you import any others that you need.

fauxmo.handlers.rest module

class fauxmo.handlers.rest.RESTAPIHandler(on_cmd, off_cmd, method='GET', on_data=None, off_data=None, on_json=None, off_json=None, headers=None, auth_type=None, user=None, password=None)[source]

Bases: object

Rest API handler class.

The Fauxmo class expects handlers to be instances of objects that have on() and off() methods that return True on success and False otherwise. This class takes a mix of url, method, header, body, and auth data and makes REST calls to a device.

off()
on()
set_state(cmd, data, json)[source]

Call HTTP method, for use by functools.partialmethod.

Module contents