From 4a46fd9559c189a34e13613fb07cbc1c06ec6519 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 27 Apr 2022 09:49:20 +0200 Subject: [PATCH] Migrate yeelightsunflower light to ColorMode (#70852) --- homeassistant/components/yeelightsunflower/light.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/yeelightsunflower/light.py b/homeassistant/components/yeelightsunflower/light.py index a6820321243..1b76aef1328 100644 --- a/homeassistant/components/yeelightsunflower/light.py +++ b/homeassistant/components/yeelightsunflower/light.py @@ -10,8 +10,7 @@ from homeassistant.components.light import ( ATTR_BRIGHTNESS, ATTR_HS_COLOR, PLATFORM_SCHEMA, - SUPPORT_BRIGHTNESS, - SUPPORT_COLOR, + ColorMode, LightEntity, ) from homeassistant.const import CONF_HOST @@ -23,8 +22,6 @@ import homeassistant.util.color as color_util _LOGGER = logging.getLogger(__name__) -SUPPORT_YEELIGHT_SUNFLOWER = SUPPORT_BRIGHTNESS | SUPPORT_COLOR - PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({vol.Required(CONF_HOST): cv.string}) @@ -48,6 +45,9 @@ def setup_platform( class SunflowerBulb(LightEntity): """Representation of a Yeelight Sunflower Light.""" + _attr_color_mode = ColorMode.HS + _attr_supported_color_modes = {ColorMode.HS} + def __init__(self, light): """Initialize a Yeelight Sunflower bulb.""" self._light = light @@ -87,11 +87,6 @@ class SunflowerBulb(LightEntity): """Return the color property.""" return color_util.color_RGB_to_hs(*self._rgb_color) - @property - def supported_features(self): - """Flag supported features.""" - return SUPPORT_YEELIGHT_SUNFLOWER - def turn_on(self, **kwargs): """Instruct the light to turn on, optionally set colour/brightness.""" # when no arguments, just turn light on (full brightness)