From d58430bc93fb9585cb20ab153f171b1377c553ca Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Tue, 26 Apr 2022 14:54:17 +0200 Subject: [PATCH] Use light enums in tplink (#70787) --- homeassistant/components/tplink/light.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/tplink/light.py b/homeassistant/components/tplink/light.py index e02d7cdeca0..f946629813e 100644 --- a/homeassistant/components/tplink/light.py +++ b/homeassistant/components/tplink/light.py @@ -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: