kitchen_ceiling_cct:
  alias: Steuere Deckenlicht CCT
  mode: parallel
  fields:
    brightness:
      description: Zielhelligkeit (0–255)
      example: "180"
    color_temp:
      description: Farbtemperatur in Mired (153–370)
      example: "270"
  sequence:
    - variables:
        brightness: "{{ brightness | default(255) | int }}"
        color_temp: "{{ color_temp | default(370) | int }}"
        ratio: "{{ ((color_temp - 153) / (370 - 153)) | float }}"
        ww: "{{ (brightness * ratio) | round(0) | int }}"
        cw: "{{ (brightness * (1 - ratio)) | round(0) | int }}"
    - alias: setColorTemp
      choose:
        - conditions:
            - condition: template
              value_template: "{{color_temp is defined}}"
          sequence:
            - action: light.turn_on
              target:
                entity_id: light.kitchen_ceiling_ww
              data:
                brightness: "{{ ww }}"
            - action: light.turn_on
              target:
                entity_id: light.kitchen_ceiling_cw
              data:
                brightness: "{{ cw }}"
