mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Update modbus state when sensor fails (#49481)
This commit is contained in:
parent
bc5add82e0
commit
c14e525ac3
@ -619,6 +619,7 @@ omit =
|
|||||||
homeassistant/components/modbus/modbus.py
|
homeassistant/components/modbus/modbus.py
|
||||||
homeassistant/components/modbus/switch.py
|
homeassistant/components/modbus/switch.py
|
||||||
homeassistant/components/modbus/sensor.py
|
homeassistant/components/modbus/sensor.py
|
||||||
|
homeassistant/components/modbus/binary_sensor.py
|
||||||
homeassistant/components/modem_callerid/sensor.py
|
homeassistant/components/modem_callerid/sensor.py
|
||||||
homeassistant/components/motion_blinds/__init__.py
|
homeassistant/components/motion_blinds/__init__.py
|
||||||
homeassistant/components/motion_blinds/const.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)
|
result = self._hub.read_discrete_inputs(self._slave, self._address, 1)
|
||||||
if result is None:
|
if result is None:
|
||||||
self._available = False
|
self._available = False
|
||||||
|
self.schedule_update_ha_state()
|
||||||
return
|
return
|
||||||
|
|
||||||
self._value = result.bits[0] & 1
|
self._value = result.bits[0] & 1
|
||||||
|
@ -294,6 +294,7 @@ class ModbusRegisterSensor(RestoreEntity, SensorEntity):
|
|||||||
)
|
)
|
||||||
if result is None:
|
if result is None:
|
||||||
self._available = False
|
self._available = False
|
||||||
|
self.schedule_update_ha_state()
|
||||||
return
|
return
|
||||||
|
|
||||||
registers = result.registers
|
registers = result.registers
|
||||||
|
Loading…
x
Reference in New Issue
Block a user