From e8e4fb296b9fa9ed9ae9f34789b7f0566de7eb92 Mon Sep 17 00:00:00 2001 From: Michael <35783820+mib1185@users.noreply.github.com> Date: Sat, 8 Feb 2025 15:33:42 +0100 Subject: [PATCH] Explicitly pass in the config_entry in flux_led coordinator (#137823) explicitly pass in the config_entry in coordinator --- homeassistant/components/flux_led/coordinator.py | 4 +++- homeassistant/components/flux_led/entity.py | 4 +++- homeassistant/components/flux_led/select.py | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/flux_led/coordinator.py b/homeassistant/components/flux_led/coordinator.py index a473387a513..a879d894bcc 100644 --- a/homeassistant/components/flux_led/coordinator.py +++ b/homeassistant/components/flux_led/coordinator.py @@ -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 diff --git a/homeassistant/components/flux_led/entity.py b/homeassistant/components/flux_led/entity.py index bcf7bfff9ed..f9b87dbb8c1 100644 --- a/homeassistant/components/flux_led/entity.py +++ b/homeassistant/components/flux_led/entity.py @@ -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.""" diff --git a/homeassistant/components/flux_led/select.py b/homeassistant/components/flux_led/select.py index 3809e73147a..33329ebb3f3 100644 --- a/homeassistant/components/flux_led/select.py +++ b/homeassistant/components/flux_led/select.py @@ -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):