mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Explicitly pass in the config_entry in lastfm coordinator (#138117)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
8234c9a183
commit
b9fd5d01dd
@ -12,7 +12,7 @@ from .coordinator import LastFMDataUpdateCoordinator
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Set up lastfm from a config entry."""
|
||||
|
||||
coordinator = LastFMDataUpdateCoordinator(hass)
|
||||
coordinator = LastFMDataUpdateCoordinator(hass, entry)
|
||||
await coordinator.async_config_entry_first_refresh()
|
||||
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator
|
||||
|
||||
|
@ -39,15 +39,16 @@ class LastFMDataUpdateCoordinator(DataUpdateCoordinator[dict[str, LastFMUserData
|
||||
config_entry: ConfigEntry
|
||||
_client: LastFMNetwork
|
||||
|
||||
def __init__(self, hass: HomeAssistant) -> None:
|
||||
def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry) -> None:
|
||||
"""Initialize the LastFM data coordinator."""
|
||||
super().__init__(
|
||||
hass,
|
||||
LOGGER,
|
||||
config_entry=config_entry,
|
||||
name=DOMAIN,
|
||||
update_interval=timedelta(seconds=30),
|
||||
)
|
||||
self._client = LastFMNetwork(api_key=self.config_entry.options[CONF_API_KEY])
|
||||
self._client = LastFMNetwork(api_key=config_entry.options[CONF_API_KEY])
|
||||
|
||||
async def _async_update_data(self) -> dict[str, LastFMUserData]:
|
||||
res = {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user