Templated GPIO output

Tags: #<Tag:0x00007f73b95c17f8> #<Tag:0x00007f73b95c1730>

Hi:
in a simple auto switch off relay output how could I make it only once run the switch-on?
I mean: in this example I have a switch on HA dashboard, when I select the slider it turn on and after 500 ms turn off automatically. BUT if I switch on and off twice in 0,5 sec it STAY on until I made another click… Thanks in advance.

  - platform: gpio
    pin: GPIO22
    id: outRELAY
  - platform: template
    name: "Open X"
    icon: "mdi:gate"
    turn_on_action:
    - switch.turn_on: outRELAY
    - delay: 500ms
    - switch.turn_off: outRELAY

some sort of automation. https://esphome.io/guides/automations.html

the problem was the absence of turn_off_action

    turn_on_action:
       - switch.turn_on: outRELAY
       - delay: 500ms
       - switch.turn_off: outRELAY
    turn_off_action:
       - switch.turn_off: outRELAY

this way I can finally press as many times I can :slight_smile: