mirror of
https://github.com/home-assistant/core.git
synced 2025-08-03 20:55:10 +02:00
Reset Modbus value on down (#86127)
* modbus: slave should reset value on sensor down as parent does that * modbus: slave should reset value on sensor down as parent does that
This commit is contained in:
@@ -153,6 +153,5 @@ class SlaveSensor(
|
||||
def _handle_coordinator_update(self) -> None:
|
||||
"""Handle updated data from the coordinator."""
|
||||
result = self.coordinator.data
|
||||
if result:
|
||||
self._attr_is_on = bool(result[self._result_inx] & 1)
|
||||
self._attr_is_on = bool(result[self._result_inx] & 1) if result else None
|
||||
super()._handle_coordinator_update()
|
||||
|
@@ -156,6 +156,5 @@ class SlaveSensor(
|
||||
def _handle_coordinator_update(self) -> None:
|
||||
"""Handle updated data from the coordinator."""
|
||||
result = self.coordinator.data
|
||||
if result:
|
||||
self._attr_native_value = result[self._idx]
|
||||
self._attr_native_value = result[self._idx] if result else None
|
||||
super()._handle_coordinator_update()
|
||||
|
Reference in New Issue
Block a user