Template Switch state in Home Assistant

Hello Everyone, I have Shelly Uni flashed with ESPHome. It has two outputs. I have created condition, that if alarm is armed, the outputs will not turn on. These outputs just opens garage door, and I want to block operation while alarm is armed.
My code basically works, but I have one problem. State of outputs are not shown in Home Assistant. So if I click on Output 1 entity in Home Assistant, it pops up History of values, but no changes are recorded there. Here is my code:
switch:

  • platform: template
    name: “Output 1”
    id: relay_1
    device_class: “switch”
    turn_on_action:
    • if:
      condition:
      binary_sensor.is_off: blokada_otwarcia_bramy
      then:
      - output.turn_on: out_1
      - delay: 500ms
      - output.turn_off: out_1
      else:
      - logger.log: “Output 1 jest zablokowany.”
      icon: “mdi:garage-variant”
      restore_mode: restore_default_off
  • platform: template
    name: “Output 2”
    id: relay_2
    device_class: “switch”
    turn_on_action:
    • if:
      condition:
      binary_sensor.is_off: blokada_otwarcia_bramy
      then:
      - output.turn_on: out_2
      - delay: 500ms
      - output.turn_off: out_2
      else:
      - logger.log: “Output 2 jest zablokowany.”
      icon: “mdi:garage-variant”
      restore_mode: restore_default_off

This is why you should read the documentation and not just copy/paste code you find online. The “Outputs” can also be called “GPIO Switches” Im not really sure why your using template switches and I assume they are controlling some “Output Components” which are the wrong thing thing to use and if you read the documentation, it specifically tells you that you will have the exact problem that you are having and it tells you what to use instead of Output

You gotta read the documentation. It will help you tremendously.

Warning
This is an output component and will not be visible from the frontend.