* Add Modbus cover * Fix improper commands written for Modbus cover via coil * Make changes per review comments * Fix default hub not defined Since support for multiple hubs was added, the default hub option was not implemented correctly. Now I added necessary logic to make it work. First hub in a list will be used as a default hub. * Move Cover config under Modbus section * Revert setting up a default hub alias * Make hub mandatory for Cover * Add default scan interval * Read scan_interval from discovery info * Fix linter error * Use default scan interval from Cover platform * Handle polling for Modbus cover directly inside entity * Move covers under hub config * Fix for review comment * Call update() from Cover actuator methods * Fix time validation
83 lines
2.1 KiB
Python
83 lines
2.1 KiB
Python
"""Constants used in modbus integration."""
|
|
|
|
# configuration names
|
|
CONF_BAUDRATE = "baudrate"
|
|
CONF_BYTESIZE = "bytesize"
|
|
CONF_HUB = "hub"
|
|
CONF_PARITY = "parity"
|
|
CONF_STOPBITS = "stopbits"
|
|
CONF_REGISTER = "register"
|
|
CONF_REGISTER_TYPE = "register_type"
|
|
CONF_REGISTERS = "registers"
|
|
CONF_REVERSE_ORDER = "reverse_order"
|
|
CONF_SCALE = "scale"
|
|
CONF_COUNT = "count"
|
|
CONF_PRECISION = "precision"
|
|
CONF_OFFSET = "offset"
|
|
CONF_COILS = "coils"
|
|
|
|
# integration names
|
|
DEFAULT_HUB = "default"
|
|
MODBUS_DOMAIN = "modbus"
|
|
|
|
# data types
|
|
DATA_TYPE_CUSTOM = "custom"
|
|
DATA_TYPE_FLOAT = "float"
|
|
DATA_TYPE_INT = "int"
|
|
DATA_TYPE_UINT = "uint"
|
|
DATA_TYPE_STRING = "string"
|
|
|
|
# call types
|
|
CALL_TYPE_COIL = "coil"
|
|
CALL_TYPE_DISCRETE = "discrete_input"
|
|
CALL_TYPE_REGISTER_HOLDING = "holding"
|
|
CALL_TYPE_REGISTER_INPUT = "input"
|
|
|
|
# the following constants are TBD.
|
|
# changing those in general causes a breaking change, because
|
|
# the contents of configuration.yaml needs to be updated,
|
|
# therefore they are left to a later date.
|
|
# but kept here, with a reference to the file using them.
|
|
|
|
# __init.py
|
|
ATTR_ADDRESS = "address"
|
|
ATTR_HUB = "hub"
|
|
ATTR_UNIT = "unit"
|
|
ATTR_VALUE = "value"
|
|
SERVICE_WRITE_COIL = "write_coil"
|
|
SERVICE_WRITE_REGISTER = "write_register"
|
|
DEFAULT_SCAN_INTERVAL = 15 # seconds
|
|
|
|
# binary_sensor.py
|
|
CONF_INPUTS = "inputs"
|
|
CONF_INPUT_TYPE = "input_type"
|
|
CONF_ADDRESS = "address"
|
|
|
|
# sensor.py
|
|
# CONF_DATA_TYPE = "data_type"
|
|
|
|
# switch.py
|
|
CONF_STATE_OFF = "state_off"
|
|
CONF_STATE_ON = "state_on"
|
|
CONF_VERIFY_REGISTER = "verify_register"
|
|
CONF_VERIFY_STATE = "verify_state"
|
|
|
|
# climate.py
|
|
CONF_TARGET_TEMP = "target_temp_register"
|
|
CONF_CURRENT_TEMP = "current_temp_register"
|
|
CONF_CURRENT_TEMP_REGISTER_TYPE = "current_temp_register_type"
|
|
CONF_DATA_TYPE = "data_type"
|
|
CONF_DATA_COUNT = "data_count"
|
|
CONF_UNIT = "temperature_unit"
|
|
CONF_MAX_TEMP = "max_temp"
|
|
CONF_MIN_TEMP = "min_temp"
|
|
CONF_STEP = "temp_step"
|
|
|
|
# cover.py
|
|
CONF_STATE_OPEN = "state_open"
|
|
CONF_STATE_CLOSED = "state_closed"
|
|
CONF_STATE_OPENING = "state_opening"
|
|
CONF_STATE_CLOSING = "state_closing"
|
|
CONF_STATUS_REGISTER = "status_register"
|
|
CONF_STATUS_REGISTER_TYPE = "status_register_type"
|
|
DEFAULT_SLAVE = 1
|