Explicitly pass in the config_entry in ruckus_unleashed coordinator (#137965)

explicitly pass in the config_entry in coordinator
This commit is contained in:
Michael 2025-02-09 15:35:46 +01:00 committed by GitHub
parent 5464e245a2
commit 7d4888920a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 5 deletions

View File

@ -46,7 +46,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
await ruckus.close()
raise ConfigEntryAuthFailed from autherr
coordinator = RuckusDataUpdateCoordinator(hass, ruckus=ruckus)
coordinator = RuckusDataUpdateCoordinator(hass, entry, ruckus)
await coordinator.async_config_entry_first_refresh()

View File

@ -6,6 +6,7 @@ import logging
from aioruckus import AjaxSession
from aioruckus.exceptions import AuthenticationError, SchemaError
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryAuthFailed
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
@ -18,17 +19,20 @@ _LOGGER = logging.getLogger(__package__)
class RuckusDataUpdateCoordinator(DataUpdateCoordinator):
"""Coordinator to manage data from Ruckus client."""
def __init__(self, hass: HomeAssistant, *, ruckus: AjaxSession) -> None:
config_entry: ConfigEntry
def __init__(
self, hass: HomeAssistant, config_entry: ConfigEntry, ruckus: AjaxSession
) -> None:
"""Initialize global Ruckus data updater."""
self.ruckus = ruckus
update_interval = timedelta(seconds=SCAN_INTERVAL)
super().__init__(
hass,
_LOGGER,
config_entry=config_entry,
name=DOMAIN,
update_interval=update_interval,
update_interval=timedelta(seconds=SCAN_INTERVAL),
)
async def _fetch_clients(self) -> dict: