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

Question about script

$
0
0

@Makis wrote:

I have the following script

go_to_bed:
  alias: Goodnight
  icon: mdi:bed-empty
  sequence:
  - service: automation.trigger
    entity_id:
    - automation.set_alarm_at_night  
  - service: light.turn_on
    data:
      entity_id: light.bedside_lamp
  
  - service: cover.close_cover
    data:
      entity_id:
      - cover.50758014840d8e91f4fd #window1
  - delay: '00:00:40'
  
  - service: cover.close_cover
    data:
      entity_id:
      - cover.50758014840d8e91f036 #window
  - delay: '00:00:10'
  
  - service: cover.close_cover
    data:
       entity_id:
       - cover.50758014840d8e91eaa2 #bedroom
  - delay: '00:00:15'
  
  - service: cover.close_cover
    data:
      entity_id:
       - cover.50758014840d8e918632 #kid
  - delay: '00:00:02'

and I would like to add a condition to close each cover IF it’s state is “open” or “unknown”
something like this

condition:
    condition: or
    conditions:
      - condition: state
        entity_id: cover.50758014840d8e918614
        state: "unknown"
      - condition: state
        entity_id: cover.50758014840d8e918614
        state: "open"

Will this work? Because if I understand right if one cover is closed (state “closed”) it will not continue to execute the rest of the script.

While executing a script you can add a condition to stop further execution. 
When a condition does not return true, the script will stop executing. 

Is there an alternative way to add the condition?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 102441

Trending Articles



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