Add Modbus cover (#33642)

* 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
This commit is contained in:
Vladimír Záhradník
2020-09-26 18:11:51 +02:00
committed by GitHub
parent 2f4aa35ca6
commit 1d41f024cf
5 changed files with 323 additions and 10 deletions

View File

@@ -46,6 +46,7 @@ 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"
@@ -71,3 +72,12 @@ 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