Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
marq24 committed Dec 5, 2024
1 parent 74e35f5 commit a53394f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion custom_components/tibber_graphapi/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand All @@ -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):
Expand All @@ -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
Expand Down

0 comments on commit a53394f

Please sign in to comment.