Explicitly pass in the config_entry in sonarr coordinator (#137938)

explicitly pass in the config_entry in coordinator
This commit is contained in:
Michael 2025-02-09 15:47:07 +01:00 committed by GitHub
parent e4ec217cfa
commit 60a3dbae41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 7 deletions

View File

@ -67,13 +67,19 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
) )
entry.async_on_unload(entry.add_update_listener(_async_update_listener)) entry.async_on_unload(entry.add_update_listener(_async_update_listener))
coordinators: dict[str, SonarrDataUpdateCoordinator[Any]] = { coordinators: dict[str, SonarrDataUpdateCoordinator[Any]] = {
"upcoming": CalendarDataUpdateCoordinator(hass, host_configuration, sonarr), "upcoming": CalendarDataUpdateCoordinator(
"commands": CommandsDataUpdateCoordinator(hass, host_configuration, sonarr), hass, entry, host_configuration, sonarr
"diskspace": DiskSpaceDataUpdateCoordinator(hass, host_configuration, sonarr), ),
"queue": QueueDataUpdateCoordinator(hass, host_configuration, sonarr), "commands": CommandsDataUpdateCoordinator(
"series": SeriesDataUpdateCoordinator(hass, host_configuration, sonarr), hass, entry, host_configuration, sonarr
"status": StatusDataUpdateCoordinator(hass, host_configuration, sonarr), ),
"wanted": WantedDataUpdateCoordinator(hass, host_configuration, sonarr), "diskspace": DiskSpaceDataUpdateCoordinator(
hass, entry, host_configuration, sonarr
),
"queue": QueueDataUpdateCoordinator(hass, entry, host_configuration, sonarr),
"series": SeriesDataUpdateCoordinator(hass, entry, host_configuration, sonarr),
"status": StatusDataUpdateCoordinator(hass, entry, host_configuration, sonarr),
"wanted": WantedDataUpdateCoordinator(hass, entry, host_configuration, sonarr),
} }
# Temporary, until we add diagnostic entities # Temporary, until we add diagnostic entities
_version = None _version = None

View File

@ -48,6 +48,7 @@ class SonarrDataUpdateCoordinator(DataUpdateCoordinator[SonarrDataT]):
def __init__( def __init__(
self, self,
hass: HomeAssistant, hass: HomeAssistant,
config_entry: ConfigEntry,
host_configuration: PyArrHostConfiguration, host_configuration: PyArrHostConfiguration,
api_client: SonarrClient, api_client: SonarrClient,
) -> None: ) -> None:
@ -55,6 +56,7 @@ class SonarrDataUpdateCoordinator(DataUpdateCoordinator[SonarrDataT]):
super().__init__( super().__init__(
hass=hass, hass=hass,
logger=LOGGER, logger=LOGGER,
config_entry=config_entry,
name=DOMAIN, name=DOMAIN,
update_interval=timedelta(seconds=30), update_interval=timedelta(seconds=30),
) )