Skip to content

Commit

Permalink
Update sensor.py
Browse files Browse the repository at this point in the history
distinguish between unavailable sensor data and no sensor data (0)
  • Loading branch information
isabellaalstrom committed May 26, 2021
1 parent faa7281 commit 05a7640
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion custom_components/grocy/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class GrocySensor(GrocyEntity):
@property
def state(self):
"""Return the state of the sensor."""
if not self.entity_data:
_LOGGER.debug("Data for {}: {}".format(self.entity_id, self.entity_data))
if self.entity_data is None:
return
if not self.entity_data:
return 0
return len(self.entity_data)

0 comments on commit 05a7640

Please sign in to comment.