Sonoff mini - garage opendoor?

Hi

I intend to use the Sonoff mini flash Tasmota as a garage to open the door. The idea to connect a closed door switch to terminals S1 and S2 so that the mini sends an MQTT message to the Home Assistant about the door status (closed - not closed). Using the Sonoff relay, I would like to control the opening and closing of the door using an analog relay connected to the door drive.
I have studied these topics:

and

and unfortunately my abilities are not enough for me to be successful in the project.
Is anyone willing to help?
Thank you.

What do I need to confuse in my code to make it work?

- id: '1624024642008'
  alias: Turn off all lights
  description: ''
  trigger:
  - platform: mqtt
    topic: "stat/tasmota_EA268D/RESULT"
  condition:
    condition: template
    value_template: "{{ trigger.payload_json['Switch1']['ACTION'] == HOLD }}"
  action:
  - service: light.turn_off
    target:
      entity_id: light.little_house_lights
  mode: single

I will add some pictures of the settings in Tasmota: