mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Explicitly pass in the config_entry in opensky coordinator (#138051)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
64cbf44da7
commit
9c5928c2d0
@ -32,7 +32,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
except OpenSkyError as exc:
|
||||
raise ConfigEntryNotReady from exc
|
||||
|
||||
coordinator = OpenSkyDataUpdateCoordinator(hass, client)
|
||||
coordinator = OpenSkyDataUpdateCoordinator(hass, entry, client)
|
||||
await coordinator.async_config_entry_first_refresh()
|
||||
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator
|
||||
|
||||
|
@ -36,11 +36,14 @@ class OpenSkyDataUpdateCoordinator(DataUpdateCoordinator[int]):
|
||||
|
||||
config_entry: ConfigEntry
|
||||
|
||||
def __init__(self, hass: HomeAssistant, opensky: OpenSky) -> None:
|
||||
def __init__(
|
||||
self, hass: HomeAssistant, config_entry: ConfigEntry, opensky: OpenSky
|
||||
) -> None:
|
||||
"""Initialize the OpenSky data coordinator."""
|
||||
super().__init__(
|
||||
hass,
|
||||
LOGGER,
|
||||
config_entry=config_entry,
|
||||
name=DOMAIN,
|
||||
update_interval={
|
||||
True: timedelta(seconds=90),
|
||||
@ -50,11 +53,11 @@ class OpenSkyDataUpdateCoordinator(DataUpdateCoordinator[int]):
|
||||
self._opensky = opensky
|
||||
self._previously_tracked: set[str] | None = None
|
||||
self._bounding_box = OpenSky.get_bounding_box(
|
||||
self.config_entry.data[CONF_LATITUDE],
|
||||
self.config_entry.data[CONF_LONGITUDE],
|
||||
self.config_entry.options[CONF_RADIUS],
|
||||
config_entry.data[CONF_LATITUDE],
|
||||
config_entry.data[CONF_LONGITUDE],
|
||||
config_entry.options[CONF_RADIUS],
|
||||
)
|
||||
self._altitude = self.config_entry.options.get(CONF_ALTITUDE, DEFAULT_ALTITUDE)
|
||||
self._altitude = config_entry.options.get(CONF_ALTITUDE, DEFAULT_ALTITUDE)
|
||||
|
||||
async def _async_update_data(self) -> int:
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user