Esphome and momentary switch that have to run only once

Hi all,
i ask your help.
I have a momentary switch and a button for call it

binary_sensor:
 #Pulsante 
  - platform: gpio
    name: "${device} IN2"
    id: "IN2"
    pin:
      number: GPIO39
      inverted: True
    internal: True
    on_press:
      - switch.turn_on: PortaBlindata

switch:
  #Tiro
  - platform: gpio
    name: "${device} OU6"
    id: "OU6"
    pin: GPIO14
    internal: True
  #Momentary Switch per Tiro porta blindata
  - platform: template
    id: "PortaBlindata"
    name: "PortaBlindata"
    internal: True
    turn_on_action:
    - switch.turn_on: OU6
    - delay: 1500ms
    - switch.turn_off: OU6

how can I make sure that there are no 2 overlapping activations of the switch.turn_on: PortaBlindata call?

I wish it was not possible to activate the momentary switch twice until it has finished all its execution

Have a read up on debouncing:

I have also made good use of things like on_press: and on_click: to fine tune what a button press does.

[quote=“blademckain, post:1, topic:284974”]

binary_sensor:
 #Pulsante 
  - platform: gpio
    name: "${device} IN2"
    id: "IN2"
    pin:
      number: GPIO39
      inverted: True
    internal: True
    on_press:
      - switch.turn_on: PortaBlindata

switch:
  #Tiro
  - platform: gpio
    name: "${device} OU6"
    id: "OU6"
    pin: GPIO14
    internal: True
    on_turn_on:  
      - delay: 1500ms
      - switch.turn_off: OU6