* simplify pymodbus_call.
Do not call with a function object and a check attribute, call instead
with CALL_TYPE*.
Avoid if <type> call x else call y.
Call async_pymodbus_call directly, instead of unpacking/packing.
* Declare call type in __init__.
* Modbus.py back to 100% test coverage.
* Activate startup delay.
* Add removal of call_later if HA is stopped.
This is unlikely to happen, but just security measure.
* Removing timing interval.
async_fire_time_changed() needs to be called twice, first time the delay is
ended and second time update() is executed.
* Variable naming.
Changing the timeout from package default, secures SENDING will
timeout, and after 3 retries break off.
Remark: this commit is tested with pymodbus v2.5.1 the old version
v2.3.0 have several problems in this area.
self._value = await self.async_get_last_state()
pymodbus v2.5.1 is active on DEV (bumped in an earlier PR).
* Add missing function in class.
write_coils was missing.
* Remove dead code.
The HA configuration secures that CONF_TYPE only contains legal values,
so having an empty assert to catch unknown values is dead code.
An empty assert is not informative.
* Reuse HA constants for serial configuration.
Reusing HA consts reduces the need for translation.
Sort/group constants in const.
* Change const name ATTR_* to CONF_*
* Correct wrong import
* ATTR_* for service and CONF_* for schemas.
* Revert change to service call.
* Rename CONF_TEMPERATURE -> ATTR_TEMPERATURE
Avoid possible division problem in set_temperature.
* WRITE_COIL uses write_coils in case of an array.
WRITE_REGISTER uses write_register/write_registers depending
on whether value is singular or an array.
WRITE_COIL is modified to be similar and uses
write_coil/write_coils depending on whether value is singular or an
array.
* Update SERVICE_WRITE_COIL to allow list.
* Change modbus configuration to new style.
The old (frozen) configuration is still supported, but when detected a big
warning is issued that it will soon be removed. This allows users to change
their configuration at their pace.
Clean configuration SCHEMAs and move common modbus parts
to MODBUS_SCHEMA (renamed from BASE_SCHEMA).
Add BASE_COMPONENT_SCHEMA to ensure common configuration of components.
All component define e.g. NAME, move these to a common schema.
change components (binary_sensor, sensor, switch) to new config
Add test set for modbus itself (old config and discovery_info).
Add test of devices discovery_info configuration
* Update discovery_info configuration for binary_sensor.
* Update discovery_info configuration for sensor.
* Update discovery_info configuration for switch.
* Review comments.
* update due to change in core
* flake8 problem.
* Correct log message.
* add should_poll property.
* Fix polling for Modbus binary sensor
* Fix polling for Modbus sensor
* Fix polling for Modbus switch
* Fix switch.
* Fix pytest errors.
* Update homeassistant/components/modbus/binary_sensor.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/modbus/binary_sensor.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/modbus/modbus.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/modbus/sensor.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/modbus/sensor.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/modbus/sensor.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/modbus/switch.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/modbus/switch.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/modbus/switch.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* ToogleEntity -> SwitchEntity and add abastract
* Update homeassistant/components/modbus/switch.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update tests/components/modbus/test_init.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* removed if/else in test.
* Remove other if.
Co-authored-by: Vladimir Zahradnik <vladimir@zahradnik.io>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>