1
0
mirror of https://github.com/home-assistant/core.git synced 2026-02-15 07:36:16 +00:00

Explicitly check for None in raw value processing of modbus (#153352)

This commit is contained in:
Andre Lengwenus
2025-10-01 19:48:35 +02:00
committed by GitHub
parent 8019779b3a
commit 2983f1a3b6

View File

@@ -208,7 +208,7 @@ class ModbusStructEntity(ModbusBaseEntity, RestoreEntity):
def __process_raw_value(self, entry: float | str | bytes) -> str | None:
"""Process value from sensor with NaN handling, scaling, offset, min/max etc."""
if self._nan_value and entry in (self._nan_value, -self._nan_value):
if self._nan_value is not None and entry in (self._nan_value, -self._nan_value):
return None
if isinstance(entry, bytes):
return entry.decode()