mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Explicitly pass in the config_entry in mill coordinator (#138088)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
200eb9a63d
commit
e1c222c54e
@ -47,9 +47,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
except TimeoutError as error:
|
||||
raise ConfigEntryNotReady from error
|
||||
data_coordinator = MillDataUpdateCoordinator(
|
||||
hass,
|
||||
mill_data_connection=mill_data_connection,
|
||||
update_interval=update_interval,
|
||||
hass, entry, mill_data_connection, update_interval
|
||||
)
|
||||
|
||||
await data_coordinator.async_config_entry_first_refresh()
|
||||
|
@ -8,6 +8,7 @@ import logging
|
||||
from mill import Mill
|
||||
from mill_local import Mill as MillLocal
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||
|
||||
@ -19,12 +20,14 @@ _LOGGER = logging.getLogger(__name__)
|
||||
class MillDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
"""Class to manage fetching Mill data."""
|
||||
|
||||
config_entry: ConfigEntry
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
update_interval: timedelta | None = None,
|
||||
*,
|
||||
config_entry: ConfigEntry,
|
||||
mill_data_connection: Mill | MillLocal,
|
||||
update_interval: timedelta,
|
||||
) -> None:
|
||||
"""Initialize global Mill data updater."""
|
||||
self.mill_data_connection = mill_data_connection
|
||||
@ -32,6 +35,7 @@ class MillDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
super().__init__(
|
||||
hass,
|
||||
_LOGGER,
|
||||
config_entry=config_entry,
|
||||
name=DOMAIN,
|
||||
update_method=mill_data_connection.fetch_heater_and_sensor_data,
|
||||
update_interval=update_interval,
|
||||
|
Loading…
x
Reference in New Issue
Block a user