Skip to content

Latest commit

 

History

History
129 lines (81 loc) · 3.71 KB

api.md

File metadata and controls

129 lines (81 loc) · 3.71 KB

API

Hub

Properties

devices

The list of devices managed by the hub.

mode

The hub's mode (e.g., "Away", "Day", "Night").

modes

The available hub modes.

hsm_status

The hub's HSM status (e.g., "armedAway", "disarmed"). See this post for more information.

Methods

__init__(host, app_id, access_token, port, event_url)

Parameter Type Description
host str URL to Hubitat hub
app_id str Maker API app ID
access_token str Maker API access token
port Optional[int] Event server port
event_url Optional[str] Event server URL

Initialize a new Hub.

add_device_listener(device_id, listener)

Add a listener for device events for the given device ID. The listener should have the signature listener(event) -> None.

add_hsm_listener(listener)

Add a listener for HSM change events. The listener should have the signature listener(event) -> None.

add_mode_listener(listener)

Add a listener for mode change events. The listener should have the signature listener(event) -> None.

async check_config()

Verify that the hub is accessible.

async refresh_device(device_id)

Refresh the cached state for the given device ID.

remove_device_listeners(device_id)

Remove all listeners registered for the given device ID.

remove_hsm_listeners()

Remove all listeners for HSM events.

remove_mode_listeners()

Remove all listeners for mode events.

async send_command(device_id, command, arg)

Send a command to a device.

Parameter Type Description
device_id str Device to send command to
command str Command name
arg Optional[Union[str, int]] Command argument

async set_event_url(event_url)

Set the URL that Hubitat should POST events to.

async set_hsm(hsm_state)

Set Hubitat's HSM state.

async set_host(mode)

Set URL that the Hubitat hub is available at.

async set_mode(mode)

Set Hubitat's mode.

async set_port(port)

Set the port the event server will listen on.

async stop()

Remove all listeners and stop the event server.