Toggle a switch (or scene) only once in a specified time

Hi, I just almost finished the control setup for my new swing gate. It was a bit tricky to create a solution to show in HA if the gate is open or not, because the gate react on toggle impulses and don’t response his own status. I solved it via input_booleans and it works fine so far.

The input_booleans controlled by the status of a wifi-switch. If the switch changes from OFF to ON, the boolean will change and the opening process of the gate starts. But the wifi-switch changes after one second in OFF again (because toggling the gate via impulse). So it is possible, to toggle the switch again (after one second) … without effect to the gate (it is still in opening process) but unfortunately with effect to the boolean. So you have a wrong boolean in the end of the opening process.
I need a kind of delay for re-toggle the switch until the opening process is finished. Is there anybody who haves an idea to solve this?

I had same problem with my car and garage door I created a input_boolean what when turn on it ( when garage door open ) would turn off after 8min that’s with a automation and a delay in it (can’t paste code on my phone ) then in the condition in the main automation that check that input_boolean is off hope make cents

Eg. If I drive home and park out side and go inside them I go out to the car and via the side door or close the garage door and then start the car the garage door does not open as long as I do with the 8min window ie given me time to lock the kids into there sets lol

Thank you, @myle. It was quite easy to setup such an input_boolean. The opening script starts now with the condition check (boolean must be off), than execute the operation and set the boolean to on. Waits 30 sec and set the boolean off again.

all good bro

my bill is can you post you code (right format)

Of course, here we go …

sequence:
  - condition: state
    entity_id: input_boolean.tastensperre_torsteuerung
    state: 'off'
  - service: switch.turn_on
    target:
      entity_id:
        - switch.sonoff_1001299513
  - service: input_boolean.turn_on
    target:
      entity_id: input_boolean.tastensperre_torsteuerung
  - delay:
      hours: 0
      minutes: 0
      seconds: 20
      milliseconds: 0
  - service: input_boolean.turn_off
    target:
      entity_id: input_boolean.tastensperre_torsteuerung
mode: single
icon: mdi:gate