mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Migrate vera light to ColorMode (#70861)
This commit is contained in:
parent
c5d69ab1b2
commit
71f95d199a
@ -9,8 +9,7 @@ from homeassistant.components.light import (
|
|||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
ATTR_HS_COLOR,
|
ATTR_HS_COLOR,
|
||||||
ENTITY_ID_FORMAT,
|
ENTITY_ID_FORMAT,
|
||||||
SUPPORT_BRIGHTNESS,
|
ColorMode,
|
||||||
SUPPORT_COLOR,
|
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
@ -63,11 +62,18 @@ class VeraLight(VeraDevice[veraApi.VeraDimmer], LightEntity):
|
|||||||
return self._color
|
return self._color
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_features(self) -> int:
|
def color_mode(self) -> ColorMode:
|
||||||
"""Flag supported features."""
|
"""Return the color mode of the light."""
|
||||||
if self._color:
|
if self.vera_device.is_dimmable:
|
||||||
return SUPPORT_BRIGHTNESS | SUPPORT_COLOR
|
if self._color:
|
||||||
return SUPPORT_BRIGHTNESS
|
return ColorMode.HS
|
||||||
|
return ColorMode.BRIGHTNESS
|
||||||
|
return ColorMode.ONOFF
|
||||||
|
|
||||||
|
@property
|
||||||
|
def supported_color_modes(self) -> set[ColorMode]:
|
||||||
|
"""Flag supported color modes."""
|
||||||
|
return {self.color_mode}
|
||||||
|
|
||||||
def turn_on(self, **kwargs: Any) -> None:
|
def turn_on(self, **kwargs: Any) -> None:
|
||||||
"""Turn the light on."""
|
"""Turn the light on."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user