Hilfe in deutsch? ich versteh das mit yaml nicht

hey

ich hänge an einer simplen aufgabe denke ich.
es wäre so schön wenn man eine deutsche doku hätte.

ich möchte mein garagentor mit einem esp32 steuern dazu habe ich diese file

esphome:
  name: werftesp
  platform: ESP32
  board: esp-wrover-kit

wifi:
  ssid: "+"
  password: "+"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Werftesp Fallback Hotspot"
    password: "0NM852832X0M"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "+"

ota:
  password: "+"

switch:
  - platform: gpio
    internal: true
    inverted: true
    pin: 25
    id: garage_door_relay

binary_sensor:
- id: garage_door_sensor
  internal: true
  platform: gpio
  pin:
    number: 33
    mode: INPUT_PULLUP
    inverted: true
  device_class: garage_door
  filters:
    - delayed_on_off: 20ms

cover:
  - platform: template
    name: "Garage Door"
    lambda: |-
      if (id(garage_door_sensor).state) {
        return COVER_OPEN;
      } else {
        return COVER_CLOSED;
      }
    open_action:
      - switch.turn_on: garage_door_relay
      - delay: 1s
      - switch.turn_off: garage_door_relay
    close_action:
      - switch.turn_on: garage_door_relay
      - delay: 1s
      - switch.turn_off: garage_door_relay
    stop_action:
      - switch.turn_on: garage_door_relay
      - delay: 1s
      - switch.turn_off: garage_door_relay

das geht auch alles soweit, nur wollte ich eine einfache if else einbauen damit wenn das tor laut sensor geschlossen ist keine aktion ausgeführt wird bei close_action. ebenso natürlich wenn der sensor offen ist.
hintergrung ist die steuerung über alexa

gruß
rene