mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 00:37:53 +00:00
Explicitly pass in the config_entry in yamaha_musiccast coordinator (#137863)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
282c2c6a29
commit
a2f1501943
@ -55,7 +55,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
async_get_clientsession(hass),
|
||||
entry.data[CONF_UPNP_DESC],
|
||||
)
|
||||
coordinator = MusicCastDataUpdateCoordinator(hass, client=client)
|
||||
coordinator = MusicCastDataUpdateCoordinator(hass, entry, client=client)
|
||||
await coordinator.async_config_entry_first_refresh()
|
||||
coordinator.musiccast.build_capabilities()
|
||||
|
||||
|
@ -9,6 +9,7 @@ from typing import TYPE_CHECKING
|
||||
from aiomusiccast import MusicCastConnectionException
|
||||
from aiomusiccast.musiccast_device import MusicCastData, MusicCastDevice
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
|
||||
@ -25,11 +26,21 @@ SCAN_INTERVAL = timedelta(seconds=60)
|
||||
class MusicCastDataUpdateCoordinator(DataUpdateCoordinator[MusicCastData]):
|
||||
"""Class to manage fetching data from the API."""
|
||||
|
||||
def __init__(self, hass: HomeAssistant, client: MusicCastDevice) -> None:
|
||||
config_entry: ConfigEntry
|
||||
|
||||
def __init__(
|
||||
self, hass: HomeAssistant, config_entry: ConfigEntry, client: MusicCastDevice
|
||||
) -> None:
|
||||
"""Initialize."""
|
||||
self.musiccast = client
|
||||
|
||||
super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=SCAN_INTERVAL)
|
||||
super().__init__(
|
||||
hass,
|
||||
_LOGGER,
|
||||
config_entry=config_entry,
|
||||
name=DOMAIN,
|
||||
update_interval=SCAN_INTERVAL,
|
||||
)
|
||||
self.entities: list[MusicCastDeviceEntity] = []
|
||||
|
||||
async def _async_update_data(self) -> MusicCastData:
|
||||
|
Loading…
x
Reference in New Issue
Block a user