From a53394f8fcbe5dbd863282710e5267d47be5b1b6 Mon Sep 17 00:00:00 2001 From: marq24 Date: Thu, 5 Dec 2024 13:53:18 +0100 Subject: [PATCH] . --- custom_components/tibber_graphapi/binary_sensor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/custom_components/tibber_graphapi/binary_sensor.py b/custom_components/tibber_graphapi/binary_sensor.py index 526f681..e8b71e2 100644 --- a/custom_components/tibber_graphapi/binary_sensor.py +++ b/custom_components/tibber_graphapi/binary_sensor.py @@ -34,6 +34,7 @@ def __init__(self, coordinator: TibberGraphApiDataUpdateCoordinator, description @property def is_on(self) -> bool | None: + value = None try: if self.coordinator.data is not None: if hasattr(self.entity_description, "tag"): @@ -54,7 +55,6 @@ def is_on(self) -> bool | None: except (IndexError, ValueError, TypeError) as ex: _LOGGER.warning(f"Error for binary_sensor '{self.entity_description.key}': {ex}") - value = None if value is not None: if not isinstance(value, bool): @@ -67,6 +67,7 @@ def is_on(self) -> bool | None: else: value = False else: + _LOGGER.warning(f"binary_sensor '{self.entity_description.key}' value is None") value = False return value