core
core copied to clipboard
Light Template Cannot Change Color Mode
The problem
I want to create a template light, which will combine a relay switch (for on/off) and a led controller (for color temperature, brightness, color and effects).
Functionally everything works fine. However, once I try setting a color, the color_mode
attribute gets permanently stuck at hs
value. So, even when I change just the ww/cw temperature, the light does change the color correctly, but color_mode
is still hs
, and not color_temp
as it should be. This results in the handle on the color temperature slider not being show, so you don't really know what is the current temperature. You can see it while you set it, but then it disappears after you leave it alone.
The color_mode
does change as expected on the original led controller entity, but just not on the light template.
Attributes of the original led controller entity:
Attributes of the template light entity:
Expected behaviour:
When set_temperature
is called, the color_mode
attribute should switch to color_temp
.
What version of Home Assistant Core has the issue?
core-2023.12.3
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Template Light
Link to integration documentation on our website
No response
Diagnostics information
No response
Example YAML snippet
Here is my YAML configuration of the whole template light:
office_light_2:
friendly_name: "Office Light"
unique_id: "office_light_2"
value_template: "{{ states('light.office_light') }}"
availability_template: "{{ states('light.office_light') != 'unavailable' }}"
level_template: "{{ state_attr('light.office_light_controller', 'brightness') }}"
min_mireds_template: "{{ state_attr('light.office_light_controller', 'min_mireds') }}"
max_mireds_template: "{{ state_attr('light.office_light_controller', 'max_mireds') }}"
temperature_template: "{{ state_attr('light.office_light_controller', 'color_temp') }}"
hs_template: "{{ state_attr('light.office_light_controller', 'hs_color') }}"
effect_template: "{{ state_attr('light.office_light_controller', 'effect') }}"
effect_list_template: "{{ state_attr('light.office_light_controller', 'effect_list') }}"
turn_on:
service: light.turn_on
target:
entity_id: light.office_light
turn_off:
service: light.turn_off
target:
entity_id: light.office_light
set_level:
service: light.turn_on
target:
entity_id: light.office_light_controller
data:
brightness: "{{ brightness }}"
set_temperature:
service: light.turn_on
target:
entity_id: light.office_light_controller
data:
color_temp: "{{ color_temp }}"
set_hs:
service: light.turn_on
target:
entity_id: light.office_light_controller
data:
hs_color: "{{ hs }}"
set_effect:
service: light.turn_on
target:
entity_id: light.office_light_controller
data:
effect: "{{ effect }}"
### Anything in the logs that might be useful for us?
_No response_
### Additional information
The issue has been reported here already https://community.home-assistant.io/t/light-template-cannot-change-color-mode/444424