Hi, I thought this would be straightforward, but I’m struggling. I’ve read the docs, but I’m clearly missing something… I want to pass a variable into this script, to template the entity_id
in the condition:
alias: Light Toggle
sequence:
- choose:
- conditions:
- condition: state
entity_id: light.{{room}}
state: "on"
alias: If light is on
enabled: true
sequence:
- service: input_select.select_option
data:
option: "Off"
target:
entity_id: input_select.scene_{{room}}
default: []
mode: restart
icon: mdi:lightbulb-multiple-outline
But I recieve an error:
Message malformed: Entity light.{{room}} is neither a valid entity ID nor a valid UUID for dictionary value @ data['sequence'][0]['choose'][0]['conditions'][0]['entity_id']
Is it that entity_id
's can’t be templated? I ask that as I’m passing variables to build entity_id
's in the actions of other scripts without an error:
alias: Lights On Using Default Scene
sequence:
- service: input_select.select_option
target:
entity_id: input_select.scene_{{room}}
data:
option: "{{ states('input_select.house_default_lighting')}}"
alias: Set "input_select.scene_room" to "input_select.house_default_lighting"
mode: restart
icon: mdi:lightbulb-auto
If that is the case (no templating entity_id
's in conditions), is there another way to achieve this? Currently, I have 3 scripts per lighting zone (aka: room), and a total of 14 lighting zones. I want to reduce the overhead of static files.