mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 22:37:11 +00:00
Add modbus write coils (#48676)
* 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.
This commit is contained in:
parent
b34cc7ef2c
commit
d5ef382fd5
@ -182,8 +182,6 @@ class ModbusHub:
|
||||
port=self._config_port,
|
||||
timeout=self._config_timeout,
|
||||
)
|
||||
else:
|
||||
assert False
|
||||
|
||||
# Connect device
|
||||
self.connect()
|
||||
@ -228,6 +226,12 @@ class ModbusHub:
|
||||
kwargs = {"unit": unit} if unit else {}
|
||||
self._client.write_coil(address, value, **kwargs)
|
||||
|
||||
def write_coils(self, unit, address, value):
|
||||
"""Write coil."""
|
||||
with self._lock:
|
||||
kwargs = {"unit": unit} if unit else {}
|
||||
self._client.write_coils(address, value, **kwargs)
|
||||
|
||||
def write_register(self, unit, address, value):
|
||||
"""Write register."""
|
||||
with self._lock:
|
||||
|
Loading…
x
Reference in New Issue
Block a user