forked from home-assistant/core
Guard against missing data in ReCollect Waste (#59177)
This commit is contained in:
committed by
Paulus Schoutsen
parent
3d8ca26c00
commit
f47e64e218
@@ -91,8 +91,13 @@ class ReCollectWasteSensor(CoordinatorEntity, SensorEntity):
|
||||
@callback
|
||||
def update_from_latest_data(self) -> None:
|
||||
"""Update the state."""
|
||||
pickup_event = self.coordinator.data[0]
|
||||
next_pickup_event = self.coordinator.data[1]
|
||||
try:
|
||||
pickup_event = self.coordinator.data[0]
|
||||
next_pickup_event = self.coordinator.data[1]
|
||||
except IndexError:
|
||||
self._attr_native_value = None
|
||||
self._attr_extra_state_attributes = {}
|
||||
return
|
||||
|
||||
self._attr_extra_state_attributes.update(
|
||||
{
|
||||
|
Reference in New Issue
Block a user