mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 09:47:13 +00:00
Add color_temp_kelvin to set_temperature action variables (#146448)
This commit is contained in:
parent
a53997dfc7
commit
37d904dfdc
@ -524,8 +524,10 @@ class AbstractTemplateLight(AbstractTemplateEntity, LightEntity):
|
||||
ATTR_COLOR_TEMP_KELVIN in kwargs
|
||||
and (script := CONF_TEMPERATURE_ACTION) in self._action_scripts
|
||||
):
|
||||
kelvin = kwargs[ATTR_COLOR_TEMP_KELVIN]
|
||||
common_params[ATTR_COLOR_TEMP_KELVIN] = kelvin
|
||||
common_params["color_temp"] = color_util.color_temperature_kelvin_to_mired(
|
||||
kwargs[ATTR_COLOR_TEMP_KELVIN]
|
||||
kelvin
|
||||
)
|
||||
|
||||
return (script, common_params)
|
||||
|
@ -79,6 +79,7 @@ OPTIMISTIC_COLOR_TEMP_LIGHT_CONFIG = {
|
||||
"action": "set_temperature",
|
||||
"caller": "{{ this.entity_id }}",
|
||||
"color_temp": "{{color_temp}}",
|
||||
"color_temp_kelvin": "{{color_temp_kelvin}}",
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -1535,6 +1536,7 @@ async def test_temperature_action_no_template(
|
||||
assert calls[-1].data["action"] == "set_temperature"
|
||||
assert calls[-1].data["caller"] == "light.test_template_light"
|
||||
assert calls[-1].data["color_temp"] == 345
|
||||
assert calls[-1].data["color_temp_kelvin"] == 2898
|
||||
|
||||
state = hass.states.get("light.test_template_light")
|
||||
assert state is not None
|
||||
|
Loading…
x
Reference in New Issue
Block a user