mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 00:37:53 +00:00
Set default min/max color temperature in mqtt lights (#133356)
This commit is contained in:
parent
cefb4a4ccc
commit
239767ee62
@ -26,6 +26,8 @@ from homeassistant.components.light import (
|
||||
ATTR_SUPPORTED_COLOR_MODES,
|
||||
ATTR_WHITE,
|
||||
ATTR_XY_COLOR,
|
||||
DEFAULT_MAX_KELVIN,
|
||||
DEFAULT_MIN_KELVIN,
|
||||
ENTITY_ID_FORMAT,
|
||||
ColorMode,
|
||||
LightEntity,
|
||||
@ -264,12 +266,12 @@ class MqttLight(MqttEntity, LightEntity, RestoreEntity):
|
||||
self._attr_min_color_temp_kelvin = (
|
||||
color_util.color_temperature_mired_to_kelvin(max_mireds)
|
||||
if (max_mireds := config.get(CONF_MAX_MIREDS))
|
||||
else super().min_color_temp_kelvin
|
||||
else DEFAULT_MIN_KELVIN
|
||||
)
|
||||
self._attr_max_color_temp_kelvin = (
|
||||
color_util.color_temperature_mired_to_kelvin(min_mireds)
|
||||
if (min_mireds := config.get(CONF_MIN_MIREDS))
|
||||
else super().max_color_temp_kelvin
|
||||
else DEFAULT_MAX_KELVIN
|
||||
)
|
||||
self._attr_effect_list = config.get(CONF_EFFECT_LIST)
|
||||
|
||||
|
@ -22,6 +22,8 @@ from homeassistant.components.light import (
|
||||
ATTR_TRANSITION,
|
||||
ATTR_WHITE,
|
||||
ATTR_XY_COLOR,
|
||||
DEFAULT_MAX_KELVIN,
|
||||
DEFAULT_MIN_KELVIN,
|
||||
DOMAIN as LIGHT_DOMAIN,
|
||||
ENTITY_ID_FORMAT,
|
||||
FLASH_LONG,
|
||||
@ -276,12 +278,12 @@ class MqttLightJson(MqttEntity, LightEntity, RestoreEntity):
|
||||
self._attr_min_color_temp_kelvin = (
|
||||
color_util.color_temperature_mired_to_kelvin(max_mireds)
|
||||
if (max_mireds := config.get(CONF_MAX_MIREDS))
|
||||
else super().min_color_temp_kelvin
|
||||
else DEFAULT_MIN_KELVIN
|
||||
)
|
||||
self._attr_max_color_temp_kelvin = (
|
||||
color_util.color_temperature_mired_to_kelvin(min_mireds)
|
||||
if (min_mireds := config.get(CONF_MIN_MIREDS))
|
||||
else super().max_color_temp_kelvin
|
||||
else DEFAULT_MAX_KELVIN
|
||||
)
|
||||
self._attr_effect_list = config.get(CONF_EFFECT_LIST)
|
||||
|
||||
|
@ -15,6 +15,8 @@ from homeassistant.components.light import (
|
||||
ATTR_FLASH,
|
||||
ATTR_HS_COLOR,
|
||||
ATTR_TRANSITION,
|
||||
DEFAULT_MAX_KELVIN,
|
||||
DEFAULT_MIN_KELVIN,
|
||||
ENTITY_ID_FORMAT,
|
||||
ColorMode,
|
||||
LightEntity,
|
||||
@ -129,12 +131,12 @@ class MqttLightTemplate(MqttEntity, LightEntity, RestoreEntity):
|
||||
self._attr_min_color_temp_kelvin = (
|
||||
color_util.color_temperature_mired_to_kelvin(max_mireds)
|
||||
if (max_mireds := config.get(CONF_MAX_MIREDS))
|
||||
else super().min_color_temp_kelvin
|
||||
else DEFAULT_MIN_KELVIN
|
||||
)
|
||||
self._attr_max_color_temp_kelvin = (
|
||||
color_util.color_temperature_mired_to_kelvin(min_mireds)
|
||||
if (min_mireds := config.get(CONF_MIN_MIREDS))
|
||||
else super().max_color_temp_kelvin
|
||||
else DEFAULT_MAX_KELVIN
|
||||
)
|
||||
self._attr_effect_list = config.get(CONF_EFFECT_LIST)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user