Use light enums in tplink (#70787)

pull/70803/head
epenet 2022-04-26 14:54:17 +02:00 committed by GitHub
parent 6f88722454
commit d58430bc93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 8 deletions

View File

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