From dbbe3d41380c8ad16c8d0d7afec12b0adce13a23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Dalfors?= Date: Fri, 24 Nov 2023 23:16:12 +0100 Subject: [PATCH] fix(sensor): error code sensor value should be None if not present in data set --- custom_components/saleryd_hrv/sensor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/custom_components/saleryd_hrv/sensor.py b/custom_components/saleryd_hrv/sensor.py index 72a742e..2db3c54 100644 --- a/custom_components/saleryd_hrv/sensor.py +++ b/custom_components/saleryd_hrv/sensor.py @@ -104,12 +104,12 @@ def _translate_value(self, value): except TypeError as exc: _LOGGER.debug(exc) - if self.entity_description.key == "*EB": - return any(value) - if value is None: return value + if self.entity_description.key == "*EB": + return any(value) + value = value[0] if isinstance(value, list) else value if self.entity_description.key == "MG":