Skip to content

Commit 92bc0cc

Browse files
committed
coordinator: warn when a register converter returns None
The heating season sensor shows as N/A in HA with no indication why. Add a warning log whenever a register's converter returns None so the unexpected raw device value is visible in the HA log. This makes the root cause diagnosable without requiring debug-level logging. Signed-off-by: Tomáš Hozza <thozza@gmail.com>
1 parent e7913e8 commit 92bc0cc

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

custom_components/atrea_rd5_modbus/coordinator.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,16 @@ async def _async_update_data(self) -> dict[str, Any]:
9191
raw = result.registers
9292

9393
for i, key in enumerate(group.keys):
94-
data[key] = REGISTER_MAP[key].convert(raw[i])
94+
converted = REGISTER_MAP[key].convert(raw[i])
95+
if converted is None:
96+
_LOGGER.warning(
97+
"Register %s (addr=%d) returned unexpected raw value %r — "
98+
"converter produced None; entity will be unavailable",
99+
key,
100+
REGISTER_MAP[key].address,
101+
raw[i],
102+
)
103+
data[key] = converted
95104

96105
except Exception as err:
97106
_LOGGER.warning(

0 commit comments

Comments
 (0)