mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
Use ColorMode enum in twinkly (#70546)
This commit is contained in:
parent
121d2008c2
commit
76aea16f29
@ -12,9 +12,7 @@ from homeassistant.components.light import (
|
|||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
ATTR_RGB_COLOR,
|
ATTR_RGB_COLOR,
|
||||||
ATTR_RGBW_COLOR,
|
ATTR_RGBW_COLOR,
|
||||||
COLOR_MODE_BRIGHTNESS,
|
ColorMode,
|
||||||
COLOR_MODE_RGB,
|
|
||||||
COLOR_MODE_RGBW,
|
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
@ -70,16 +68,16 @@ class TwinklyLight(LightEntity):
|
|||||||
self._conf = conf
|
self._conf = conf
|
||||||
|
|
||||||
if device_info.get(DEV_LED_PROFILE) == DEV_PROFILE_RGBW:
|
if device_info.get(DEV_LED_PROFILE) == DEV_PROFILE_RGBW:
|
||||||
self._attr_supported_color_modes = {COLOR_MODE_RGBW}
|
self._attr_supported_color_modes = {ColorMode.RGBW}
|
||||||
self._attr_color_mode = COLOR_MODE_RGBW
|
self._attr_color_mode = ColorMode.RGBW
|
||||||
self._attr_rgbw_color = (255, 255, 255, 0)
|
self._attr_rgbw_color = (255, 255, 255, 0)
|
||||||
elif device_info.get(DEV_LED_PROFILE) == DEV_PROFILE_RGB:
|
elif device_info.get(DEV_LED_PROFILE) == DEV_PROFILE_RGB:
|
||||||
self._attr_supported_color_modes = {COLOR_MODE_RGB}
|
self._attr_supported_color_modes = {ColorMode.RGB}
|
||||||
self._attr_color_mode = COLOR_MODE_RGB
|
self._attr_color_mode = ColorMode.RGB
|
||||||
self._attr_rgb_color = (255, 255, 255)
|
self._attr_rgb_color = (255, 255, 255)
|
||||||
else:
|
else:
|
||||||
self._attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
|
self._attr_supported_color_modes = {ColorMode.BRIGHTNESS}
|
||||||
self._attr_color_mode = COLOR_MODE_BRIGHTNESS
|
self._attr_color_mode = ColorMode.BRIGHTNESS
|
||||||
|
|
||||||
# Those are saved in the config entry in order to have meaningful values even
|
# Those are saved in the config entry in order to have meaningful values even
|
||||||
# if the device is currently offline.
|
# if the device is currently offline.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user