mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 00:37:53 +00:00
Explicitly pass in the config_entry in flume coordinator (#137822)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
f8ac48fc78
commit
0b1afc68b0
@ -7,7 +7,7 @@ from requests import Session
|
||||
from requests.exceptions import RequestException
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry, ConfigEntryState
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import (
|
||||
CONF_CLIENT_ID,
|
||||
CONF_CLIENT_SECRET,
|
||||
@ -41,7 +41,7 @@ LIST_NOTIFICATIONS_SERVICE_SCHEMA = vol.All(
|
||||
|
||||
|
||||
def _setup_entry(
|
||||
hass: HomeAssistant, entry: ConfigEntry
|
||||
hass: HomeAssistant, entry: FlumeConfigEntry
|
||||
) -> tuple[FlumeAuth, FlumeDeviceList, Session]:
|
||||
"""Config entry set up in executor."""
|
||||
config = entry.data
|
||||
@ -79,7 +79,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: FlumeConfigEntry) -> boo
|
||||
_setup_entry, hass, entry
|
||||
)
|
||||
notification_coordinator = FlumeNotificationDataUpdateCoordinator(
|
||||
hass=hass, auth=flume_auth
|
||||
hass=hass, config_entry=entry, auth=flume_auth
|
||||
)
|
||||
|
||||
entry.runtime_data = FlumeRuntimeData(
|
||||
|
@ -80,7 +80,7 @@ async def async_setup_entry(
|
||||
] = []
|
||||
|
||||
connection_coordinator = FlumeDeviceConnectionUpdateCoordinator(
|
||||
hass=hass, flume_devices=flume_devices
|
||||
hass=hass, config_entry=config_entry, flume_devices=flume_devices
|
||||
)
|
||||
notification_coordinator = flume_domain_data.notifications_coordinator
|
||||
flume_devices = get_valid_flume_devices(flume_devices)
|
||||
|
@ -38,10 +38,18 @@ type FlumeConfigEntry = ConfigEntry[FlumeRuntimeData]
|
||||
class FlumeDeviceDataUpdateCoordinator(DataUpdateCoordinator[None]):
|
||||
"""Data update coordinator for an individual flume device."""
|
||||
|
||||
def __init__(self, hass: HomeAssistant, flume_device: FlumeData) -> None:
|
||||
config_entry: FlumeConfigEntry
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
config_entry: FlumeConfigEntry,
|
||||
flume_device: FlumeData,
|
||||
) -> None:
|
||||
"""Initialize the Coordinator."""
|
||||
super().__init__(
|
||||
hass,
|
||||
config_entry=config_entry,
|
||||
name=DOMAIN,
|
||||
logger=_LOGGER,
|
||||
update_interval=DEVICE_SCAN_INTERVAL,
|
||||
@ -65,10 +73,18 @@ class FlumeDeviceDataUpdateCoordinator(DataUpdateCoordinator[None]):
|
||||
class FlumeDeviceConnectionUpdateCoordinator(DataUpdateCoordinator[None]):
|
||||
"""Date update coordinator to read connected status from Devices endpoint."""
|
||||
|
||||
def __init__(self, hass: HomeAssistant, flume_devices: FlumeDeviceList) -> None:
|
||||
config_entry: FlumeConfigEntry
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
config_entry: FlumeConfigEntry,
|
||||
flume_devices: FlumeDeviceList,
|
||||
) -> None:
|
||||
"""Initialize the Coordinator."""
|
||||
super().__init__(
|
||||
hass,
|
||||
config_entry=config_entry,
|
||||
name=DOMAIN,
|
||||
logger=_LOGGER,
|
||||
update_interval=DEVICE_CONNECTION_SCAN_INTERVAL,
|
||||
@ -96,10 +112,15 @@ class FlumeDeviceConnectionUpdateCoordinator(DataUpdateCoordinator[None]):
|
||||
class FlumeNotificationDataUpdateCoordinator(DataUpdateCoordinator[None]):
|
||||
"""Data update coordinator for flume notifications."""
|
||||
|
||||
def __init__(self, hass: HomeAssistant, auth: FlumeAuth) -> None:
|
||||
config_entry: FlumeConfigEntry
|
||||
|
||||
def __init__(
|
||||
self, hass: HomeAssistant, config_entry: FlumeConfigEntry, auth: FlumeAuth
|
||||
) -> None:
|
||||
"""Initialize the Coordinator."""
|
||||
super().__init__(
|
||||
hass,
|
||||
config_entry=config_entry,
|
||||
name=DOMAIN,
|
||||
logger=_LOGGER,
|
||||
update_interval=NOTIFICATION_SCAN_INTERVAL,
|
||||
|
@ -132,7 +132,7 @@ async def async_setup_entry(
|
||||
flume_device = flume_datas[device_id]
|
||||
|
||||
coordinator = FlumeDeviceDataUpdateCoordinator(
|
||||
hass=hass, flume_device=flume_device
|
||||
hass=hass, config_entry=config_entry, flume_device=flume_device
|
||||
)
|
||||
|
||||
flume_entity_list.extend(
|
||||
|
Loading…
x
Reference in New Issue
Block a user