mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Pass sabnzdb config entry explicitly to coordinator (#130990)
Pass config entry explicitly to coordinator
This commit is contained in:
parent
e53d97db6f
commit
b9ff8ebe3a
@ -174,7 +174,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
await migrate_unique_id(hass, entry)
|
||||
update_device_identifiers(hass, entry)
|
||||
|
||||
coordinator = SabnzbdUpdateCoordinator(hass, sab_api)
|
||||
coordinator = SabnzbdUpdateCoordinator(hass, entry, sab_api)
|
||||
await coordinator.async_config_entry_first_refresh()
|
||||
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator
|
||||
|
||||
|
@ -6,6 +6,7 @@ from typing import Any
|
||||
|
||||
from pysabnzbd import SabnzbdApi, SabnzbdApiException
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
|
||||
@ -18,6 +19,7 @@ class SabnzbdUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
sab_api: SabnzbdApi,
|
||||
) -> None:
|
||||
"""Initialize the SABnzbd update coordinator."""
|
||||
@ -26,6 +28,7 @@ class SabnzbdUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
super().__init__(
|
||||
hass,
|
||||
_LOGGER,
|
||||
config_entry=config_entry,
|
||||
name="SABnzbd",
|
||||
update_interval=timedelta(seconds=30),
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user