Can I set the state of a template sensor from ESP Home switch?

I have tried many methods and searched and cannot find a way to set the state of a template sensor that I have set up. I have a garage door switch in ESP Home(below), that I would like to trigger setting the state of my template sensor temporarily(30 seconds) to ‘on’. Any suggestions on how I should approach this?

ESP Home switch code.

switch:
  - platform: gpio
    pin: GPIO12
    id: relay
  - platform: template
    icon: "mdi:arrow-up-down-bold-outline"
    name: "Welle Garage Switch"
    turn_on_action:
    - switch.turn_on: relay
    - delay: 500ms
    - switch.turn_off: relay

Configuration template sensor

template:
  - sensor:
      - name: Garage Switch Status
        state: 'off'
template:
  - binary_sensor:
      - name: Garage Switch Status
        state: "{{ is_state('switch.welle_garage_switch', 'on' }}"
        delay_off: 30

Thank you Tom. But for some strange reason, this does not work on the switch I have in ESPHome, it does however work with 2 other light switches I have set up. The only different is, the one that is NOT working, is set up in ESPHome and it also has a delay and then shuts off. The 2 commented out lines work fine. I put this template binary sensor in my configuration, do I need to have this in my ESPHome logic for the switch?

template:
  - binary_sensor:
      - name: Garage Switch Status
#        state: "{{ is_state('switch.porch_garage_lights', 'on') }}"
        state: "{{ is_state('switch.welle_garage_switch', 'on') }}"
#        state: "{{ is_state('switch.sonoff_1000d33509', 'on') }}"
        delay_off:
          seconds: 30

I was able to get this working inside of ESPHome by creating a binary sensor off of the GPIO12 pin that I was using as the relay. This sensor will be ‘on’ for 20 seconds after the relay is activated.

  - platform: gpio
    pin: GPIO12
    name: "Garage Relay Button"
    filters:
      - delayed_off: 20seconds