Migrate home_connect light to color_mode (#69260)
This commit is contained in:
parent
e9a60418c2
commit
3416e9b621
1 changed files with 6 additions and 9 deletions
|
@ -7,8 +7,8 @@ from homeconnect.api import HomeConnectError
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
ATTR_HS_COLOR,
|
ATTR_HS_COLOR,
|
||||||
SUPPORT_BRIGHTNESS,
|
COLOR_MODE_BRIGHTNESS,
|
||||||
SUPPORT_COLOR,
|
COLOR_MODE_HS,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
@ -68,11 +68,15 @@ class HomeConnectLight(HomeConnectEntity, LightEntity):
|
||||||
self._key = BSH_AMBIENT_LIGHT_ENABLED
|
self._key = BSH_AMBIENT_LIGHT_ENABLED
|
||||||
self._custom_color_key = BSH_AMBIENT_LIGHT_CUSTOM_COLOR
|
self._custom_color_key = BSH_AMBIENT_LIGHT_CUSTOM_COLOR
|
||||||
self._color_key = BSH_AMBIENT_LIGHT_COLOR
|
self._color_key = BSH_AMBIENT_LIGHT_COLOR
|
||||||
|
self._attr_color_mode = COLOR_MODE_HS
|
||||||
|
self._attr_supported_color_modes = {COLOR_MODE_HS}
|
||||||
else:
|
else:
|
||||||
self._brightness_key = COOKING_LIGHTING_BRIGHTNESS
|
self._brightness_key = COOKING_LIGHTING_BRIGHTNESS
|
||||||
self._key = COOKING_LIGHTING
|
self._key = COOKING_LIGHTING
|
||||||
self._custom_color_key = None
|
self._custom_color_key = None
|
||||||
self._color_key = None
|
self._color_key = None
|
||||||
|
self._attr_color_mode = COLOR_MODE_BRIGHTNESS
|
||||||
|
self._attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
|
@ -89,13 +93,6 @@ class HomeConnectLight(HomeConnectEntity, LightEntity):
|
||||||
"""Return the color property."""
|
"""Return the color property."""
|
||||||
return self._hs_color
|
return self._hs_color
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Flag supported features."""
|
|
||||||
if self._ambient:
|
|
||||||
return SUPPORT_BRIGHTNESS | SUPPORT_COLOR
|
|
||||||
return SUPPORT_BRIGHTNESS
|
|
||||||
|
|
||||||
async def async_turn_on(self, **kwargs):
|
async def async_turn_on(self, **kwargs):
|
||||||
"""Switch the light on, change brightness, change color."""
|
"""Switch the light on, change brightness, change color."""
|
||||||
if self._ambient:
|
if self._ambient:
|
||||||
|
|
Loading…
Add table
Reference in a new issue