From 422d1afbb7f752fadffcfaae7fef92710cef60c0 Mon Sep 17 00:00:00 2001 From: Julian Pawlowski Date: Mon, 6 Apr 2026 14:19:25 +0000 Subject: [PATCH] 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. --- .../tibber_prices/coordinator/period_handlers/relaxation.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/custom_components/tibber_prices/coordinator/period_handlers/relaxation.py b/custom_components/tibber_prices/coordinator/period_handlers/relaxation.py index 41c7aa5..2a73448 100644 --- a/custom_components/tibber_prices/coordinator/period_handlers/relaxation.py +++ b/custom_components/tibber_prices/coordinator/period_handlers/relaxation.py @@ -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(