Harden evohome against failures to retrieve zone schedules (#118517)

This commit is contained in:
David Bonnes 2024-06-03 20:48:48 +01:00 committed by GitHub
parent ff27f8ef10
commit 8ea3a6843a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -657,16 +657,18 @@ class EvoChild(EvoDevice):
assert isinstance(self._evo_device, evo.HotWater | evo.Zone) # mypy check assert isinstance(self._evo_device, evo.HotWater | evo.Zone) # mypy check
try: try:
self._schedule = await self._evo_broker.call_client_api( # type: ignore[assignment] schedule = await self._evo_broker.call_client_api(
self._evo_device.get_schedule(), update_state=False self._evo_device.get_schedule(), update_state=False
) )
except evo.InvalidSchedule as err: except evo.InvalidSchedule as err:
_LOGGER.warning( _LOGGER.warning(
"%s: Unable to retrieve the schedule: %s", "%s: Unable to retrieve a valid schedule: %s",
self._evo_device, self._evo_device,
err, err,
) )
self._schedule = {} self._schedule = {}
else:
self._schedule = schedule or {}
_LOGGER.debug("Schedule['%s'] = %s", self.name, self._schedule) _LOGGER.debug("Schedule['%s'] = %s", self.name, self._schedule)