I have some problems with the Script syntax, where i need your help. I’ve made a script with a lot of if conditions, but i do not need the else execution. At the moment i have some warnings found in the log. How to do it better?
What i want to do is just open the covers which are enablead by input booleans, so in general:
if boolean 1 = on, then open cover 1
if boolean 2 = on, then open cover 2
if boolean 3 = on, then open cover 3
…
at the moment i’ve “homeassistant.update_entity” in the else condition but of course it’s not a entity_id.
scene_morning:
alias: open covers based on boolean
sequence:
- service: cover.open_cover
data_template:
entity_id: >
{%- if is_state('input_boolean.auf_cover_1', 'on') -%}
cover.cover_temp_1
{%- else -%}
homeassistant.update_entity
{%- endif -%}
- service: cover.open_cover
data_template:
entity_id: >
{%- if is_state('input_boolean.auf_cover_2', 'on') -%}
cover.cover_temp_2
{%- else -%}
homeassistant.update_entity
{%- endif -%}
I’ve also tried use the condition state option like in automations but i do not want to stop further execution if one condition is not true. Like in the example above, even if boolean 1 is disabled, i want to open 2 and 3 for example.
From a template perspective you can just leave out the else. Trouble is, the service is called no matter what. Aka, if it’s not true, the service is called with homeassistant.update_entity or if you leave it out, nothing.
In my opinion it’s just easy to fix if you just drop the templates all together and switch to an automation or script There you can just use the chooser.