Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 106533

Script: if without else condition

$
0
0

Hi All,

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.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 106533

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>