From 3b87cc67e5c7e9cdc8ce50532da8e029438e97b8 Mon Sep 17 00:00:00 2001 From: Julian Pawlowski Date: Sun, 2 Nov 2025 23:53:16 +0000 Subject: [PATCH] fix reload --- custom_components/tibber_prices/__init__.py | 3 ++- custom_components/tibber_prices/coordinator.py | 2 +- custom_components/tibber_prices/sensor.py | 3 --- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/custom_components/tibber_prices/__init__.py b/custom_components/tibber_prices/__init__.py index 106ce58..55863ea 100644 --- a/custom_components/tibber_prices/__init__.py +++ b/custom_components/tibber_prices/__init__.py @@ -67,10 +67,11 @@ async def async_setup_entry( # https://developers.home-assistant.io/docs/integration_fetching_data#coordinated-single-api-poll-for-data-for-all-entities if entry.state == ConfigEntryState.SETUP_IN_PROGRESS: await coordinator.async_config_entry_first_refresh() - entry.async_on_unload(entry.add_update_listener(async_reload_entry)) else: await coordinator.async_refresh() + entry.async_on_unload(entry.add_update_listener(async_reload_entry)) + await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) return True diff --git a/custom_components/tibber_prices/coordinator.py b/custom_components/tibber_prices/coordinator.py index 00df7a2..10ff92b 100644 --- a/custom_components/tibber_prices/coordinator.py +++ b/custom_components/tibber_prices/coordinator.py @@ -134,7 +134,7 @@ class TibberPricesDataUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]): async def async_shutdown(self) -> None: """Shut down the coordinator and clean up timers.""" if self._quarter_hour_timer_handle: - self._quarter_hour_timer_handle() + self._quarter_hour_timer_handle.cancel() self._quarter_hour_timer_handle = None def _has_existing_main_coordinator(self) -> bool: diff --git a/custom_components/tibber_prices/sensor.py b/custom_components/tibber_prices/sensor.py index 45aea30..ccff399 100644 --- a/custom_components/tibber_prices/sensor.py +++ b/custom_components/tibber_prices/sensor.py @@ -5,9 +5,6 @@ from __future__ import annotations from datetime import date, datetime, timedelta from typing import TYPE_CHECKING, Any -if TYPE_CHECKING: - from collections.abc import Callable - from homeassistant.components.sensor import ( SensorDeviceClass, SensorEntity,