Update modbus state when sensor fails (#49481)
This commit is contained in:
parent
bc5add82e0
commit
c14e525ac3
3 changed files with 3 additions and 0 deletions
|
@ -619,6 +619,7 @@ omit =
|
|||
homeassistant/components/modbus/modbus.py
|
||||
homeassistant/components/modbus/switch.py
|
||||
homeassistant/components/modbus/sensor.py
|
||||
homeassistant/components/modbus/binary_sensor.py
|
||||
homeassistant/components/modem_callerid/sensor.py
|
||||
homeassistant/components/motion_blinds/__init__.py
|
||||
homeassistant/components/motion_blinds/const.py
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -294,6 +294,7 @@ class ModbusRegisterSensor(RestoreEntity, SensorEntity):
|
|||
)
|
||||
if result is None:
|
||||
self._available = False
|
||||
self.schedule_update_ha_state()
|
||||
return
|
||||
|
||||
registers = result.registers
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue