Skip to content

Commit

Permalink
unavailable logic
Browse files Browse the repository at this point in the history
Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
  • Loading branch information
travisghansen committed Jan 30, 2023
1 parent 0ac653d commit bd1f93e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v0.5.15

Released 2023-01-29

- better unavailable logic

# v0.5.14

Released 2023-01-29
Expand Down
7 changes: 7 additions & 0 deletions custom_components/pfsense/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,13 @@ def available(self) -> bool:
if gateway is None or property not in gateway.keys():
return False

if property in ["stddev", "delay", "loss"]:
value = gateway[property]
if isinstance(value, str):
value = re.sub("[^0-9\.]*", "", value)
if len(value) < 1:
return False

return super().available

@property
Expand Down

0 comments on commit bd1f93e

Please sign in to comment.