Explicitly pass in the config_entry in geocaching coordinator (#137831)

explicitly pass in the config_entry in coordinator
This commit is contained in:
Michael 2025-02-08 15:34:43 +01:00 committed by GitHub
parent 7c9312b3cf
commit 70d5685b72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,12 +18,13 @@ from .const import DOMAIN, ENVIRONMENT, LOGGER, UPDATE_INTERVAL
class GeocachingDataUpdateCoordinator(DataUpdateCoordinator[GeocachingStatus]):
"""Class to manage fetching Geocaching data from single endpoint."""
config_entry: ConfigEntry
def __init__(
self, hass: HomeAssistant, *, entry: ConfigEntry, session: OAuth2Session
) -> None:
"""Initialize global Geocaching data updater."""
self.session = session
self.entry = entry
async def async_token_refresh() -> str:
await session.async_ensure_token_valid()
@ -39,7 +40,13 @@ class GeocachingDataUpdateCoordinator(DataUpdateCoordinator[GeocachingStatus]):
token_refresh_method=async_token_refresh,
)
super().__init__(hass, LOGGER, name=DOMAIN, update_interval=UPDATE_INTERVAL)
super().__init__(
hass,
LOGGER,
config_entry=entry,
name=DOMAIN,
update_interval=UPDATE_INTERVAL,
)
async def _async_update_data(self) -> GeocachingStatus:
try: