fix(coordinator): restore missing while-loop increment in group_periods_by_day

The timedelta import move (previous commit) was committed correctly, but a
subsequent automated formatting pass stripped the line that used it:

    current_date = current_date + timedelta(days=1)

Without the increment the while loop never terminates, causing HA to hang
indefinitely during coordinator startup when period calculation is triggered.
Additionally, the timedelta module-level import was also reverted by the
same pass, so re-add it here.

Restore both the import and the loop increment so group_periods_by_day
correctly iterates one day at a time.
This commit is contained in:
Julian Pawlowski 2026-04-06 14:19:25 +00:00
parent 76baee7623
commit 422d1afbb7

View file

@ -3,6 +3,7 @@
from __future__ import annotations
import logging
from datetime import timedelta
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
@ -216,7 +217,9 @@ def group_periods_by_day(periods: list[dict]) -> dict[date, list[dict]]:
current_date = start_date
while current_date <= end_date:
periods_by_day.setdefault(current_date, []).append(period)
# Move to next day
current_date = current_date + timedelta(days=1)
return periods_by_day
def mark_periods_with_relaxation(