Explicitly pass in the config_entry in motion_blinds coordinator (#138080)
explicitly pass in the config_entry in coordinatorpull/137224/head
parent
474d8bbd65
commit
659032c4d8
|
@ -1,7 +1,6 @@
|
|||
"""The motion_blinds component."""
|
||||
|
||||
import asyncio
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
|
@ -25,7 +24,6 @@ from .const import (
|
|||
KEY_SETUP_LOCK,
|
||||
KEY_UNSUB_STOP,
|
||||
PLATFORMS,
|
||||
UPDATE_INTERVAL,
|
||||
)
|
||||
from .coordinator import DataUpdateCoordinatorMotionBlinds
|
||||
from .gateway import ConnectMotionGateway
|
||||
|
@ -94,13 +92,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
}
|
||||
|
||||
coordinator = DataUpdateCoordinatorMotionBlinds(
|
||||
hass,
|
||||
_LOGGER,
|
||||
coordinator_info,
|
||||
# Name of the data. For logging purposes.
|
||||
name=entry.title,
|
||||
# Polling interval. Will only be polled if there are subscribers.
|
||||
update_interval=timedelta(seconds=UPDATE_INTERVAL),
|
||||
hass, entry, _LOGGER, coordinator_info
|
||||
)
|
||||
|
||||
# Fetch initial data so we have data when entities subscribe
|
||||
|
|
|
@ -7,6 +7,7 @@ from typing import Any
|
|||
|
||||
from motionblinds import DEVICE_TYPES_WIFI, ParseException
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||
|
||||
|
@ -25,21 +26,22 @@ _LOGGER = logging.getLogger(__name__)
|
|||
class DataUpdateCoordinatorMotionBlinds(DataUpdateCoordinator):
|
||||
"""Class to manage fetching data from single endpoint."""
|
||||
|
||||
config_entry: ConfigEntry
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
logger: logging.Logger,
|
||||
coordinator_info: dict[str, Any],
|
||||
*,
|
||||
name: str,
|
||||
update_interval: timedelta,
|
||||
) -> None:
|
||||
"""Initialize global data updater."""
|
||||
super().__init__(
|
||||
hass,
|
||||
logger,
|
||||
name=name,
|
||||
update_interval=update_interval,
|
||||
config_entry=config_entry,
|
||||
name=config_entry.title,
|
||||
update_interval=timedelta(seconds=UPDATE_INTERVAL),
|
||||
)
|
||||
|
||||
self.api_lock = coordinator_info[KEY_API_LOCK]
|
||||
|
|
Loading…
Reference in New Issue