Skip to content

Commit

Permalink
If None make sensor unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
drc38 authored Feb 9, 2023
1 parent 1f99be3 commit d38dff4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion custom_components/solarweb/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ def __init__(
@property
def available(self):
"""Return if online."""
return self.coordinator.data["status"]["isOnline"]
online = self.coordinator.data["status"]["isOnline"]
not_none = self.native_value is not None
return online and not_none

@property
def native_value(self):
Expand Down

0 comments on commit d38dff4

Please sign in to comment.