I’ve done some additional research.
-
According to this url Scene with template values , templates cannot be used in scenes, but they can be used in scripts.
-
According to this url https://www.home-assistant.io/blog/2020/11/18/release-118/#native-types-support-for-templates , templating is easier since Home Assisant version 0.118.
-
According to this url https://www.home-assistant.io/blog/2020/07/22/release-113/ , a chooser can be used in scripts. That is what I actually already have in my existing setup, see my existing script below.
alias: Woonkamer daglicht
sequence:
- choose:
- conditions:
- type: is_illuminance
condition: device
device_id: e6502f308a92b4ec13ea3605e16f45de
entity_id: sensor.lightlevel_19
domain: sensor
above: 140
sequence:
- scene: scene.woonkamer_uit
- conditions:
- type: is_illuminance
condition: device
device_id: e6502f308a92b4ec13ea3605e16f45de
entity_id: sensor.lightlevel_19
domain: sensor
above: 50
below: 140
sequence:
- service: script.overdag
data: {}
- conditions:
- type: is_illuminance
condition: device
device_id: e6502f308a92b4ec13ea3605e16f45de
entity_id: sensor.lightlevel_19
domain: sensor
below: 50
sequence:
- service: script.overdag_fel
data: {}
default: []
mode: single
When combining all these, it should work:
- Use the script above as the starting point
- Modify the script variables by adding two templates to it: one list containing the list of lights, one containing the color temperature value from AL as advised by you:
color_temp: >
{{ state_attr('switch.xxxx', 'color_temp_kelvin') }}
- Modify the “script choose sequences” by using a service: light.turn_on (instead of service: script.xxx), and add the following stuff to it:
- The template list of lights
- The template color_temp from AL
- The exact brightness value I like for each choose-option
I think this should work.