Migrate iaqualink light to color_mode (#69277)
This commit is contained in:
parent
6745e01b80
commit
2e84cdb16f
1 changed files with 15 additions and 7 deletions
|
@ -1,11 +1,12 @@
|
|||
"""Support for Aqualink pool lights."""
|
||||
import logging
|
||||
from __future__ import annotations
|
||||
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS,
|
||||
ATTR_EFFECT,
|
||||
COLOR_MODE_BRIGHTNESS,
|
||||
COLOR_MODE_ONOFF,
|
||||
DOMAIN,
|
||||
SUPPORT_BRIGHTNESS,
|
||||
SUPPORT_EFFECT,
|
||||
LightEntity,
|
||||
)
|
||||
|
@ -17,8 +18,6 @@ from . import AqualinkEntity, refresh_system
|
|||
from .const import DOMAIN as AQUALINK_DOMAIN
|
||||
from .utils import await_or_reraise
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
PARALLEL_UPDATES = 0
|
||||
|
||||
|
||||
|
@ -87,12 +86,21 @@ class HassAqualinkLight(AqualinkEntity, LightEntity):
|
|||
"""Return supported light effects."""
|
||||
return list(self.dev.supported_light_effects)
|
||||
|
||||
@property
|
||||
def color_mode(self) -> str:
|
||||
"""Return the color mode of the light."""
|
||||
if self.dev.is_dimmer:
|
||||
return COLOR_MODE_BRIGHTNESS
|
||||
return COLOR_MODE_ONOFF
|
||||
|
||||
@property
|
||||
def supported_color_modes(self) -> set[str] | None:
|
||||
"""Flag supported color modes."""
|
||||
return {self.color_mode}
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
"""Return the list of features supported by the light."""
|
||||
if self.dev.is_dimmer:
|
||||
return SUPPORT_BRIGHTNESS
|
||||
|
||||
if self.dev.is_color:
|
||||
return SUPPORT_EFFECT
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue