mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Migrate skybell light to ColorMode (#70878)
Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
parent
e935e1b5b4
commit
485ae70308
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user