Explicitly pass in the config_entry in yolink coordinator (#137861)
explicitly pass in the config_entry in coordinatorpull/137992/head
parent
07e9d80607
commit
2ef4e75014
|
@ -152,7 +152,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
paried_device_id := device_pairing_mapping.get(device.device_id)
|
||||
) is not None:
|
||||
paried_device = yolink_home.get_device(paried_device_id)
|
||||
device_coordinator = YoLinkCoordinator(hass, device, paried_device)
|
||||
device_coordinator = YoLinkCoordinator(hass, entry, device, paried_device)
|
||||
try:
|
||||
await device_coordinator.async_config_entry_first_refresh()
|
||||
except ConfigEntryNotReady:
|
||||
|
|
|
@ -9,6 +9,7 @@ import logging
|
|||
from yolink.device import YoLinkDevice
|
||||
from yolink.exception import YoLinkAuthFailError, YoLinkClientError
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryAuthFailed
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
|
@ -21,9 +22,12 @@ _LOGGER = logging.getLogger(__name__)
|
|||
class YoLinkCoordinator(DataUpdateCoordinator[dict]):
|
||||
"""YoLink DataUpdateCoordinator."""
|
||||
|
||||
config_entry: ConfigEntry
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
device: YoLinkDevice,
|
||||
paired_device: YoLinkDevice | None = None,
|
||||
) -> None:
|
||||
|
@ -34,7 +38,11 @@ class YoLinkCoordinator(DataUpdateCoordinator[dict]):
|
|||
data at first update
|
||||
"""
|
||||
super().__init__(
|
||||
hass, _LOGGER, name=DOMAIN, update_interval=timedelta(minutes=30)
|
||||
hass,
|
||||
_LOGGER,
|
||||
config_entry=config_entry,
|
||||
name=DOMAIN,
|
||||
update_interval=timedelta(minutes=30),
|
||||
)
|
||||
self.device = device
|
||||
self.paired_device = paired_device
|
||||
|
|
Loading…
Reference in New Issue