I wrote a script to basically shutdown the house when I leave. I have issue with the conditions and the garage doors. Basically, door 2 will only close if door 1 is also open. Anyone know how to have 2 separate conditions on one script?? thx
lock_down:
alias: Leave the house
sequence:
- service: homeassistant.turn_off
entity_id: group.inside_lights
- service: alarm_control_panel.alarm_arm_away
- service: climate.set_away_mode
data:
entity_id: climate.hallway
away_mode: true
# Close door 1 if open
- condition: state
entity_id: binary_sensor.garage_door_1
state: 'on'
- service: cover.close_cover
entity_id: cover.garage_door_1
# Close door 2 if open
- condition: state
entity_id: binary_sensor.garage_door_2
state: 'on'
- service: cover.close_cover
entity_id: cover.garage_door_2`
Yes. Move each set of condition and service into its own separate script, then call the two scripts from the original script. At least that’s how I did it.
Conditions and following actions will only keep running as long as each condition is true.
Once a single condition is false, the script stops.
Question: do you need to check if the binary_sensor.garage_door_1 is on to close the garage_door_1?
What happens if you try and close the door when it’s already closed?
If this is an issue, have you tried a service template?
Thanks everyone! This seems to work, it will turns off the inside lights, puts nest into away mode, sets the alarm panel to away and closes any OPEN garage doors. Cool…
lock_down:
alias: Leave the house
sequence:
- service: homeassistant.turn_off
entity_id: group.inside_lights
- service: alarm_control_panel.alarm_arm_away
- service: climate.set_away_mode
data:
entity_id: climate.hallway
away_mode: true
- service: script.close_door_1
- service: script.close_door_2
close_door_1:
alias: Closed Garage Door 1
# Close door 1 if open '
sequence:
- condition: state
entity_id: binary_sensor.garage_door_1
state: 'on'
- service: cover.close_cover
entity_id: cover.garage_door_1
close_door_2:
alias: Closed Garage Door 2
# Close door 2 if open
sequence:
- condition: state
entity_id: binary_sensor.garage_door_2
state: 'on'
- service: cover.close_cover
entity_id: cover.garage_door_2