Explicitly pass in the config_entry in flux_led coordinator (#137823)

explicitly pass in the config_entry in coordinator
This commit is contained in:
Michael 2025-02-08 15:33:42 +01:00 committed by GitHub
parent 846797a394
commit e8e4fb296b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 4 deletions

View File

@ -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

View File

@ -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."""

View File

@ -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):