diff --git a/homeassistant/components/modbus/modbus.py b/homeassistant/components/modbus/modbus.py index 099289d8472..0a5422ff6be 100644 --- a/homeassistant/components/modbus/modbus.py +++ b/homeassistant/components/modbus/modbus.py @@ -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: