mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 08:47:57 +00:00
Explicitly pass in the config_entry in flux_led coordinator (#137823)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
846797a394
commit
e8e4fb296b
@ -24,17 +24,19 @@ REQUEST_REFRESH_DELAY: Final = 2.0
|
||||
class FluxLedUpdateCoordinator(DataUpdateCoordinator[None]):
|
||||
"""DataUpdateCoordinator to gather data for a specific flux_led device."""
|
||||
|
||||
config_entry: ConfigEntry
|
||||
|
||||
def __init__(
|
||||
self, hass: HomeAssistant, device: AIOWifiLedBulb, entry: ConfigEntry
|
||||
) -> None:
|
||||
"""Initialize DataUpdateCoordinator to gather data for specific device."""
|
||||
self.device = device
|
||||
self.title = entry.title
|
||||
self.entry = entry
|
||||
self.force_next_update = False
|
||||
super().__init__(
|
||||
hass,
|
||||
_LOGGER,
|
||||
config_entry=entry,
|
||||
name=self.device.ipaddr,
|
||||
update_interval=timedelta(seconds=10),
|
||||
# We don't want an immediate refresh since the device
|
||||
|
@ -89,7 +89,9 @@ class FluxEntity(CoordinatorEntity[FluxLedUpdateCoordinator]):
|
||||
self._attr_unique_id = f"{base_unique_id}_{key}"
|
||||
else:
|
||||
self._attr_unique_id = base_unique_id
|
||||
self._attr_device_info = _async_device_info(self._device, coordinator.entry)
|
||||
self._attr_device_info = _async_device_info(
|
||||
self._device, coordinator.config_entry
|
||||
)
|
||||
|
||||
async def _async_ensure_device_on(self) -> None:
|
||||
"""Turn the device on if it needs to be turned on before a command."""
|
||||
|
@ -141,7 +141,7 @@ class FluxICTypeSelect(FluxConfigSelect):
|
||||
async def async_select_option(self, option: str) -> None:
|
||||
"""Change the ic type."""
|
||||
await self._device.async_set_device_config(ic_type=option)
|
||||
await _async_delayed_reload(self.hass, self.coordinator.entry)
|
||||
await _async_delayed_reload(self.hass, self.coordinator.config_entry)
|
||||
|
||||
|
||||
class FluxWiringsSelect(FluxConfigSelect):
|
||||
@ -184,7 +184,7 @@ class FluxOperatingModesSelect(FluxConfigSelect):
|
||||
async def async_select_option(self, option: str) -> None:
|
||||
"""Change the ic type."""
|
||||
await self._device.async_set_device_config(operating_mode=option)
|
||||
await _async_delayed_reload(self.hass, self.coordinator.entry)
|
||||
await _async_delayed_reload(self.hass, self.coordinator.config_entry)
|
||||
|
||||
|
||||
class FluxRemoteConfigSelect(FluxConfigSelect):
|
||||
|
Loading…
x
Reference in New Issue
Block a user