Use light enums in tplink (#70787)
parent
6f88722454
commit
d58430bc93
|
@ -14,10 +14,9 @@ from homeassistant.components.light import (
|
||||||
ATTR_EFFECT,
|
ATTR_EFFECT,
|
||||||
ATTR_HS_COLOR,
|
ATTR_HS_COLOR,
|
||||||
ATTR_TRANSITION,
|
ATTR_TRANSITION,
|
||||||
SUPPORT_EFFECT,
|
|
||||||
SUPPORT_TRANSITION,
|
|
||||||
ColorMode,
|
ColorMode,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
|
LightEntityFeature,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
|
@ -163,6 +162,8 @@ async def async_setup_entry(
|
||||||
class TPLinkSmartBulb(CoordinatedTPLinkEntity, LightEntity):
|
class TPLinkSmartBulb(CoordinatedTPLinkEntity, LightEntity):
|
||||||
"""Representation of a TPLink Smart Bulb."""
|
"""Representation of a TPLink Smart Bulb."""
|
||||||
|
|
||||||
|
_attr_supported_features = LightEntityFeature.TRANSITION
|
||||||
|
|
||||||
device: SmartBulb
|
device: SmartBulb
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -276,11 +277,6 @@ class TPLinkSmartBulb(CoordinatedTPLinkEntity, LightEntity):
|
||||||
hue, saturation, _ = self.device.hsv
|
hue, saturation, _ = self.device.hsv
|
||||||
return hue, saturation
|
return hue, saturation
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self) -> int:
|
|
||||||
"""Flag supported features."""
|
|
||||||
return SUPPORT_TRANSITION
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_color_modes(self) -> set[ColorMode | str] | None:
|
def supported_color_modes(self) -> set[ColorMode | str] | None:
|
||||||
"""Return list of available color modes."""
|
"""Return list of available color modes."""
|
||||||
|
@ -318,7 +314,7 @@ class TPLinkSmartLightStrip(TPLinkSmartBulb):
|
||||||
@property
|
@property
|
||||||
def supported_features(self) -> int:
|
def supported_features(self) -> int:
|
||||||
"""Flag supported features."""
|
"""Flag supported features."""
|
||||||
return super().supported_features | SUPPORT_EFFECT
|
return super().supported_features | LightEntityFeature.EFFECT
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def effect_list(self) -> list[str] | None:
|
def effect_list(self) -> list[str] | None:
|
||||||
|
|
Loading…
Reference in New Issue