Light Template Cannot Change Color Mode

I’ve got a light template and I cannot (from the documentation) figure out how to change the color mode. In my light template, if i change the color temperature, the color/temperature will correctly change but the color mode will stay at “HS”. If I change an actual light’s color temperature, the color mode will go to “color_temp”. Is there any way to fix my template?

  - platform: template
    lights:
      fish_light_3:
        friendly_name: "Fish Light 3"
        level_template: "{{ state_attr('light.gledopto_gl_c_008_1a140f15_11', 'brightness')|int }}"
        #value_template: "{{ state_attr('light.gledopto_gl_c_008_1a140f15_11', 'brightness')|int > 0 }}"
        value_template: "{{ states.light.gledopto_gl_c_008_1a140f15_11.state }}"
        temperature_template: "{{state_attr('light.gledopto_gl_c_008_1a140f15_11', 'color_temp') | int}}"
        color_template: "{{state_attr('light.gledopto_gl_c_008_1a140f15_11', 'hs_color')}}" #"({{states('input_number.h_input') | int}}, {{states('input_number.s_input') | int}})"
        #effect_list_template: "{{ state_attr('light.gledopto_gl_c_008_1a140f15_11', 'effect_list') }}"
        turn_on:
          - service: light.turn_on
            entity_id: light.gledopto_gl_c_008_1a140f15_11
        turn_off:
          - delay: 00:00:05
          - service: light.turn_off
            entity_id: light.gledopto_gl_c_008_1a140f15_11
        set_level:
          service: light.turn_on
          data:
            entity_id: light.gledopto_gl_c_008_1a140f15_11
            brightness: "{{ brightness }}"
        set_temperature:
          #- service: input_text.set_value
          #  data_template:
          #    entity_id: input_text.broadcast_message_to_office
          #    value: "{{ color_temp }}"
          - service: light.turn_on
            data:
              entity_id: light.gledopto_gl_c_008_1a140f15_11
              color_temp: "{{ color_temp }}"
        #set_white_value:
        #  service: light.turn_on
        #  data:
        #    entity_id: light.gledopto_gl_c_008_1a140f15_11
        #    white: "{{ white_value }}"
        set_color:
          - service: light.turn_on
            data_template:
              entity_id: light.gledopto_gl_c_008_1a140f15_11
              hs_color: "[{{h}}, {{s}}]"
        #set_effect:
        #  - service: light.turn_on
        #    data_template:
        #      entity_id:
        #        - light.ledvance_a19_rgbw_e1e40500_level_light_color_on_off
        #      effect: "{{ effect }}"
        supports_transition_template: "{{ true }}"
  - platform: template
    lights:
      kitchen_led:
        friendly_name: "Kitchen LED"
        level_template: "{{ state_attr('light.gledopto_gl_c_008_c19f431d_level_light_color_on_off', 'brightness')|int }}"
        #value_template: "{{ state_attr('light.gledopto_gl_c_008_c19f431d_level_light_color_on_off', 'brightness')|int > 0 }}"
        value_template: "{{ states.light.gledopto_gl_c_008_c19f431d_level_light_color_on_off.state }}"
        temperature_template: "{{state_attr('light.gledopto_gl_c_008_c19f431d_level_light_color_on_off', 'color_temp') | int}}"
        color_template: "{{state_attr('light.gledopto_gl_c_008_c19f431d_level_light_color_on_off', 'hs_color')}}" #"({{states('input_number.h_input') | int}}, {{states('input_number.s_input') | int}})"
        #effect_list_template: "{{ state_attr('light.gledopto_gl_c_008_c19f431d_level_light_color_on_off', 'effect_list') }}"
        turn_on:
          - service: light.turn_on
            entity_id: light.gledopto_gl_c_008_c19f431d_level_light_color_on_off
        turn_off:
          - delay: 00:00:05
          - service: light.turn_off
            entity_id: light.gledopto_gl_c_008_c19f431d_level_light_color_on_off
        set_level:
          service: light.turn_on
          data:
            entity_id: light.gledopto_gl_c_008_c19f431d_level_light_color_on_off
            brightness: "{{ brightness }}"
        set_temperature:
          service: light.turn_on
          data:
            entity_id: light.gledopto_gl_c_008_c19f431d_level_light_color_on_off
            color_temp: "{{ color_temp }}"
        #set_white_value:
        #  service: light.turn_on
        #  data:
        #    entity_id: light.gledopto_gl_c_008_c19f431d_level_light_color_on_off
        #    white: "{{ white_value }}"
        set_color:
          - service: light.turn_on
            data_template:
              entity_id: light.gledopto_gl_c_008_c19f431d_level_light_color_on_off
              hs_color: "[{{h}}, {{s}}]"
        #set_effect:
        #  - service: light.turn_on
        #    data_template:
        #      entity_id:
        #        - light.ledvance_a19_rgbw_e1e40500_level_light_color_on_off
        #      effect: "{{ effect }}"
        supports_transition_template: "{{ true }}"
2 Likes

Did you ever discover the solution to this? I can’t discover how Home Assistant determines what color mode the light is in. I assumed there would be a color_mode_template but there is not. No matter what I do if I go look at the state attributes the “color_mode” is always “hs” and I can’t figure out how to change it to “color_temp”.

@James_Huang
Did you found a solution ?

1 Like

Same issue here.

Same issue. Has anyone found a solution?

I want to merge a relay and a led controller into a single light entity. Everything works except for this color_mode change.

If it’s any help, I reported it as an issue on GitHub. Light Template Cannot Change Color Mode · Issue #105902 · home-assistant/core · GitHub