mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
Use ColorMode enum in tradfri (#70544)
This commit is contained in:
parent
6e1b8a9387
commit
9a38172d1f
@ -11,9 +11,7 @@ from homeassistant.components.light import (
|
|||||||
ATTR_COLOR_TEMP,
|
ATTR_COLOR_TEMP,
|
||||||
ATTR_HS_COLOR,
|
ATTR_HS_COLOR,
|
||||||
ATTR_TRANSITION,
|
ATTR_TRANSITION,
|
||||||
COLOR_MODE_BRIGHTNESS,
|
ColorMode,
|
||||||
COLOR_MODE_COLOR_TEMP,
|
|
||||||
COLOR_MODE_HS,
|
|
||||||
LightEntity,
|
LightEntity,
|
||||||
LightEntityFeature,
|
LightEntityFeature,
|
||||||
)
|
)
|
||||||
@ -75,16 +73,16 @@ class TradfriLight(TradfriBaseEntity, LightEntity):
|
|||||||
# Calculate supported color modes
|
# Calculate supported color modes
|
||||||
self._attr_supported_color_modes = set()
|
self._attr_supported_color_modes = set()
|
||||||
if self._device.light_control.can_set_color:
|
if self._device.light_control.can_set_color:
|
||||||
self._attr_supported_color_modes.add(COLOR_MODE_HS)
|
self._attr_supported_color_modes.add(ColorMode.HS)
|
||||||
if self._device.light_control.can_set_temp:
|
if self._device.light_control.can_set_temp:
|
||||||
self._attr_supported_color_modes.add(COLOR_MODE_COLOR_TEMP)
|
self._attr_supported_color_modes.add(ColorMode.COLOR_TEMP)
|
||||||
if (
|
if (
|
||||||
not self._attr_supported_color_modes
|
not self._attr_supported_color_modes
|
||||||
and self._device.light_control.can_set_dimmer
|
and self._device.light_control.can_set_dimmer
|
||||||
):
|
):
|
||||||
# Must be the only supported mode according to docs for
|
# Must be the only supported mode according to docs for
|
||||||
# COLOR_MODE_BRIGHTNESS
|
# ColorMode.BRIGHTNESS
|
||||||
self._attr_supported_color_modes.add(COLOR_MODE_BRIGHTNESS)
|
self._attr_supported_color_modes.add(ColorMode.BRIGHTNESS)
|
||||||
|
|
||||||
if self._device_control:
|
if self._device_control:
|
||||||
self._attr_min_mireds = self._device_control.min_mireds
|
self._attr_min_mireds = self._device_control.min_mireds
|
||||||
|
Loading…
x
Reference in New Issue
Block a user