mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 06:37:52 +00:00
Explicitly pass in the config_entry in awair coordinator init (#137717)
explicitly pass in the config_entry in awair coordinator init
This commit is contained in:
parent
f3aeca5a71
commit
780e6aa073
@ -40,17 +40,24 @@ class AwairResult:
|
|||||||
class AwairDataUpdateCoordinator(DataUpdateCoordinator[dict[str, AwairResult]]):
|
class AwairDataUpdateCoordinator(DataUpdateCoordinator[dict[str, AwairResult]]):
|
||||||
"""Define a wrapper class to update Awair data."""
|
"""Define a wrapper class to update Awair data."""
|
||||||
|
|
||||||
|
config_entry: AwairConfigEntry
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: ConfigEntry,
|
config_entry: AwairConfigEntry,
|
||||||
update_interval: timedelta | None,
|
update_interval: timedelta | None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up the AwairDataUpdateCoordinator class."""
|
"""Set up the AwairDataUpdateCoordinator class."""
|
||||||
self._config_entry = config_entry
|
|
||||||
self.title = config_entry.title
|
self.title = config_entry.title
|
||||||
|
|
||||||
super().__init__(hass, LOGGER, name=DOMAIN, update_interval=update_interval)
|
super().__init__(
|
||||||
|
hass,
|
||||||
|
LOGGER,
|
||||||
|
config_entry=config_entry,
|
||||||
|
name=DOMAIN,
|
||||||
|
update_interval=update_interval,
|
||||||
|
)
|
||||||
|
|
||||||
async def _fetch_air_data(self, device: AwairBaseDevice) -> AwairResult:
|
async def _fetch_air_data(self, device: AwairBaseDevice) -> AwairResult:
|
||||||
"""Fetch latest air quality data."""
|
"""Fetch latest air quality data."""
|
||||||
@ -64,7 +71,10 @@ class AwairCloudDataUpdateCoordinator(AwairDataUpdateCoordinator):
|
|||||||
"""Define a wrapper class to update Awair data from Cloud API."""
|
"""Define a wrapper class to update Awair data from Cloud API."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, hass: HomeAssistant, config_entry: ConfigEntry, session: ClientSession
|
self,
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config_entry: AwairConfigEntry,
|
||||||
|
session: ClientSession,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up the AwairCloudDataUpdateCoordinator class."""
|
"""Set up the AwairCloudDataUpdateCoordinator class."""
|
||||||
access_token = config_entry.data[CONF_ACCESS_TOKEN]
|
access_token = config_entry.data[CONF_ACCESS_TOKEN]
|
||||||
@ -95,7 +105,10 @@ class AwairLocalDataUpdateCoordinator(AwairDataUpdateCoordinator):
|
|||||||
_device: AwairLocalDevice | None = None
|
_device: AwairLocalDevice | None = None
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, hass: HomeAssistant, config_entry: ConfigEntry, session: ClientSession
|
self,
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config_entry: AwairConfigEntry,
|
||||||
|
session: ClientSession,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up the AwairLocalDataUpdateCoordinator class."""
|
"""Set up the AwairLocalDataUpdateCoordinator class."""
|
||||||
self._awair = AwairLocal(
|
self._awair = AwairLocal(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user