Migrate skybell light to ColorMode (#70878)

Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
epenet 2022-04-27 15:02:44 +02:00 committed by GitHub
parent e935e1b5b4
commit 485ae70308
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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