Skip to content

Commit

Permalink
Merge pull request #188 from Nesurion/main
Browse files Browse the repository at this point in the history
Return None if value for enum sensor was not found in enum states
  • Loading branch information
CJNE committed Sep 30, 2023
2 parents a40293a + 8126364 commit f8ed6b7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions custom_components/sunspec/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ def native_value(self):
symbol = list(filter(lambda s: s["value"] == val, symbols))
if len(symbol) == 1:
return symbol[0]["name"][:255]
else:
return None
else:
symbols = list(
filter(lambda s: (val >> int(s["value"])) & 1 == 1, symbols)
Expand Down

0 comments on commit f8ed6b7

Please sign in to comment.