mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
Guard against missing data in ReCollect Waste (#59177)
This commit is contained in:
parent
c5b5c8c3ce
commit
3d0d038597
@ -78,8 +78,13 @@ class ReCollectWasteSensor(CoordinatorEntity, SensorEntity):
|
|||||||
@callback
|
@callback
|
||||||
def update_from_latest_data(self) -> None:
|
def update_from_latest_data(self) -> None:
|
||||||
"""Update the state."""
|
"""Update the state."""
|
||||||
|
try:
|
||||||
pickup_event = self.coordinator.data[0]
|
pickup_event = self.coordinator.data[0]
|
||||||
next_pickup_event = self.coordinator.data[1]
|
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(
|
self._attr_extra_state_attributes.update(
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user