Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Commit

Permalink
Fix a bug with jumbo live sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
peternijssen committed Mar 29, 2021
1 parent 55e810d commit ff373ad
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions custom_components/jumbo/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,13 @@ async def async_update(self):
self._state = None

deliveries = self._data.open_deliveries
if 0 not in deliveries:
if len(deliveries) == 0:
return

self._state = deliveries[0].eta_live
self._attributes[ATTR_ETA_START] = deliveries[0].eta_start
self._attributes[ATTR_ETA_END] = deliveries[0].eta_end
delivery = next(iter(deliveries))
self._state = delivery.eta_live
self._attributes[ATTR_ETA_START] = delivery.eta_start
self._attributes[ATTR_ETA_END] = delivery.eta_end

@property
def name(self):
Expand Down

0 comments on commit ff373ad

Please sign in to comment.