I have a switch that gives a pulse for one second and then goes to off state to open my slidinggate.
Now i want choose how lang the gate stays open and then auto closes.
I made a timer and two automations.
But as you can see the code runs again everytime there is a pulse so it’s never ending.
How do i do that ?
- id: '1702656970993'
alias: Openen poort volledig timer start
description: ''
trigger:
- platform: state
entity_id:
- switch.poort_volledig_open
to: 'on'
condition: []
action:
- service: timer.start
target:
entity_id: timer.poort_volledig_open
data: {}
mode: single
- id: '1702659712089'
alias: Openen poort timer finished
description: ''
trigger:
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.poort_volledig_open
condition: []
action:
- service: switch.turn_on
target:
entity_id: switch.poort_volledig_open
data: {}
mode: single
Found it, just added a delay of 2 seconds so the state = off