mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Explicitly pass in the config_entry in lg_thinq coordinator (#138113)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
9be5976807
commit
12c5ad7249
@ -100,7 +100,7 @@ async def async_setup_coordinators(
|
|||||||
|
|
||||||
# Setup coordinator per device.
|
# Setup coordinator per device.
|
||||||
task_list = [
|
task_list = [
|
||||||
hass.async_create_task(async_setup_device_coordinator(hass, bridge))
|
hass.async_create_task(async_setup_device_coordinator(hass, entry, bridge))
|
||||||
for bridge in bridge_list
|
for bridge in bridge_list
|
||||||
]
|
]
|
||||||
task_result = await asyncio.gather(*task_list)
|
task_result = await asyncio.gather(*task_list)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
from thinqconnect import ThinQAPIException
|
from thinqconnect import ThinQAPIException
|
||||||
from thinqconnect.integration import HABridge
|
from thinqconnect.integration import HABridge
|
||||||
@ -11,6 +11,9 @@ from thinqconnect.integration import HABridge
|
|||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from . import ThinqConfigEntry
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
@ -19,11 +22,16 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
class DeviceDataUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
class DeviceDataUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||||
"""LG Device's Data Update Coordinator."""
|
"""LG Device's Data Update Coordinator."""
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant, ha_bridge: HABridge) -> None:
|
config_entry: ThinqConfigEntry
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self, hass: HomeAssistant, config_entry: ThinqConfigEntry, ha_bridge: HABridge
|
||||||
|
) -> None:
|
||||||
"""Initialize data coordinator."""
|
"""Initialize data coordinator."""
|
||||||
super().__init__(
|
super().__init__(
|
||||||
hass,
|
hass,
|
||||||
_LOGGER,
|
_LOGGER,
|
||||||
|
config_entry=config_entry,
|
||||||
name=f"{DOMAIN}_{ha_bridge.device.device_id}",
|
name=f"{DOMAIN}_{ha_bridge.device.device_id}",
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -71,10 +79,10 @@ class DeviceDataUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_device_coordinator(
|
async def async_setup_device_coordinator(
|
||||||
hass: HomeAssistant, ha_bridge: HABridge
|
hass: HomeAssistant, config_entry: ThinqConfigEntry, ha_bridge: HABridge
|
||||||
) -> DeviceDataUpdateCoordinator:
|
) -> DeviceDataUpdateCoordinator:
|
||||||
"""Create DeviceDataUpdateCoordinator and device_api per device."""
|
"""Create DeviceDataUpdateCoordinator and device_api per device."""
|
||||||
coordinator = DeviceDataUpdateCoordinator(hass, ha_bridge)
|
coordinator = DeviceDataUpdateCoordinator(hass, config_entry, ha_bridge)
|
||||||
await coordinator.async_refresh()
|
await coordinator.async_refresh()
|
||||||
|
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user