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 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:
|
except TimeoutError as error:
|
||||||
raise ConfigEntryNotReady from error
|
raise ConfigEntryNotReady from error
|
||||||
data_coordinator = MillDataUpdateCoordinator(
|
data_coordinator = MillDataUpdateCoordinator(
|
||||||
hass,
|
hass, entry, mill_data_connection, update_interval
|
||||||
mill_data_connection=mill_data_connection,
|
|
||||||
update_interval=update_interval,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
await data_coordinator.async_config_entry_first_refresh()
|
await data_coordinator.async_config_entry_first_refresh()
|
||||||
|
@ -8,6 +8,7 @@ import logging
|
|||||||
from mill import Mill
|
from mill import Mill
|
||||||
from mill_local import Mill as MillLocal
|
from mill_local import Mill as MillLocal
|
||||||
|
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||||
|
|
||||||
@ -19,12 +20,14 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
class MillDataUpdateCoordinator(DataUpdateCoordinator):
|
class MillDataUpdateCoordinator(DataUpdateCoordinator):
|
||||||
"""Class to manage fetching Mill data."""
|
"""Class to manage fetching Mill data."""
|
||||||
|
|
||||||
|
config_entry: ConfigEntry
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
update_interval: timedelta | None = None,
|
config_entry: ConfigEntry,
|
||||||
*,
|
|
||||||
mill_data_connection: Mill | MillLocal,
|
mill_data_connection: Mill | MillLocal,
|
||||||
|
update_interval: timedelta,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize global Mill data updater."""
|
"""Initialize global Mill data updater."""
|
||||||
self.mill_data_connection = mill_data_connection
|
self.mill_data_connection = mill_data_connection
|
||||||
@ -32,6 +35,7 @@ class MillDataUpdateCoordinator(DataUpdateCoordinator):
|
|||||||
super().__init__(
|
super().__init__(
|
||||||
hass,
|
hass,
|
||||||
_LOGGER,
|
_LOGGER,
|
||||||
|
config_entry=config_entry,
|
||||||
name=DOMAIN,
|
name=DOMAIN,
|
||||||
update_method=mill_data_connection.fetch_heater_and_sensor_data,
|
update_method=mill_data_connection.fetch_heater_and_sensor_data,
|
||||||
update_interval=update_interval,
|
update_interval=update_interval,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user