mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 07:07:28 +00:00
Explicitly pass in the config_entry in spotify coordinator (#137935)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
1976fdfa55
commit
62461d7525
@ -8,7 +8,6 @@ from typing import TYPE_CHECKING
|
|||||||
import aiohttp
|
import aiohttp
|
||||||
from spotifyaio import Device, SpotifyClient, SpotifyConnectionError
|
from spotifyaio import Device, SpotifyClient, SpotifyConnectionError
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
|
||||||
from homeassistant.const import CONF_ACCESS_TOKEN, Platform
|
from homeassistant.const import CONF_ACCESS_TOKEN, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
|
||||||
@ -63,7 +62,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: SpotifyConfigEntry) -> b
|
|||||||
|
|
||||||
spotify.refresh_token_function = _refresh_token
|
spotify.refresh_token_function = _refresh_token
|
||||||
|
|
||||||
coordinator = SpotifyCoordinator(hass, spotify)
|
coordinator = SpotifyCoordinator(hass, entry, spotify)
|
||||||
|
|
||||||
await coordinator.async_config_entry_first_refresh()
|
await coordinator.async_config_entry_first_refresh()
|
||||||
|
|
||||||
@ -92,6 +91,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: SpotifyConfigEntry) -> b
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: SpotifyConfigEntry) -> bool:
|
||||||
"""Unload Spotify config entry."""
|
"""Unload Spotify config entry."""
|
||||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
@ -56,11 +56,17 @@ class SpotifyCoordinator(DataUpdateCoordinator[SpotifyCoordinatorData]):
|
|||||||
current_user: UserProfile
|
current_user: UserProfile
|
||||||
config_entry: SpotifyConfigEntry
|
config_entry: SpotifyConfigEntry
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant, client: SpotifyClient) -> None:
|
def __init__(
|
||||||
|
self,
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config_entry: SpotifyConfigEntry,
|
||||||
|
client: SpotifyClient,
|
||||||
|
) -> None:
|
||||||
"""Initialize."""
|
"""Initialize."""
|
||||||
super().__init__(
|
super().__init__(
|
||||||
hass,
|
hass,
|
||||||
_LOGGER,
|
_LOGGER,
|
||||||
|
config_entry=config_entry,
|
||||||
name=DOMAIN,
|
name=DOMAIN,
|
||||||
update_interval=UPDATE_INTERVAL,
|
update_interval=UPDATE_INTERVAL,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user