Skip to content

Commit 239767e

Browse files
authored
Set default min/max color temperature in mqtt lights (#133356)
1 parent cefb4a4 commit 239767e

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

homeassistant/components/mqtt/light/schema_basic.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
ATTR_SUPPORTED_COLOR_MODES,
2727
ATTR_WHITE,
2828
ATTR_XY_COLOR,
29+
DEFAULT_MAX_KELVIN,
30+
DEFAULT_MIN_KELVIN,
2931
ENTITY_ID_FORMAT,
3032
ColorMode,
3133
LightEntity,
@@ -264,12 +266,12 @@ def _setup_from_config(self, config: ConfigType) -> None:
264266
self._attr_min_color_temp_kelvin = (
265267
color_util.color_temperature_mired_to_kelvin(max_mireds)
266268
if (max_mireds := config.get(CONF_MAX_MIREDS))
267-
else super().min_color_temp_kelvin
269+
else DEFAULT_MIN_KELVIN
268270
)
269271
self._attr_max_color_temp_kelvin = (
270272
color_util.color_temperature_mired_to_kelvin(min_mireds)
271273
if (min_mireds := config.get(CONF_MIN_MIREDS))
272-
else super().max_color_temp_kelvin
274+
else DEFAULT_MAX_KELVIN
273275
)
274276
self._attr_effect_list = config.get(CONF_EFFECT_LIST)
275277

homeassistant/components/mqtt/light/schema_json.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
ATTR_TRANSITION,
2323
ATTR_WHITE,
2424
ATTR_XY_COLOR,
25+
DEFAULT_MAX_KELVIN,
26+
DEFAULT_MIN_KELVIN,
2527
DOMAIN as LIGHT_DOMAIN,
2628
ENTITY_ID_FORMAT,
2729
FLASH_LONG,
@@ -276,12 +278,12 @@ def _setup_from_config(self, config: ConfigType) -> None:
276278
self._attr_min_color_temp_kelvin = (
277279
color_util.color_temperature_mired_to_kelvin(max_mireds)
278280
if (max_mireds := config.get(CONF_MAX_MIREDS))
279-
else super().min_color_temp_kelvin
281+
else DEFAULT_MIN_KELVIN
280282
)
281283
self._attr_max_color_temp_kelvin = (
282284
color_util.color_temperature_mired_to_kelvin(min_mireds)
283285
if (min_mireds := config.get(CONF_MIN_MIREDS))
284-
else super().max_color_temp_kelvin
286+
else DEFAULT_MAX_KELVIN
285287
)
286288
self._attr_effect_list = config.get(CONF_EFFECT_LIST)
287289

homeassistant/components/mqtt/light/schema_template.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
ATTR_FLASH,
1616
ATTR_HS_COLOR,
1717
ATTR_TRANSITION,
18+
DEFAULT_MAX_KELVIN,
19+
DEFAULT_MIN_KELVIN,
1820
ENTITY_ID_FORMAT,
1921
ColorMode,
2022
LightEntity,
@@ -129,12 +131,12 @@ def _setup_from_config(self, config: ConfigType) -> None:
129131
self._attr_min_color_temp_kelvin = (
130132
color_util.color_temperature_mired_to_kelvin(max_mireds)
131133
if (max_mireds := config.get(CONF_MAX_MIREDS))
132-
else super().min_color_temp_kelvin
134+
else DEFAULT_MIN_KELVIN
133135
)
134136
self._attr_max_color_temp_kelvin = (
135137
color_util.color_temperature_mired_to_kelvin(min_mireds)
136138
if (min_mireds := config.get(CONF_MIN_MIREDS))
137-
else super().max_color_temp_kelvin
139+
else DEFAULT_MAX_KELVIN
138140
)
139141
self._attr_effect_list = config.get(CONF_EFFECT_LIST)
140142

0 commit comments

Comments
 (0)