xs1_api_client package¶
Subpackages¶
Submodules¶
xs1_api_client.api module¶
This is the main xs1_api_client api which contains the XS1 object to interact with the gateway.
Example usage can be found in the example.py file
-
class
xs1_api_client.api.
XS1
(host: str = None, user: str = None, password: str = None) → None[source]¶ Bases:
object
This class is the main api interface that handles all communication with the XS1 gateway.
-
RETRY_STRATEGY
= Retry(total=5, connect=None, read=None, redirect=None, status=None)¶
-
call_actuator_function
(actuator_id, function) → dict[source]¶ Executes a function on the specified actuator and sets the response on the passed in actuator.
Parameters: - actuator_id – actuator id to execute the function on and set response value
- function – id of the function to execute
Returns: the api response
-
get_actuator
(actuator_id: int) → xs1_api_client.device.actuator.XS1Actuator[source]¶ Get an actuator with a specific id :param actuator_id: the id of the actuator :return: XS1Actuator
-
get_all_actuators
(enabled: bool = None) → [<class 'xs1_api_client.device.actuator.XS1Actuator'>][source]¶ Requests the list of enabled actuators from the gateway.
Parameters: enabled – Returns: a list of XS1Actuator objects
-
get_all_sensors
(enabled: bool = None) → [<class 'xs1_api_client.device.sensor.XS1Sensor'>][source]¶ Requests the list of enabled sensors from the gateway.
Returns: list of XS1Sensor objects
-
get_config_actuator
(actuator_id: int) → dict[source]¶ Returns: the configuration of a specific actuator
-
get_gateway_bootloader_version
() → str[source]¶ Returns: the bootloader version number of the gateway
-
get_protocol_info
() → str[source]¶ Retrieves the protocol version that is used by the gateway
Returns: protocol version number
-
get_sensor
(sensor_id: int) → xs1_api_client.device.sensor.XS1Sensor[source]¶ Get a sensor with a specific id :param sensor_id: the id of the actuator :return: XS1Sensor
-
get_state_actuator
(actuator_id) → dict[source]¶ Gets the current state of the specified actuator.
Parameters: actuator_id – actuator id Returns: the api response as a dict
-
get_state_sensor
(sensor_id) → dict[source]¶ Gets the current state of the specified sensor.
Parameters: sensor_id – sensor id Returns: the api response as a dict
-
send_request
(command: xs1_api_client.api_constants.Command, parameters: dict = None) → dict[source]¶ Sends a GET request to the XS1 Gateway and returns the response as a JSON object.
Parameters: - command – command parameter for the URL (see api_constants)
- parameters – additional parameters needed for the specified command like ‘number=3’ passed in as a dictionary
Returns: the api response as a json object
-
set_actuator_value
(actuator_id, value) → dict[source]¶ Sets a new value for the specified actuator.
Parameters: - actuator_id – actuator id to set the new value on
- value – the new value to set on the specified actuator
Returns: the api response
-
set_config_actuator
(actuator_id: int, configuration: dict) → dict[source]¶ Returns: the configuration of a specific actuator
-
set_config_sensor
(sensor_id: int, configuration: dict) → dict[source]¶ Returns: the configuration of a specific actuator
-
set_connection_info
(host, user, password) → None[source]¶ Sets private connection info for this XS1 instance. This XS1 instance will also immediately use this connection info.
Parameters: - host – host address the gateway can be found at
- user – username for authentication
- password – password for authentication
-
xs1_api_client.api_constants module¶
XS1 HTTP Web API constants used to create GET request URLs and parse the JSON answer.
-
class
xs1_api_client.api_constants.
ActuatorType
[source]¶ Bases:
enum.Enum
Actuator types
-
BLIND
= 'blind'¶
-
DIMMER
= 'dimmer'¶
-
DISABLED
= 'disabled'¶
-
DOOR
= 'door'¶
-
SHUTTER
= 'shutter'¶
-
SOUND
= 'sound'¶
-
SUN_BLIND
= 'sun-blind'¶
-
SWITCH
= 'switch'¶
-
TEMPERATURE
= 'temperature'¶
-
TIMERSWITCH
= 'timerswitch'¶
-
WINDOW
= 'window'¶
-
-
class
xs1_api_client.api_constants.
Command
[source]¶ Bases:
enum.Enum
XS1 Web API (HTTP) commands
-
GET_CONFIG_ACTUATOR
= 'get_config_actuator'¶ Command to get the configuration of an actuator
-
GET_CONFIG_INFO
= 'get_config_info'¶ Command to get (final) configuration information about the XS1
-
GET_CONFIG_MAIN
= 'get_config_main'¶ Command to get additional configuration information about the XS1
-
GET_CONFIG_SENSOR
= 'get_config_sensor'¶ Command to get the configuration of a sensor
-
GET_LIST_ACTUATORS
= 'get_list_actuators'¶ Command to get a list of all actuators
-
GET_LIST_FUNCTIONS
= 'get_list_functions'¶ Returns a list of available functions / actions for actuators
-
GET_LIST_RFMODES
= 'get_list_rfmodes'¶ Returns a list of currently active and compatible RF modes of the XS1
-
GET_LIST_SENSORS
= 'get_list_sensors'¶ Command to get a list of all sensors
-
GET_LIST_SYSTEMS
= 'get_list_systems'¶ Returns a list of currently compatible systems
-
GET_PROTOCOL_INFO
= 'get_protocol_info'¶ Command to get information about the protocol version used by the XS1
-
GET_STATE_ACTUATOR
= 'get_state_actuator'¶ Command to get the state of a specific actuator
-
GET_STATE_SENSOR
= 'get_state_sensor'¶ Command to get the state of a specific sensor
-
GET_TYPES_ACTUATORS
= 'get_types_actuators'¶ Retrieves the types of compatible actuators
-
GET_TYPES_SENSORS
= 'get_types_sensors'¶ Retrieves the types of compatible sensors
-
SET_CONFIG_ACTUATOR
= 'set_config_actuator'¶ Command to set the configuration of an actuator
-
SET_CONFIG_SENSOR
= 'set_config_sensor'¶ Command to set the configuration of a sensor
-
SET_STATE_ACTUATOR
= 'set_state_actuator'¶ Command to set a new value on an actuator
-
SET_STATE_SENSOR
= 'set_state_sensor'¶ Command to set a new value on a sensor (for debugging)
-
-
class
xs1_api_client.api_constants.
ErrorCode
[source]¶ Bases:
enum.Enum
Error codes
-
CMD_TYPE_MISSING
= '02'¶ Error code for ‘cmd type missing’
-
DUPLICATE
= '04'¶ Error code for ‘duplicate name’
-
INVALID_COMMAND
= '01'¶ Error code for ‘invalid command’
-
INVALID_DATE_TIME
= '07'¶ Error code for ‘invalid date/time’
-
INVALID_FUNCTION
= '06'¶ Error code for ‘invalid function’
-
INVALID_SYSTEM
= '05'¶ Error code for ‘invalid system’
-
INVALID_TIME_RANGE
= '11'¶ Error code for ‘error time range’
-
NOT_FOUND
= '03'¶ Error code for ‘number/name not found’
-
OBJECT_NOT_FOUND
= '08'¶ Error code for ‘object not found’
-
PROTOCOL_VERSION_MISMATCH
= '12'¶ Error code for ‘protocol version mismatch’
-
SYNTAX_ERROR
= '10'¶ Error code for ‘syntax error’
-
TYPE_NOT_VIRTUAL
= '09'¶ Error code for ‘type not virtual’
-
-
class
xs1_api_client.api_constants.
FunctionType
[source]¶ Bases:
enum.Enum
Function types
-
ABSOLUT
= 'absolut'¶
-
AUTO
= 'auto'¶
-
BLIND_ABS
= 'blind_abs'¶
-
BUTTON_LONG
= 'button_long'¶
-
BUTTON_SHORT
= 'button_short'¶
-
DIM_ABSOLUT
= 'dim_absolut'¶
-
DIM_DOWN
= 'dim_down'¶
-
DIM_UP
= 'dim_up'¶
-
DISABLED
= 'disabled'¶
-
IMPULS
= 'impuls'¶
-
LEARN
= 'learn'¶
-
LONG_OFF
= 'long_off'¶
-
LONG_ON
= 'long_on'¶
-
MANUAL
= 'manual'¶
-
OFF
= 'off'¶
-
OFF_WAIT_OFF
= 'off_wait_off'¶
-
OFF_WAIT_ON
= 'off_wait_on'¶
-
ON
= 'on'¶
-
ON_WAIT_OFF
= 'on_wait_off'¶
-
ON_WAIT_ON
= 'on_wait_on'¶
-
RELATIVE
= 'relative'¶
-
SPECIAL
= 'special'¶
-
STOP
= 'stop'¶
-
TOGGLE
= 'toggle'¶
-
UNKNOWN
= 'unknown'¶
-
WAIT
= 'wait'¶
-
-
class
xs1_api_client.api_constants.
Node
[source]¶ Bases:
enum.Enum
JSON API nodes
-
ACTUATOR
= 'actuator'¶ Node with an array of actuators
-
DEVICE_BOOTLOADER_VERSION
= 'bootloader'¶ Bootloader version number
-
DEVICE_FIRMWARE_VERSION
= 'firmware'¶ Firmware version number
-
DEVICE_HARDWARE_VERSION
= 'hardware'¶ Hardware revision
-
DEVICE_MAC
= 'mac'¶ MAC address
-
DEVICE_NAME
= 'devicename'¶ Hostname
-
DEVICE_UPTIME
= 'uptime'¶ Uptime in seconds
-
ERROR
= 'error'¶ Node containing the error code
-
FUNCTION
= 'function'¶ Node with an array of functions
-
INFO
= 'info'¶ Node with gateway specific information
-
PARAM_DESCRIPTION
= 'dsc'¶ Device description
-
PARAM_FUNCTION
= 'function'¶ Array of functions
-
PARAM_ID
= 'id'¶ Device id (only unique within actuators/sensors)
-
PARAM_NAME
= 'name'¶ Device name
-
PARAM_NEW_VALUE
= 'newvalue'¶ New value to set for the device
-
PARAM_NUMBER
= 'number'¶ Alternative device id (only unique within actuators/sensors)
-
PARAM_TYPE
= 'type'¶ Device type
-
PARAM_UNIT
= 'unit'¶ Device value unit
-
PARAM_UTIME
= 'utime'¶ Time this device was last updated
-
PARAM_VALUE
= 'value'¶ Current device value
-
SENSOR
= 'sensor'¶ Node with an array of sensors
-
SYSTEM
= 'system'¶ Node with gateway main configuration
-
VERSION
= 'version'¶ Node with protocol version info
-
-
class
xs1_api_client.api_constants.
SensorType
[source]¶ Bases:
enum.Enum
Sensor types
-
AIR_QUALITY
= 'air_quality'¶
-
ALARMMAT
= 'alarmmat'¶
-
BAROMETER
= 'barometer'¶
-
COUNTER
= 'counter'¶
-
COUNTERDIFF
= 'counterdiff'¶
-
DISABLED
= 'disabled'¶
-
DOORBELL
= 'doorbell'¶
-
DOOROPEN
= 'dooropen'¶
-
FENCEDETECTOR
= 'fencedetector'¶
-
GAS_BUTAN
= 'gas_butan'¶
-
GAS_CO
= 'gas_co'¶
-
GAS_CONSUMP
= 'gas_consump'¶
-
GAS_METHAN
= 'gas_methan'¶
-
GAS_PEAK
= 'gas_peak'¶
-
GAS_PROPAN
= 'gas_propan'¶
-
HEATDETECTOR
= 'heatdetector'¶
-
HYGROMETER
= 'hygrometer'¶
-
LEAFWETNESS
= 'leafwetness'¶
-
LIGHT
= 'light'¶
-
LIGHTBARRIER
= 'lightbarrier'¶
-
MAIL
= 'mail'¶
-
MOTION
= 'motion'¶
-
OIL_CONSUMP
= 'oil_consump'¶
-
OIL_PEAK
= 'oil_peak'¶
-
OTHER
= 'other'¶
-
PRESENCE
= 'presence'¶
-
PWR_CONSUMP
= 'pwr_consump'¶
-
PWR_PEAK
= 'pwr_peak'¶
-
PYRANOMETER
= 'pyranometer'¶
-
RAIN
= 'rain'¶
-
RAININTENSITY
= 'rainintensity'¶
-
RAIN_1H
= 'rain_1h'¶
-
RAIN_24H
= 'rain_24h'¶
-
REMOTECONTROL
= 'remotecontrol'¶
-
SMOKEDETECTOR
= 'smokedetector'¶
-
SOILMOISTURE
= 'soilmoisture'¶
-
SOILTEMP
= 'soiltemp'¶
-
TEMPERATURE
= 'temperature'¶
-
UV_INDEX
= 'uv_index'¶
-
WATERDETECTOR
= 'waterdetector'¶
-
WATERLEVEL
= 'waterlevel'¶
-
WINDDIRECTION
= 'winddirection'¶
-
WINDGUST
= 'windgust'¶
-
WINDOWBREAK
= 'windowbreak'¶
-
WINDOWOPEN
= 'windowopen'¶
-
WINDSPEED
= 'windspeed'¶
-
WINDVARIANCE
= 'windvariance'¶
-
WTR_CONSUMP
= 'wtr_consump'¶
-
WTR_PEAK
= 'wtr_peak'¶
-
-
class
xs1_api_client.api_constants.
SystemType
[source]¶ Bases:
enum.Enum
An enumeration.
-
AB400
= 'ab400'¶
-
AB500
= 'ab500'¶
-
AB601
= 'ab601'¶
-
BGJ
= 'bgj'¶
-
BSQUIGG
= 'bsquigg'¶
-
EM
= 'em'¶
-
FA20RF
= 'fa20rf'¶
-
FC1
= 'fc1'¶
-
FHT
= 'fht'¶
-
FS10
= 'fs10'¶
-
FS20
= 'fs20'¶
-
HE
= 'he'¶
-
HMS
= 'hms'¶
-
IT
= 'it'¶
-
IT2
= 'it2'¶
-
MARMI
= 'marmi'¶
-
OASEFM
= 'oasefm'¶
-
REV
= 'rev'¶
-
RGBLED1
= 'rgbled1'¶
-
RS200
= 'rs200'¶
-
RS862
= 'rs862'¶
-
RSL
= 'rsl'¶
-
SCHALK
= 'schalk'¶
-
VENT831
= 'vent831'¶
-
VIRTUAL
= 'virtual'¶
-
WAREMA
= 'warema'¶
-
WMR200
= 'wmr200'¶
-
WS300
= 'ws300'¶
-
WS433
= 'ws433'¶
-
-
xs1_api_client.api_constants.
UNIT_BOOLEAN
= 'boolean'¶ Boolean unit type
-
class
xs1_api_client.api_constants.
UrlParam
[source]¶ Bases:
enum.Enum
URL parameters
-
ADDRESS
= 'address'¶
-
COMMAND
= 'cmd'¶ command parameter that specifies the method the api is queried with
-
FACTOR
= 'factor'¶
-
FUNCTION
= 'function'¶ parameter that specifies the function to execute (on an actuator)
-
FUNCTION1_DSC
= 'function1.dsc'¶
-
FUNCTION1_TYPE
= 'function1.type'¶
-
FUNCTION2_DSC
= 'function2.dsc'¶
-
FUNCTION2_TYPE
= 'function2.type'¶
-
FUNCTION3_DSC
= 'function3.dsc'¶
-
FUNCTION3_TYPE
= 'function3.type'¶
-
FUNCTION4_DSC
= 'function4.dsc'¶
-
FUNCTION4_TYPE
= 'function4.type'¶
-
INITVALUE
= 'initvalue'¶
-
LOG
= 'log'¶
-
NAME
= 'name'¶
-
NUMBER
= 'number'¶ number parameter that specifies the id of an actuator or sensor
-
OFFSET
= 'offset'¶
-
PASSWORD
= 'pwd'¶ ‘Password’ parameter
-
SYSTEM
= 'system'¶
-
TYPE
= 'type'¶
-
USER
= 'user'¶ ‘User’ parameter
-
VALUE
= 'value'¶ ‘value’ parameter that specifies the new value to set an actuator (or sensor) to
-
-
xs1_api_client.api_constants.
VALUE_DISABLED
= 'disabled'¶ ‘Disabled’ type