bugfix evohome and bump client (#27968)
* bump client to 0.3.4b1 * handle bad schedules that cause issue #27768
This commit is contained in:
parent
22b29a8005
commit
425e7fd1a7
3 changed files with 35 additions and 28 deletions
|
@ -460,37 +460,44 @@ class EvoChild(EvoDevice):
|
|||
day_of_week = int(day_time.strftime("%w")) # 0 is Sunday
|
||||
time_of_day = day_time.strftime("%H:%M:%S")
|
||||
|
||||
# Iterate today's switchpoints until past the current time of day...
|
||||
day = self._schedule["DailySchedules"][day_of_week]
|
||||
sp_idx = -1 # last switchpoint of the day before
|
||||
for i, tmp in enumerate(day["Switchpoints"]):
|
||||
if time_of_day > tmp["TimeOfDay"]:
|
||||
sp_idx = i # current setpoint
|
||||
else:
|
||||
break
|
||||
try:
|
||||
# Iterate today's switchpoints until past the current time of day...
|
||||
day = self._schedule["DailySchedules"][day_of_week]
|
||||
sp_idx = -1 # last switchpoint of the day before
|
||||
for i, tmp in enumerate(day["Switchpoints"]):
|
||||
if time_of_day > tmp["TimeOfDay"]:
|
||||
sp_idx = i # current setpoint
|
||||
else:
|
||||
break
|
||||
|
||||
# Did the current SP start yesterday? Does the next start SP tomorrow?
|
||||
this_sp_day = -1 if sp_idx == -1 else 0
|
||||
next_sp_day = 1 if sp_idx + 1 == len(day["Switchpoints"]) else 0
|
||||
# Did the current SP start yesterday? Does the next start SP tomorrow?
|
||||
this_sp_day = -1 if sp_idx == -1 else 0
|
||||
next_sp_day = 1 if sp_idx + 1 == len(day["Switchpoints"]) else 0
|
||||
|
||||
for key, offset, idx in [
|
||||
("this", this_sp_day, sp_idx),
|
||||
("next", next_sp_day, (sp_idx + 1) * (1 - next_sp_day)),
|
||||
]:
|
||||
sp_date = (day_time + timedelta(days=offset)).strftime("%Y-%m-%d")
|
||||
day = self._schedule["DailySchedules"][(day_of_week + offset) % 7]
|
||||
switchpoint = day["Switchpoints"][idx]
|
||||
for key, offset, idx in [
|
||||
("this", this_sp_day, sp_idx),
|
||||
("next", next_sp_day, (sp_idx + 1) * (1 - next_sp_day)),
|
||||
]:
|
||||
sp_date = (day_time + timedelta(days=offset)).strftime("%Y-%m-%d")
|
||||
day = self._schedule["DailySchedules"][(day_of_week + offset) % 7]
|
||||
switchpoint = day["Switchpoints"][idx]
|
||||
|
||||
dt_local_aware = _local_dt_to_aware(
|
||||
dt_util.parse_datetime(f"{sp_date}T{switchpoint['TimeOfDay']}")
|
||||
dt_local_aware = _local_dt_to_aware(
|
||||
dt_util.parse_datetime(f"{sp_date}T{switchpoint['TimeOfDay']}")
|
||||
)
|
||||
|
||||
self._setpoints[f"{key}_sp_from"] = dt_local_aware.isoformat()
|
||||
try:
|
||||
self._setpoints[f"{key}_sp_temp"] = switchpoint["heatSetpoint"]
|
||||
except KeyError:
|
||||
self._setpoints[f"{key}_sp_state"] = switchpoint["DhwState"]
|
||||
|
||||
except IndexError:
|
||||
self._setpoints = {}
|
||||
_LOGGER.warning(
|
||||
"Failed to get setpoints - please report as an issue", exc_info=True
|
||||
)
|
||||
|
||||
self._setpoints[f"{key}_sp_from"] = dt_local_aware.isoformat()
|
||||
try:
|
||||
self._setpoints[f"{key}_sp_temp"] = switchpoint["heatSetpoint"]
|
||||
except KeyError:
|
||||
self._setpoints[f"{key}_sp_state"] = switchpoint["DhwState"]
|
||||
|
||||
return self._setpoints
|
||||
|
||||
async def _update_schedule(self) -> None:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"name": "Evohome",
|
||||
"documentation": "https://www.home-assistant.io/integrations/evohome",
|
||||
"requirements": [
|
||||
"evohome-async==0.3.3b5"
|
||||
"evohome-async==0.3.4b1"
|
||||
],
|
||||
"dependencies": [],
|
||||
"codeowners": ["@zxdavb"]
|
||||
|
|
|
@ -480,7 +480,7 @@ eternalegypt==0.0.10
|
|||
# evdev==0.6.1
|
||||
|
||||
# homeassistant.components.evohome
|
||||
evohome-async==0.3.3b5
|
||||
evohome-async==0.3.4b1
|
||||
|
||||
# homeassistant.components.dlib_face_detect
|
||||
# homeassistant.components.dlib_face_identify
|
||||
|
|
Loading…
Add table
Reference in a new issue