Template Light: How to "set_temperature"?

I’m trying to make a one light in a group of lights be set to twice the brightness and the same color temperature as the others. I followed this post (which doesn’t cover CCT lights) to get the following code:

light:
  - platform: group
    name: tisch_lang
    entities:
      - light.tisch_fenster_n
      - light.tisch_raum_n
      - light.adj_verlangerung

  - platform: template
    lights:
      adj_verlangerung:
        friendly_name: "Adjusted Verlangerung"     
        value_template: "{{ states('light.tisch_verlangerung_n') }}"
        turn_on:
          service: light.turn_on
          entity_id: light.tisch_verlangerung_n
        turn_off:
          service: light.turn_off
          entity_id: light.tisch_verlangerung_n
        set_level:
          service: light.turn_on
          data:
            entity_id: light.tisch_verlangerung_n
            brightness: "{{ brightness * 2 }}"
        set_temperature:
          service: light.turn_on
          data:
            entity_id: light.tisch_verlangerung_n
            value: "{{ color_temp }}"

This works fine for the brightness part, but the color temperature of light.tisch_verlangerung_n does not get adjusted. Instead I get this error every time I try to adjust it:

Logger: homeassistant.helpers.script.adjusted_verlangerung
Source: helpers/script.py:405
First occurred: 19 September 2022 at 19:35:08 (97 occurrences)
Last logged: 00:17:06

Adjusted Verlangerung: Error executing script. Invalid data for call_service at pos 1: extra keys not allowed @ data['value']
Adjusted Verlangerung: Error executing script. Invalid data for call_service at pos 1: must contain at least one of entity_id, device_id, area_id.

What am I doing wrong?

To set color temperature you use either the color_temp or kelvin option. There’s no option for a light simply called value and that’s what the error message stated.

From the documentation for the light integration:

Replace value with color_temp.

            color_temp: "{{ color_temp }}"
1 Like

Yes, that actually works. Thanks!

I got that part from the Template Light docs, where the example says:

set_temperature:
  service: input_number.set_value
  data:
    value: "{{ color_temp }}"
    entity_id: input_number.temperature_input

But of course that is using input_number instead of light… My bad.

1 Like