xs1_api_client.device package

Module contents

class xs1_api_client.device.XS1Device(state: dict, api) → None[source]

Bases: object

This is a generic XS1 device, all other objetcs inherit from this.

NAME_PATTERN_VALID = re.compile('^[a-zA-Z0-9_]+$', re.IGNORECASE)
enabled() → bool[source]
Returns:Returns if this device is enabled.
id() → int[source]
Returns:id of this device
last_update() → int[source]
Returns:the time when this device’s value was updated last
name() → str[source]
Returns:the name of this device
new_value()[source]

Returns the new value to set for this device. If this value differs from the currrent value the gateway is still trying to update the value on the device. If it does not differ the value has already been set.

Returns:the new value to set for this device
set_name(name: str)[source]

Sets a new name for this device. Keep in mind that there are some limitations for a device name.

Parameters:name – the new name to set
Returns:the new name of the actuator
set_state(new_state: dict) → None[source]

Sets a new state for this device. If there is an existing state, new and old values will be merged to retain any information that was missing from api responses.

Parameters:new_state – new representation of this device (api response)
set_value(value) → None[source]

Sets a new value for this device. This method should be implemented by inheriting classes.

Parameters:value – the new value to set
type() → str[source]
Returns:the type of this device
unit() → str[source]
Returns:the unit that is used for the value
update() → None[source]

Updates the current value of this device. This method should be implemented by inheriting classes.

value()[source]
Returns:the current value of this device