mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 05:37:44 +00:00
Fix lingering timer in kostal_plenticore (#92473)
This commit is contained in:
parent
6836e15d98
commit
8ab8b7152a
@ -12,7 +12,7 @@ from aiohttp.client_exceptions import ClientError
|
||||
from pykoplenti import ApiClient, ApiException, AuthenticationException
|
||||
|
||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD, EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.core import CALLBACK_TYPE, HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
@ -171,7 +171,7 @@ class PlenticoreUpdateCoordinator(DataUpdateCoordinator[_DataT]):
|
||||
self._fetch: dict[str, list[str]] = defaultdict(list)
|
||||
self._plenticore = plenticore
|
||||
|
||||
def start_fetch_data(self, module_id: str, data_id: str) -> None:
|
||||
def start_fetch_data(self, module_id: str, data_id: str) -> CALLBACK_TYPE:
|
||||
"""Start fetching the given data (module-id and data-id)."""
|
||||
self._fetch[module_id].append(data_id)
|
||||
|
||||
@ -180,7 +180,7 @@ class PlenticoreUpdateCoordinator(DataUpdateCoordinator[_DataT]):
|
||||
async def force_refresh(event_time: datetime) -> None:
|
||||
await self.async_request_refresh()
|
||||
|
||||
async_call_later(self.hass, 2, force_refresh)
|
||||
return async_call_later(self.hass, 2, force_refresh)
|
||||
|
||||
def stop_fetch_data(self, module_id: str, data_id: str) -> None:
|
||||
"""Stop fetching the given data (module-id and data-id)."""
|
||||
@ -251,7 +251,7 @@ class PlenticoreSelectUpdateCoordinator(DataUpdateCoordinator[_DataT]):
|
||||
|
||||
def start_fetch_data(
|
||||
self, module_id: str, data_id: str, all_options: list[str]
|
||||
) -> None:
|
||||
) -> CALLBACK_TYPE:
|
||||
"""Start fetching the given data (module-id and entry-id)."""
|
||||
self._fetch[module_id].append(data_id)
|
||||
self._fetch[module_id].append(all_options)
|
||||
@ -261,7 +261,7 @@ class PlenticoreSelectUpdateCoordinator(DataUpdateCoordinator[_DataT]):
|
||||
async def force_refresh(event_time: datetime) -> None:
|
||||
await self.async_request_refresh()
|
||||
|
||||
async_call_later(self.hass, 2, force_refresh)
|
||||
return async_call_later(self.hass, 2, force_refresh)
|
||||
|
||||
def stop_fetch_data(
|
||||
self, module_id: str, data_id: str, all_options: list[str]
|
||||
|
@ -188,7 +188,9 @@ class PlenticoreDataNumber(
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register this entity on the Update Coordinator."""
|
||||
await super().async_added_to_hass()
|
||||
self.coordinator.start_fetch_data(self.module_id, self.data_id)
|
||||
self.async_on_remove(
|
||||
self.coordinator.start_fetch_data(self.module_id, self.data_id)
|
||||
)
|
||||
|
||||
async def async_will_remove_from_hass(self) -> None:
|
||||
"""Unregister this entity from the Update Coordinator."""
|
||||
|
@ -127,7 +127,11 @@ class PlenticoreDataSelect(
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register this entity on the Update Coordinator."""
|
||||
await super().async_added_to_hass()
|
||||
self.coordinator.start_fetch_data(self.module_id, self.data_id, self.options)
|
||||
self.async_on_remove(
|
||||
self.coordinator.start_fetch_data(
|
||||
self.module_id, self.data_id, self.options
|
||||
)
|
||||
)
|
||||
|
||||
async def async_will_remove_from_hass(self) -> None:
|
||||
"""Unregister this entity from the Update Coordinator."""
|
||||
|
@ -769,7 +769,9 @@ class PlenticoreDataSensor(
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register this entity on the Update Coordinator."""
|
||||
await super().async_added_to_hass()
|
||||
self.coordinator.start_fetch_data(self.module_id, self.data_id)
|
||||
self.async_on_remove(
|
||||
self.coordinator.start_fetch_data(self.module_id, self.data_id)
|
||||
)
|
||||
|
||||
async def async_will_remove_from_hass(self) -> None:
|
||||
"""Unregister this entity from the Update Coordinator."""
|
||||
|
@ -144,7 +144,9 @@ class PlenticoreDataSwitch(
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register this entity on the Update Coordinator."""
|
||||
await super().async_added_to_hass()
|
||||
self.coordinator.start_fetch_data(self.module_id, self.data_id)
|
||||
self.async_on_remove(
|
||||
self.coordinator.start_fetch_data(self.module_id, self.data_id)
|
||||
)
|
||||
|
||||
async def async_will_remove_from_hass(self) -> None:
|
||||
"""Unregister this entity from the Update Coordinator."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user