Low-level Hub API calls

Module for all Cozify Hub API 1:1 calls

cozify.hub_api.colors(**kwargs)[source]

1:1 implementation of /hub/colors API call. For kwargs see cozify.hub_api.get()

Returns:List of hexadecimal color codes of all defined custom colors.
Return type:list
cozify.hub_api.devices(**kwargs)[source]

1:1 implementation of /devices API call. For remaining kwargs see cozify.hub_api.get()

Parameters:**devs (dict) – If defined, returned as-is.
Returns:Full live device state as returned by the API
Return type:dict
cozify.hub_api.devices_command(command, **kwargs)[source]

1:1 implementation of /devices/command. For kwargs see cozify.hub_api.put()

Parameters:command (dict) – dictionary of type DeviceData containing the changes wanted. Will be converted to json.
Returns:What ever the API replied or raises an APIEerror on failure.
Return type:str
cozify.hub_api.devices_command_generic(*, device_id, command=None, request_type, **kwargs)[source]

Command helper for CMD type of actions. No checks are made wether the device supports the command or not. For kwargs see cozify.hub_api.put()

Parameters:
  • device_id (str) – ID of the device to operate on.
  • request_type (str) – Type of CMD to run, e.g. CMD_DEVICE_OFF
  • command (dict) – Optional dictionary to override command sent. Defaults to None which is interpreted as { device_id, type }
Returns:

What ever the API replied or raises an APIError on failure.

Return type:

str

cozify.hub_api.devices_command_off(device_id, **kwargs)[source]

Command helper for CMD_DEVICE_OFF.

Parameters:device_id (str) – ID of the device to operate on.
Returns:What ever the API replied or raises an APIException on failure.
Return type:str
cozify.hub_api.devices_command_on(device_id, **kwargs)[source]

Command helper for CMD_DEVICE_ON.

Parameters:device_id (str) – ID of the device to operate on.
Returns:What ever the API replied or raises an APIError on failure.
Return type:str
cozify.hub_api.devices_command_state(*, device_id, state, **kwargs)[source]

Command helper for CMD type of actions. No checks are made wether the device supports the command or not. For kwargs see cozify.hub_api.put()

Parameters:
  • device_id (str) – ID of the device to operate on.
  • state (dict) – New state dictionary containing changes.
Returns:

What ever the API replied or raises an APIError on failure.

Return type:

str

cozify.hub_api.hub(**kwargs)[source]

1:1 implementation of /hub API call. For kwargs see cozify.hub_api.get()

Returns:Hub state dict.
Return type:dict
cozify.hub_api.lpd433devices(**kwargs)[source]

1:1 implementation of /hub/433devices API call. For kwargs see cozify.hub_api.get()

Returns:List of dictionaries describing all 433MHz devices paired with hub.
Return type:list
cozify.hub_api.tz(**kwargs)[source]

1:1 implementation of /hub/tz API call. For kwargs see cozify.hub_api.get()

Returns:Timezone of the hub, for example: ‘Europe/Helsinki’
Return type:str