From 485ae70308fe8a1e0387db06ee6795a7ba0816f5 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 27 Apr 2022 15:02:44 +0200 Subject: [PATCH] Migrate skybell light to ColorMode (#70878) Co-authored-by: Franck Nijhof --- homeassistant/components/skybell/light.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/homeassistant/components/skybell/light.py b/homeassistant/components/skybell/light.py index 6285c183384..7fbd1519e26 100644 --- a/homeassistant/components/skybell/light.py +++ b/homeassistant/components/skybell/light.py @@ -4,8 +4,7 @@ from __future__ import annotations from homeassistant.components.light import ( ATTR_BRIGHTNESS, ATTR_HS_COLOR, - SUPPORT_BRIGHTNESS, - SUPPORT_COLOR, + ColorMode, LightEntity, ) from homeassistant.core import HomeAssistant @@ -45,15 +44,13 @@ def _to_hass_level(level): class SkybellLight(SkybellDevice, LightEntity): """A binary sensor implementation for Skybell devices.""" + _attr_color_mode = ColorMode.HS + _attr_supported_color_modes = {ColorMode.HS} + def __init__(self, device): """Initialize a light for a Skybell device.""" super().__init__(device) - self._name = self._device.name - - @property - def name(self): - """Return the name of the sensor.""" - return self._name + self._attr_name = device.name def turn_on(self, **kwargs): """Turn on the light.""" @@ -83,8 +80,3 @@ class SkybellLight(SkybellDevice, LightEntity): def hs_color(self): """Return the color of the light.""" return color_util.color_RGB_to_hs(*self._device.led_rgb) - - @property - def supported_features(self): - """Flag supported features.""" - return SUPPORT_BRIGHTNESS | SUPPORT_COLOR