Skip to content

Commit

Permalink
Merge pull request #559 from fersingb/main
Browse files Browse the repository at this point in the history
Reduce the race condition probability
  • Loading branch information
ic-dev21 authored Feb 1, 2025
2 parents 2289312 + cf0fefc commit 6b5eef8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions custom_components/hilo/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ async def async_added_to_hass(self):
self._next_events = last_state.attributes.get("next_events", [])

async def _async_update(self):
self._next_events = []
tmp_next_events = []
events = await self._hilo._api.get_gd_events(self._hilo.devices.location_id)
LOG.debug(f"Events received from Hilo: {events}")
for raw_event in events:
Expand All @@ -794,7 +794,8 @@ async def _async_update(self):
event.appreciation(self._hilo.appreciation)
if self._hilo.pre_cold > 0:
event.pre_cold(self._hilo.pre_cold)
self._next_events.append(event.as_dict())
tmp_next_events.append(event.as_dict())
self._next_events = tmp_next_events


class DeviceSensor(HiloEntity, SensorEntity):
Expand Down

0 comments on commit 6b5eef8

Please sign in to comment.