Hi, i have a simple script that turns on entities based on a variable, device_aan_1.
This variable is filled based on a condition of a state of dagtype and fills it with variable devices1 or variable devices2.
This does not work.
When i use devices_aan_1: “{{ devices1 }}” it works well !
Why cant i use an if then else to fill this variable ?
this is a part of a script, when is problem is solved, i will add the second part and problem…
alias: avondtest
description: ""
icon: mdi:home
mode: single
variables:
devices1:
- light.lamp_tv_rechts
- light.lantaarn
- light.haard
devices2:
- light.dressoir
dagtype: "{{ dagtype if dagtype is defined else states('input_select.dagtypen') }}"
devices_aan_1: >-
{% if dagtype in ('normaal','party','alarm') %} "{{ devices1 }}" {% else %}
"{{ devices2 }}" {% endif %}
sequence:
- action: light.turn_{{keuze}}
target:
entity_id: "{{ devices_aan_1 }}"
metadata: {}
data: {}
enabled: true