Please try this
action:
- repeat:
while:
- condition: state
entity_id: input_boolean.open_gate
state: 'off'
sequence:
- service: switch.turn_on
data: {}
entity_id: switch.dahua_gate_open
- delay: '00:00:10'
- service: switch.turn_on
data: {}
entity_id: switch.dahua_gate_open
- delay: '00:00:10'
this is what i have done.
when i execure the automation, it seems to work.
however, when i use the inputboolean it deoes not
should i have 2 repeats
- repeat whilst state: on
- repeat until state: off
Thanks
alias: Open Gate
description: ''
trigger:
- platform: state
entity_id: input_boolean.open_gate
from: 'off'
to: 'on'
condition: []
action:
- service: switch.turn_on
data: {}
entity_id: switch.dahua_gate_open
- repeat:
while:
- condition: state
entity_id: input_boolean.open_gate
state: 'off'
sequence:
- service: switch.turn_on
data: {}
entity_id: switch.dahua_gate_open
- delay: '00:00:10'
- service: switch.turn_on
data: {}
entity_id: switch.dahua_gate_open
- delay: '00:00:10'
mode: single
```
There was a small problem with automation script. Try this
alias: Open Gate
description: ''
trigger:
- platform: state
entity_id: input_boolean.open_gate
from: 'off'
to: 'on'
condition: []
action:
- repeat:
until:
- condition: state
entity_id: input_boolean.open_gate
state: 'off'
sequence:
- service: switch.turn_on
data: {}
entity_id: switch.dahua_gate_open
- delay: '00:00:10'
- service: switch.turn_on
data: {}
entity_id: switch.dahua_gate_open
- delay: '00:00:10'
mode: single
it works !. Thank you very much.
1 Like