Update modbus state when sensor fails (#49481)

This commit is contained in:
jan iversen 2021-04-20 14:54:20 +02:00 committed by GitHub
parent bc5add82e0
commit c14e525ac3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 0 deletions

View file

@ -170,6 +170,7 @@ class ModbusBinarySensor(BinarySensorEntity):
result = self._hub.read_discrete_inputs(self._slave, self._address, 1)
if result is None:
self._available = False
self.schedule_update_ha_state()
return
self._value = result.bits[0] & 1