Use runtime_data in flux_led (#138279)

This commit is contained in:
epenet 2025-02-11 17:09:06 +01:00 committed by GitHub
parent 62b563eb60
commit 7f376ff004
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 50 additions and 62 deletions

View File

@ -11,7 +11,6 @@ from flux_led.aio import AIOWifiLedBulb
from flux_led.const import ATTR_ID, WhiteChannelType from flux_led.const import ATTR_ID, WhiteChannelType
from flux_led.scanner import FluxLEDDiscovery from flux_led.scanner import FluxLEDDiscovery
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, Platform from homeassistant.const import CONF_HOST, Platform
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.exceptions import ConfigEntryNotReady
@ -39,7 +38,7 @@ from .const import (
FLUX_LED_EXCEPTIONS, FLUX_LED_EXCEPTIONS,
SIGNAL_STATE_UPDATED, SIGNAL_STATE_UPDATED,
) )
from .coordinator import FluxLedUpdateCoordinator from .coordinator import FluxLedConfigEntry, FluxLedUpdateCoordinator
from .discovery import ( from .discovery import (
async_build_cached_discovery, async_build_cached_discovery,
async_clear_discovery_cache, async_clear_discovery_cache,
@ -113,7 +112,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
return True return True
async def _async_migrate_unique_ids(hass: HomeAssistant, entry: ConfigEntry) -> None: async def _async_migrate_unique_ids(
hass: HomeAssistant, entry: FluxLedConfigEntry
) -> None:
"""Migrate entities when the mac address gets discovered.""" """Migrate entities when the mac address gets discovered."""
@callback @callback
@ -146,14 +147,16 @@ async def _async_migrate_unique_ids(hass: HomeAssistant, entry: ConfigEntry) ->
await er.async_migrate_entries(hass, entry.entry_id, _async_migrator) await er.async_migrate_entries(hass, entry.entry_id, _async_migrator)
async def _async_update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None: async def _async_update_listener(
hass: HomeAssistant, entry: FluxLedConfigEntry
) -> None:
"""Handle options update.""" """Handle options update."""
coordinator: FluxLedUpdateCoordinator = hass.data[DOMAIN][entry.entry_id] coordinator = entry.runtime_data
if entry.title != coordinator.title: if entry.title != coordinator.title:
await hass.config_entries.async_reload(entry.entry_id) await hass.config_entries.async_reload(entry.entry_id)
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: async def async_setup_entry(hass: HomeAssistant, entry: FluxLedConfigEntry) -> bool:
"""Set up Flux LED/MagicLight from a config entry.""" """Set up Flux LED/MagicLight from a config entry."""
host = entry.data[CONF_HOST] host = entry.data[CONF_HOST]
discovery_cached = True discovery_cached = True
@ -206,7 +209,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
await _async_migrate_unique_ids(hass, entry) await _async_migrate_unique_ids(hass, entry)
coordinator = FluxLedUpdateCoordinator(hass, device, entry) coordinator = FluxLedUpdateCoordinator(hass, device, entry)
hass.data[DOMAIN][entry.entry_id] = coordinator entry.runtime_data = coordinator
platforms = PLATFORMS_BY_TYPE[device.device_type] platforms = PLATFORMS_BY_TYPE[device.device_type]
await hass.config_entries.async_forward_entry_setups(entry, platforms) await hass.config_entries.async_forward_entry_setups(entry, platforms)
@ -239,13 +242,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
return True return True
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: async def async_unload_entry(hass: HomeAssistant, entry: FluxLedConfigEntry) -> bool:
"""Unload a config entry.""" """Unload a config entry."""
device: AIOWifiLedBulb = hass.data[DOMAIN][entry.entry_id].device device = entry.runtime_data.device
platforms = PLATFORMS_BY_TYPE[device.device_type] platforms = PLATFORMS_BY_TYPE[device.device_type]
if unload_ok := await hass.config_entries.async_unload_platforms(entry, platforms): if unload_ok := await hass.config_entries.async_unload_platforms(entry, platforms):
# Make sure we probe the device again in case something has changed externally # Make sure we probe the device again in case something has changed externally
async_clear_discovery_cache(hass, entry.data[CONF_HOST]) async_clear_discovery_cache(hass, entry.data[CONF_HOST])
del hass.data[DOMAIN][entry.entry_id]
await device.async_stop() await device.async_stop()
return unload_ok return unload_ok

View File

@ -5,7 +5,6 @@ from __future__ import annotations
from flux_led.aio import AIOWifiLedBulb from flux_led.aio import AIOWifiLedBulb
from flux_led.protocol import RemoteConfig from flux_led.protocol import RemoteConfig
from homeassistant import config_entries
from homeassistant.components.button import ( from homeassistant.components.button import (
ButtonDeviceClass, ButtonDeviceClass,
ButtonEntity, ButtonEntity,
@ -15,8 +14,7 @@ from homeassistant.const import EntityCategory
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from .const import DOMAIN from .coordinator import FluxLedConfigEntry
from .coordinator import FluxLedUpdateCoordinator
from .entity import FluxBaseEntity from .entity import FluxBaseEntity
_RESTART_KEY = "restart" _RESTART_KEY = "restart"
@ -34,11 +32,11 @@ UNPAIR_REMOTES_DESCRIPTION = ButtonEntityDescription(
async def async_setup_entry( async def async_setup_entry(
hass: HomeAssistant, hass: HomeAssistant,
entry: config_entries.ConfigEntry, entry: FluxLedConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback, async_add_entities: AddConfigEntryEntitiesCallback,
) -> None: ) -> None:
"""Set up Magic Home button based on a config entry.""" """Set up Magic Home button based on a config entry."""
coordinator: FluxLedUpdateCoordinator = hass.data[DOMAIN][entry.entry_id] coordinator = entry.runtime_data
device = coordinator.device device = coordinator.device
entities: list[FluxButton] = [ entities: list[FluxButton] = [
FluxButton(coordinator.device, entry, RESTART_BUTTON_DESCRIPTION) FluxButton(coordinator.device, entry, RESTART_BUTTON_DESCRIPTION)
@ -59,7 +57,7 @@ class FluxButton(FluxBaseEntity, ButtonEntity):
def __init__( def __init__(
self, self,
device: AIOWifiLedBulb, device: AIOWifiLedBulb,
entry: config_entries.ConfigEntry, entry: FluxLedConfigEntry,
description: ButtonEntityDescription, description: ButtonEntityDescription,
) -> None: ) -> None:
"""Initialize the button.""" """Initialize the button."""

View File

@ -18,7 +18,6 @@ import voluptuous as vol
from homeassistant.config_entries import ( from homeassistant.config_entries import (
SOURCE_IGNORE, SOURCE_IGNORE,
ConfigEntry,
ConfigEntryState, ConfigEntryState,
ConfigFlow, ConfigFlow,
ConfigFlowResult, ConfigFlowResult,
@ -46,6 +45,7 @@ from .const import (
TRANSITION_JUMP, TRANSITION_JUMP,
TRANSITION_STROBE, TRANSITION_STROBE,
) )
from .coordinator import FluxLedConfigEntry
from .discovery import ( from .discovery import (
async_discover_device, async_discover_device,
async_discover_devices, async_discover_devices,
@ -72,7 +72,7 @@ class FluxLedConfigFlow(ConfigFlow, domain=DOMAIN):
@staticmethod @staticmethod
@callback @callback
def async_get_options_flow( def async_get_options_flow(
config_entry: ConfigEntry, config_entry: FluxLedConfigEntry,
) -> FluxLedOptionsFlow: ) -> FluxLedOptionsFlow:
"""Get the options flow for the Flux LED component.""" """Get the options flow for the Flux LED component."""
return FluxLedOptionsFlow() return FluxLedOptionsFlow()

View File

@ -20,14 +20,16 @@ _LOGGER = logging.getLogger(__name__)
REQUEST_REFRESH_DELAY: Final = 2.0 REQUEST_REFRESH_DELAY: Final = 2.0
type FluxLedConfigEntry = ConfigEntry[FluxLedUpdateCoordinator]
class FluxLedUpdateCoordinator(DataUpdateCoordinator[None]): class FluxLedUpdateCoordinator(DataUpdateCoordinator[None]):
"""DataUpdateCoordinator to gather data for a specific flux_led device.""" """DataUpdateCoordinator to gather data for a specific flux_led device."""
config_entry: ConfigEntry config_entry: FluxLedConfigEntry
def __init__( def __init__(
self, hass: HomeAssistant, device: AIOWifiLedBulb, entry: ConfigEntry self, hass: HomeAssistant, device: AIOWifiLedBulb, entry: FluxLedConfigEntry
) -> None: ) -> None:
"""Initialize DataUpdateCoordinator to gather data for specific device.""" """Initialize DataUpdateCoordinator to gather data for specific device."""
self.device = device self.device = device

View File

@ -4,22 +4,19 @@ from __future__ import annotations
from typing import Any from typing import Any
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from .const import DOMAIN from .coordinator import FluxLedConfigEntry
from .coordinator import FluxLedUpdateCoordinator
async def async_get_config_entry_diagnostics( async def async_get_config_entry_diagnostics(
hass: HomeAssistant, entry: ConfigEntry hass: HomeAssistant, entry: FluxLedConfigEntry
) -> dict[str, Any]: ) -> dict[str, Any]:
"""Return diagnostics for a config entry.""" """Return diagnostics for a config entry."""
coordinator: FluxLedUpdateCoordinator = hass.data[DOMAIN][entry.entry_id]
return { return {
"entry": { "entry": {
"title": entry.title, "title": entry.title,
"data": dict(entry.data), "data": dict(entry.data),
}, },
"data": coordinator.device.diagnostics, "data": entry.runtime_data.device.diagnostics,
} }

View File

@ -23,9 +23,8 @@ from flux_led.const import (
from flux_led.models_db import get_model_description from flux_led.models_db import get_model_description
from flux_led.scanner import FluxLEDDiscovery from flux_led.scanner import FluxLEDDiscovery
from homeassistant import config_entries
from homeassistant.components import network from homeassistant.components import network
from homeassistant.config_entries import ConfigEntry, ConfigEntryState from homeassistant.config_entries import SOURCE_INTEGRATION_DISCOVERY, ConfigEntryState
from homeassistant.const import CONF_HOST, CONF_MODEL, CONF_NAME from homeassistant.const import CONF_HOST, CONF_MODEL, CONF_NAME
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import device_registry as dr, discovery_flow from homeassistant.helpers import device_registry as dr, discovery_flow
@ -44,6 +43,7 @@ from .const import (
DOMAIN, DOMAIN,
FLUX_LED_DISCOVERY, FLUX_LED_DISCOVERY,
) )
from .coordinator import FluxLedConfigEntry
from .util import format_as_flux_mac, mac_matches_by_one from .util import format_as_flux_mac, mac_matches_by_one
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -63,7 +63,7 @@ CONF_TO_DISCOVERY: Final = {
@callback @callback
def async_build_cached_discovery(entry: ConfigEntry) -> FluxLEDDiscovery: def async_build_cached_discovery(entry: FluxLedConfigEntry) -> FluxLEDDiscovery:
"""When discovery is unavailable, load it from the config entry.""" """When discovery is unavailable, load it from the config entry."""
data = entry.data data = entry.data
return FluxLEDDiscovery( return FluxLEDDiscovery(
@ -116,7 +116,7 @@ def async_populate_data_from_discovery(
@callback @callback
def async_update_entry_from_discovery( def async_update_entry_from_discovery(
hass: HomeAssistant, hass: HomeAssistant,
entry: config_entries.ConfigEntry, entry: FluxLedConfigEntry,
device: FluxLEDDiscovery, device: FluxLEDDiscovery,
model_num: int | None, model_num: int | None,
allow_update_mac: bool, allow_update_mac: bool,
@ -230,6 +230,6 @@ def async_trigger_discovery(
discovery_flow.async_create_flow( discovery_flow.async_create_flow(
hass, hass,
DOMAIN, DOMAIN,
context={"source": config_entries.SOURCE_INTEGRATION_DISCOVERY}, context={"source": SOURCE_INTEGRATION_DISCOVERY},
data={**device}, data={**device},
) )

View File

@ -11,7 +11,6 @@ from flux_led.protocol import MusicMode
from flux_led.utils import rgbcw_brightness, rgbcw_to_rgbwc, rgbw_brightness from flux_led.utils import rgbcw_brightness, rgbcw_to_rgbwc, rgbw_brightness
import voluptuous as vol import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components.light import ( from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP_KELVIN, ATTR_COLOR_TEMP_KELVIN,
@ -38,7 +37,6 @@ from .const import (
CONF_SPEED_PCT, CONF_SPEED_PCT,
CONF_TRANSITION, CONF_TRANSITION,
DEFAULT_EFFECT_SPEED, DEFAULT_EFFECT_SPEED,
DOMAIN,
MIN_CCT_BRIGHTNESS, MIN_CCT_BRIGHTNESS,
MIN_RGB_BRIGHTNESS, MIN_RGB_BRIGHTNESS,
MULTI_BRIGHTNESS_COLOR_MODES, MULTI_BRIGHTNESS_COLOR_MODES,
@ -46,7 +44,7 @@ from .const import (
TRANSITION_JUMP, TRANSITION_JUMP,
TRANSITION_STROBE, TRANSITION_STROBE,
) )
from .coordinator import FluxLedUpdateCoordinator from .coordinator import FluxLedConfigEntry, FluxLedUpdateCoordinator
from .entity import FluxOnOffEntity from .entity import FluxOnOffEntity
from .util import ( from .util import (
_effect_brightness, _effect_brightness,
@ -134,11 +132,11 @@ SET_ZONES_DICT: VolDictType = {
async def async_setup_entry( async def async_setup_entry(
hass: HomeAssistant, hass: HomeAssistant,
entry: config_entries.ConfigEntry, entry: FluxLedConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback, async_add_entities: AddConfigEntryEntitiesCallback,
) -> None: ) -> None:
"""Set up the Flux lights.""" """Set up the Flux lights."""
coordinator: FluxLedUpdateCoordinator = hass.data[DOMAIN][entry.entry_id] coordinator = entry.runtime_data
platform = entity_platform.async_get_current_platform() platform = entity_platform.async_get_current_platform()
platform.async_register_entity_service( platform.async_register_entity_service(

View File

@ -16,7 +16,6 @@ from flux_led.protocol import (
SEGMENTS_MAX, SEGMENTS_MAX,
) )
from homeassistant import config_entries
from homeassistant.components.light import EFFECT_RANDOM from homeassistant.components.light import EFFECT_RANDOM
from homeassistant.components.number import NumberEntity, NumberMode from homeassistant.components.number import NumberEntity, NumberMode
from homeassistant.const import EntityCategory from homeassistant.const import EntityCategory
@ -26,8 +25,7 @@ from homeassistant.helpers.debounce import Debouncer
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from homeassistant.helpers.update_coordinator import CoordinatorEntity from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import DOMAIN from .coordinator import FluxLedConfigEntry, FluxLedUpdateCoordinator
from .coordinator import FluxLedUpdateCoordinator
from .entity import FluxEntity from .entity import FluxEntity
from .util import _effect_brightness from .util import _effect_brightness
@ -38,11 +36,11 @@ DEBOUNCE_TIME = 1
async def async_setup_entry( async def async_setup_entry(
hass: HomeAssistant, hass: HomeAssistant,
entry: config_entries.ConfigEntry, entry: FluxLedConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback, async_add_entities: AddConfigEntryEntitiesCallback,
) -> None: ) -> None:
"""Set up the Flux lights.""" """Set up the Flux lights."""
coordinator: FluxLedUpdateCoordinator = hass.data[DOMAIN][entry.entry_id] coordinator = entry.runtime_data
device = coordinator.device device = coordinator.device
entities: list[ entities: list[
FluxSpeedNumber FluxSpeedNumber

View File

@ -13,14 +13,13 @@ from flux_led.const import (
) )
from flux_led.protocol import PowerRestoreState, RemoteConfig from flux_led.protocol import PowerRestoreState, RemoteConfig
from homeassistant import config_entries
from homeassistant.components.select import SelectEntity from homeassistant.components.select import SelectEntity
from homeassistant.const import CONF_NAME, EntityCategory from homeassistant.const import CONF_NAME, EntityCategory
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from .const import CONF_WHITE_CHANNEL_TYPE, DOMAIN, FLUX_COLOR_MODE_RGBW from .const import CONF_WHITE_CHANNEL_TYPE, FLUX_COLOR_MODE_RGBW
from .coordinator import FluxLedUpdateCoordinator from .coordinator import FluxLedConfigEntry, FluxLedUpdateCoordinator
from .entity import FluxBaseEntity, FluxEntity from .entity import FluxBaseEntity, FluxEntity
from .util import _human_readable_option from .util import _human_readable_option
@ -29,9 +28,7 @@ NAME_TO_POWER_RESTORE_STATE = {
} }
async def _async_delayed_reload( async def _async_delayed_reload(hass: HomeAssistant, entry: FluxLedConfigEntry) -> None:
hass: HomeAssistant, entry: config_entries.ConfigEntry
) -> None:
"""Reload after making a change that will effect the operation of the device.""" """Reload after making a change that will effect the operation of the device."""
await asyncio.sleep(STATE_CHANGE_LATENCY) await asyncio.sleep(STATE_CHANGE_LATENCY)
hass.async_create_task(hass.config_entries.async_reload(entry.entry_id)) hass.async_create_task(hass.config_entries.async_reload(entry.entry_id))
@ -39,11 +36,11 @@ async def _async_delayed_reload(
async def async_setup_entry( async def async_setup_entry(
hass: HomeAssistant, hass: HomeAssistant,
entry: config_entries.ConfigEntry, entry: FluxLedConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback, async_add_entities: AddConfigEntryEntitiesCallback,
) -> None: ) -> None:
"""Set up the Flux selects.""" """Set up the Flux selects."""
coordinator: FluxLedUpdateCoordinator = hass.data[DOMAIN][entry.entry_id] coordinator = entry.runtime_data
device = coordinator.device device = coordinator.device
entities: list[ entities: list[
FluxPowerStateSelect FluxPowerStateSelect
@ -97,7 +94,7 @@ class FluxPowerStateSelect(FluxConfigAtStartSelect, SelectEntity):
def __init__( def __init__(
self, self,
device: AIOWifiLedBulb, device: AIOWifiLedBulb,
entry: config_entries.ConfigEntry, entry: FluxLedConfigEntry,
) -> None: ) -> None:
"""Initialize the power state select.""" """Initialize the power state select."""
super().__init__(device, entry) super().__init__(device, entry)
@ -228,7 +225,7 @@ class FluxWhiteChannelSelect(FluxConfigAtStartSelect):
def __init__( def __init__(
self, self,
device: AIOWifiLedBulb, device: AIOWifiLedBulb,
entry: config_entries.ConfigEntry, entry: FluxLedConfigEntry,
) -> None: ) -> None:
"""Initialize the white channel select.""" """Initialize the white channel select."""
super().__init__(device, entry) super().__init__(device, entry)

View File

@ -2,24 +2,22 @@
from __future__ import annotations from __future__ import annotations
from homeassistant import config_entries
from homeassistant.components.sensor import SensorEntity from homeassistant.components.sensor import SensorEntity
from homeassistant.const import EntityCategory from homeassistant.const import EntityCategory
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from .const import DOMAIN from .coordinator import FluxLedConfigEntry
from .coordinator import FluxLedUpdateCoordinator
from .entity import FluxEntity from .entity import FluxEntity
async def async_setup_entry( async def async_setup_entry(
hass: HomeAssistant, hass: HomeAssistant,
entry: config_entries.ConfigEntry, entry: FluxLedConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback, async_add_entities: AddConfigEntryEntitiesCallback,
) -> None: ) -> None:
"""Set up the Magic Home sensors.""" """Set up the Magic Home sensors."""
coordinator: FluxLedUpdateCoordinator = hass.data[DOMAIN][entry.entry_id] coordinator = entry.runtime_data
if coordinator.device.paired_remotes is not None: if coordinator.device.paired_remotes is not None:
async_add_entities( async_add_entities(
[ [

View File

@ -8,7 +8,6 @@ from flux_led import DeviceType
from flux_led.aio import AIOWifiLedBulb from flux_led.aio import AIOWifiLedBulb
from flux_led.const import MODE_MUSIC from flux_led.const import MODE_MUSIC
from homeassistant import config_entries
from homeassistant.components.switch import SwitchEntity from homeassistant.components.switch import SwitchEntity
from homeassistant.const import EntityCategory from homeassistant.const import EntityCategory
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
@ -19,20 +18,19 @@ from .const import (
CONF_REMOTE_ACCESS_ENABLED, CONF_REMOTE_ACCESS_ENABLED,
CONF_REMOTE_ACCESS_HOST, CONF_REMOTE_ACCESS_HOST,
CONF_REMOTE_ACCESS_PORT, CONF_REMOTE_ACCESS_PORT,
DOMAIN,
) )
from .coordinator import FluxLedUpdateCoordinator from .coordinator import FluxLedConfigEntry, FluxLedUpdateCoordinator
from .discovery import async_clear_discovery_cache from .discovery import async_clear_discovery_cache
from .entity import FluxBaseEntity, FluxEntity, FluxOnOffEntity from .entity import FluxBaseEntity, FluxEntity, FluxOnOffEntity
async def async_setup_entry( async def async_setup_entry(
hass: HomeAssistant, hass: HomeAssistant,
entry: config_entries.ConfigEntry, entry: FluxLedConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback, async_add_entities: AddConfigEntryEntitiesCallback,
) -> None: ) -> None:
"""Set up the Flux lights.""" """Set up the Flux lights."""
coordinator: FluxLedUpdateCoordinator = hass.data[DOMAIN][entry.entry_id] coordinator = entry.runtime_data
entities: list[FluxSwitch | FluxRemoteAccessSwitch | FluxMusicSwitch] = [] entities: list[FluxSwitch | FluxRemoteAccessSwitch | FluxMusicSwitch] = []
base_unique_id = entry.unique_id or entry.entry_id base_unique_id = entry.unique_id or entry.entry_id
@ -70,7 +68,7 @@ class FluxRemoteAccessSwitch(FluxBaseEntity, SwitchEntity):
def __init__( def __init__(
self, self,
device: AIOWifiLedBulb, device: AIOWifiLedBulb,
entry: config_entries.ConfigEntry, entry: FluxLedConfigEntry,
) -> None: ) -> None:
"""Initialize the light.""" """Initialize the light."""
super().__init__(device, entry) super().__init__(device, entry)