mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 09:47:52 +00:00
Explicitly pass in the config_entry in openexchangerates coordinator (#138053)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
62f9d9e6d3
commit
28f83cefda
@ -33,6 +33,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
update_interval = BASE_UPDATE_INTERVAL * (len(existing_coordinator_for_api_key) + 1)
|
||||
coordinator = OpenexchangeratesCoordinator(
|
||||
hass,
|
||||
entry,
|
||||
async_get_clientsession(hass),
|
||||
api_key,
|
||||
base,
|
||||
|
@ -13,6 +13,7 @@ from aioopenexchangerates import (
|
||||
OpenExchangeRatesClientError,
|
||||
)
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryAuthFailed
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
@ -23,9 +24,12 @@ from .const import CLIENT_TIMEOUT, DOMAIN, LOGGER
|
||||
class OpenexchangeratesCoordinator(DataUpdateCoordinator[Latest]):
|
||||
"""Represent a coordinator for Open Exchange Rates API."""
|
||||
|
||||
config_entry: ConfigEntry
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
session: ClientSession,
|
||||
api_key: str,
|
||||
base: str,
|
||||
@ -33,7 +37,11 @@ class OpenexchangeratesCoordinator(DataUpdateCoordinator[Latest]):
|
||||
) -> None:
|
||||
"""Initialize the coordinator."""
|
||||
super().__init__(
|
||||
hass, LOGGER, name=f"{DOMAIN} base {base}", update_interval=update_interval
|
||||
hass,
|
||||
LOGGER,
|
||||
config_entry=config_entry,
|
||||
name=f"{DOMAIN} base {base}",
|
||||
update_interval=update_interval,
|
||||
)
|
||||
self.base = base
|
||||
self.client = Client(api_key, session)
|
||||
|
Loading…
x
Reference in New Issue
Block a user