mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 09:17:53 +00:00
Explicitly pass in the config_entry in lifx coordinator (#138110)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
faf4ad07fc
commit
56eecf05e7
@ -211,7 +211,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
except socket.gaierror as ex:
|
||||
connection.async_stop()
|
||||
raise ConfigEntryNotReady(f"Could not resolve {host}: {ex}") from ex
|
||||
coordinator = LIFXUpdateCoordinator(hass, connection, entry.title)
|
||||
coordinator = LIFXUpdateCoordinator(hass, entry, connection)
|
||||
coordinator.async_setup()
|
||||
try:
|
||||
await coordinator.async_config_entry_first_refresh()
|
||||
|
@ -23,6 +23,7 @@ from aiolifx_themes.themes import ThemeLibrary, ThemePainter
|
||||
from awesomeversion import AwesomeVersion
|
||||
from propcache.api import cached_property
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
SIGNAL_STRENGTH_DECIBELS,
|
||||
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||
@ -86,11 +87,13 @@ class SkyType(IntEnum):
|
||||
class LIFXUpdateCoordinator(DataUpdateCoordinator[None]):
|
||||
"""DataUpdateCoordinator to gather data for a specific lifx device."""
|
||||
|
||||
config_entry: ConfigEntry
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
connection: LIFXConnection,
|
||||
title: str,
|
||||
) -> None:
|
||||
"""Initialize DataUpdateCoordinator."""
|
||||
assert connection.device is not None
|
||||
@ -105,7 +108,8 @@ class LIFXUpdateCoordinator(DataUpdateCoordinator[None]):
|
||||
super().__init__(
|
||||
hass,
|
||||
_LOGGER,
|
||||
name=f"{title} ({self.device.ip_addr})",
|
||||
config_entry=config_entry,
|
||||
name=f"{config_entry.title} ({self.device.ip_addr})",
|
||||
update_interval=timedelta(seconds=LIGHT_UPDATE_INTERVAL),
|
||||
# We don't want an immediate refresh since the device
|
||||
# takes a moment to reflect the state change
|
||||
|
Loading…
x
Reference in New Issue
Block a user