Skip to content

Commit

Permalink
Merge pull request #144 from custom-components/dev/fix-unknown
Browse files Browse the repository at this point in the history
Update sensor.py
  • Loading branch information
isabellaalstrom authored May 26, 2021
2 parents faa7281 + 05a7640 commit 2343c49
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 2343c49

Please sign in to comment.