mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 17:27:10 +00:00
Migrate iaqualink light to color_mode (#69277)
This commit is contained in:
parent
6745e01b80
commit
2e84cdb16f
@ -1,11 +1,12 @@
|
|||||||
"""Support for Aqualink pool lights."""
|
"""Support for Aqualink pool lights."""
|
||||||
import logging
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
ATTR_EFFECT,
|
ATTR_EFFECT,
|
||||||
|
COLOR_MODE_BRIGHTNESS,
|
||||||
|
COLOR_MODE_ONOFF,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
SUPPORT_BRIGHTNESS,
|
|
||||||
SUPPORT_EFFECT,
|
SUPPORT_EFFECT,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
@ -17,8 +18,6 @@ from . import AqualinkEntity, refresh_system
|
|||||||
from .const import DOMAIN as AQUALINK_DOMAIN
|
from .const import DOMAIN as AQUALINK_DOMAIN
|
||||||
from .utils import await_or_reraise
|
from .utils import await_or_reraise
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
PARALLEL_UPDATES = 0
|
PARALLEL_UPDATES = 0
|
||||||
|
|
||||||
|
|
||||||
@ -87,12 +86,21 @@ class HassAqualinkLight(AqualinkEntity, LightEntity):
|
|||||||
"""Return supported light effects."""
|
"""Return supported light effects."""
|
||||||
return list(self.dev.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
|
@property
|
||||||
def supported_features(self) -> int:
|
def supported_features(self) -> int:
|
||||||
"""Return the list of features supported by the light."""
|
"""Return the list of features supported by the light."""
|
||||||
if self.dev.is_dimmer:
|
|
||||||
return SUPPORT_BRIGHTNESS
|
|
||||||
|
|
||||||
if self.dev.is_color:
|
if self.dev.is_color:
|
||||||
return SUPPORT_EFFECT
|
return SUPPORT_EFFECT
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user