Commit Graph

67 Commits (596644d715ff206db293725c3e9e441a27b1e918)

Author SHA1 Message Date
Tathar 16e5d7abe1
Add unique_id to modbus entities (#64634)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2022-01-26 10:37:15 +01:00
jan iversen 42803e6ac0
Clean startup of modbus by moving service schemas (#57763) 2021-10-15 09:40:27 -07:00
jan iversen 4417ffb407
COnvert DATA_TYPE to enum. (#57699) 2021-10-15 07:09:59 +02:00
Robert Hillis 488a636aec
Clean up unused loggers (#57662) 2021-10-14 10:03:38 -07:00
jan iversen c7c789f618
Strictly type modbus __init__.py, validator.py (#56378)
* strictly type: __init__.py, validator.py
2021-09-21 13:43:41 +02:00
jan iversen aaa62dadec
Add service to stop/restart modbus (#55599)
* Add service to stop/restart modbus.

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-09-14 09:42:50 +02:00
Matthias Alphart cd0ae66d58
Add CONF_STATE_CLASS to `sensor/__init__.py` (#54106)
* add CONF_STATE_CLASS to const.py

* move to `sensor/__init__.py`

* move to sensor/const.py

* Revert "move to sensor/const.py"

This reverts commit 604d0d066b.

* move it to `sensor/const.py` but import it from `sensor/__init__.py`

* add Modbus
2021-08-27 05:54:50 +02:00
jan iversen 7df8d0c973
Check for duplicate host/port and integration name in modbus (#54664)
* Check for duplicate host/port and integration name.

* Change to use set().

* Please CI.

* Add basic tests.
2021-08-25 12:29:00 +02:00
Matthias Alphart 51361fbd2b
Add configurable `state_class` to Modbus sensors (#54103)
* add configurable state_class

* Add test of new parameter.

Co-authored-by: jan Iversen <jancasacondor@gmail.com>
2021-08-25 11:50:54 +02:00
jan iversen 33f660118f
Add lazy_error_count to modbus (#54412)
* Add lazy_error_count.

* Use -=

* Review comments.
2021-08-21 15:49:50 +02:00
jan iversen 0688aaa2b6
Check for duplicate entity name/address in modbus entities (#54669)
* Check for duplicate entity name/address.
2021-08-19 09:37:31 +02:00
jan iversen bafbbc6563
Adjust modbus constants names (#54792)
* Follow up.
2021-08-18 12:56:54 +02:00
jan iversen e8aa280d7f
Add modbus get_hub (#54277)
* Add dict with hubs.

* Update flexit to use get_hub.

* Remove executor_task for close.
2021-08-08 22:48:33 +02:00
jan iversen 2232915ea8
Add parameter to delay sending of requests in modbus (#54203) 2021-08-07 21:10:08 -07:00
jan iversen 0f8a286cc7
Allow combinations write_coil/read_coils and write_coils/read_coil for modbus switch (#53856) 2021-08-02 14:55:52 +02:00
jan iversen 7306503756
Calculate count automatically in modbus platforms (#53116) 2021-07-20 22:49:54 -07:00
jan iversen 646862ec96
Add array write to turn_on/off in modbus switch/fan/light (#52582) 2021-07-12 11:22:53 -07:00
jan iversen 2ecfd74fa4
Add more data_types to modbus (#52423)
* Add more data_types.

* Use new struct when writing temperature.
2021-07-12 07:58:45 +02:00
jan iversen f1303e02ff
Let climate use base_struct_schema. (#52154) 2021-06-28 22:21:31 -07:00
jan iversen 1f4fdb50dc
Share struct validator between sensor and climate (#51935) 2021-06-23 11:03:17 -07:00
jan iversen bc329cb602
Convert if/elif chains to dicts in modbus (#51962) 2021-06-18 11:20:44 +02:00
jan iversen 7ad91fdf71
Add swap to climate and change data_count -> count in modbus (#51668) 2021-06-16 12:11:23 +02:00
jan iversen 2a51587bc3
Remove reverse_order (replaced by generic swap) (#51665)
Remove reverse_order (replaced by generic swap).
2021-06-11 11:41:41 +02:00
jan iversen 9e378d51af
Reduce modbus schemas and add delay to fan/light (#51664) 2021-06-11 09:22:47 +02:00
jan iversen 50001684aa
Add retries/retry_on_empty configuration parameters to Modbus (#51412)
* Add retries/retry_on_empty configuration parameters.

* Please review comment.
2021-06-06 09:13:50 +02:00
jan iversen 538a189168
Adjust modbus climate to use address/input_type (#51202) 2021-05-28 17:57:14 +02:00
jan iversen 00507539c1
Change Cover to use address/input_type (#51154)
* Change Cover to use address/input_type.

* Flake.
2021-05-28 13:23:44 +02:00
jan iversen 5afd16ef5d
Move modbus schema validators to validators.py (#51121) 2021-05-28 11:38:31 +02:00
Yuriy Sannikov 6391d75919
Refactor ModbusRegisterSensor class to get hub and configuration (#50234)
* refactor ModbusRegisterSensor to match the ModbusSwitch interface

* Please pylint, mypy etc.

* Remove PLATFORM.

Co-authored-by: jan Iversen <jancasacondor@gmail.com>
2021-05-26 19:28:14 +02:00
jan iversen be13a73db8
Allow manual scan and add delay in switch verify. (#50974) 2021-05-24 12:59:55 +02:00
Vladimír Záhradník c979101a02
Add Modbus fan integration (#48558)
* Add Modbus fan entity

* Update to PR.

* Pylint.

Co-authored-by: jan Iversen <jancasacondor@gmail.com>
2021-05-21 09:56:47 +02:00
Vladimír Záhradník 80d172140f
Add Modbus light integration (#42120)
* Add  Modbus Light and add unit tests

* Update to original PR.

* Review comments.

* Review 2.

Co-authored-by: jan Iversen <jancasacondor@gmail.com>
2021-05-21 08:57:17 +02:00
jan iversen ad7be91b6a
Fix modbus blocking threads (#50619)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-05-15 19:54:17 +02:00
jan iversen 19cdff10c3
Add "close_comm_on_error" to modbus configuration (#50583) 2021-05-14 10:54:23 +02:00
jan iversen 70b09ed9a1
Handle relation between scan_interval and pymodbus timeout in modbus (#50363)
* Control scan_interval compared to pymodbus timeout.

add MINIMUM_SCAN_INTERVAL=5 seconds and validata with Voluptous.
Keep modbus.py 100% coverage.

* Please pylint.

* Review comments.

* pylint.
2021-05-10 19:28:38 +02:00
jan iversen 552ca1c57b
Fix modbus switch problems (#50117) 2021-05-07 22:12:13 +02:00
jan iversen 684ea9e49b
Restructure modbus switch, and solve read/write conflicts (#49386)
Remove old style configuration from switch.
- The old style configuration allowed a number of illegal
  configurations, instead of adding if...log. in setup we
  only support the new configuration style.

Add new/changed configuration switch.

Removed verify_state and cleaned configuration to avoid possible
illegal configurations.
2021-04-30 16:47:18 +02:00
jan iversen e5e215353d
Add swap byte/word/byteword option to modbus sensor (#49719)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-04-27 10:49:41 +02:00
Marc Mueller 1a38d2089d
Bump python-typing-update to v0.3.3 (#48992)
* Bump python-typing-update to 0.3.3
* Changes after update
2021-04-10 15:21:11 +02:00
jan iversen 2511e1f229
Remove modbus duplicate strings (#48654)
* 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.
2021-04-04 14:02:47 +02:00
jan iversen 23fae255ff
Make modbus WRITE_COIL use write_coils in case of an array (#48633)
* 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.
2021-04-03 13:15:01 +02:00
jan iversen cee43b0670
Add modbus CONF_VERIFY_STATE to new switch config (#48632)
Missed CONF_VERIFY_STATE in new switch config, when
copying from old switch config.
2021-04-03 11:00:06 +02:00
jan iversen ffdfc521b9
Allow discovery configuration of modbus platforms (#46591)
* 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>
2021-03-27 22:48:06 +01:00
tkdrob a5a45f29e2
Cleanup unused loggers (#46510) 2021-02-14 13:46:58 +01:00
jan iversen 8418489345
Allow Modbus "old" config or discovery_info as configuration (#46445) 2021-02-12 16:33:18 +01:00
tkdrob c75e63dc95
Use core constants for modbus (#46388) 2021-02-11 07:58:16 -05:00
Vladimír Záhradník ba84d0bf5c
Add custom data type support into Modbus climate (#32439) 2020-10-07 22:43:16 +02:00
Vladimír Záhradník 1d41f024cf
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
2020-09-26 11:11:51 -05:00
jan iversen 1b3f9254bc
Add retry on empty modbus messages for serial protocol (#34678) 2020-05-06 14:08:43 +02:00
jan iversen 8277ebcbe1
Rollback modbus to version 0.107.7 keep new functionality (#34287)
* Rollback modbus to version 0.107.7

Update manifest to not use async.

Rollback entities to sync version.

Keep newer modifications apart from async.

Rollback __init__ to sync version but keep the new functionality.

add async sub directory

Adding the current (not working) version in a sub directory,
to allow easy sharing with a few alfa testers.

The async version are to be updated to use the serial/tcp already
available instead of the flaky pymodbus version. pymodbus is still
needed to encode/decode the messagess.

Update test cases to reflect sync implementation, but
keep the new functionality like e.g. conftest.py.

* do not publish async version

The async version will be made available in a forked repo, until
it is ready to replace the production code.
2020-04-17 09:55:57 +02:00