Explicitly pass in the config_entry in plaato coordinator (#138040)

explicitly pass in the config_entry in coordinator
This commit is contained in:
Michael 2025-02-09 15:02:55 +01:00 committed by GitHub
parent 15b8687c53
commit 6cdc3acffb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -121,7 +121,9 @@ async def async_setup_coordinator(hass: HomeAssistant, entry: ConfigEntry):
else:
update_interval = timedelta(minutes=DEFAULT_SCAN_INTERVAL)
coordinator = PlaatoCoordinator(hass, auth_token, device_type, update_interval)
coordinator = PlaatoCoordinator(
hass, entry, auth_token, device_type, update_interval
)
await coordinator.async_config_entry_first_refresh()
_set_entry_data(entry, hass, coordinator, auth_token)

View File

@ -5,6 +5,7 @@ import logging
from pyplaato.plaato import Plaato, PlaatoDeviceType
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import aiohttp_client
@ -18,9 +19,12 @@ _LOGGER = logging.getLogger(__name__)
class PlaatoCoordinator(DataUpdateCoordinator):
"""Class to manage fetching data from the API."""
config_entry: ConfigEntry
def __init__(
self,
hass: HomeAssistant,
config_entry: ConfigEntry,
auth_token: str,
device_type: PlaatoDeviceType,
update_interval: timedelta,
@ -34,6 +38,7 @@ class PlaatoCoordinator(DataUpdateCoordinator):
super().__init__(
hass,
_LOGGER,
config_entry=config_entry,
name=DOMAIN,
update_interval=update_interval,
)