Skip to content

Commit

Permalink
Return state 0 if pollen level is -1 (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohNan authored Sep 7, 2023
1 parent 6d83496 commit dec2b10
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion custom_components/pollenprognos/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def name(self):
def state(self):
"""Return the state of the device."""
today = next(item for item in self._allergen.get('days', []) if item['day'] == 0)
return today.get('level', 'n/a')
state = today.get('level', 'n/a')
return 0 if state == -1 else state

@property
def extra_state_attributes(self):
Expand Down

0 comments on commit dec2b10

Please sign in to comment.