Relay off and off after 30 Seconds ESPHOME

I have a device with 4 relays and it’s using esphome to save the firmware on this board, the 3 buttons work perfectly, but the 4 I need it to turn off and back on after 30 seconds.
The code for this button in the yaml file is:

platform: gpio
name: "009 Router"
pin: 21
inverted: false
restore_mode: RESTORE_DEFAULT_OFF

Tks.

Assuming this is a switch (you did not include enough information in your pasted config snippet)

switch:
  - platform: gpio
    name: "009 Router"
    id: router_009
    pin: 21
    inverted: false
    restore_mode: RESTORE_DEFAULT_OFF
    on_turn_off:
      - delay: 30s
      - switch.turn_on: router_009
1 Like