Error in creating a new switch template

Good morning,
I experience some difficulties in creating a switch that would switch on/off (pulse) another switch.
Basicaly I use the switch template and tried to trigger a sequence (from a script) to turn on and off sw4 and generate a pulse.
the state of the sliding door (open or closed) is taken from two sensors and reflected in the icon

The error at parsing configuration.yaml are the following:

Invalid config for ‘template’ from integration ‘switch’ at configuration.yaml, line 20: Unable to determine action ‘switches->portail->turn_on->0’, got None
Invalid config for ‘template’ from integration ‘switch’ at configuration.yaml, line 37: Unable to determine action ‘switches->portail->turn_off->0’, got None

Thanks for any help
Wish you a good day

YALM

"
switch:
  - platform: template
    switches:
      portail:
        value_template: "{{ is_state('binary_sensor.ebytein2', 'on') }}" # taken from a sliding door sensor
        turn_on:  # LINE 20 !!! # generate a pulse to activate sliding door 
          sequence:
            - service: switch.turn_on 
              metadata: {}
              data: {}
              target:
                entity_id: switch.sw4
            - delay:
                hours: 0
                minutes: 0
                seconds: 2
                milliseconds: 0
            - service: switch.turn_off 
              metadata: {}
              data: {}
              target:
                entity_id: switch.sw4
        turn_off: # LINE 37 !! # generate a pulse to activate sliding door 
          sequence:
            - service: switch.turn_on
              metadata: {}
              data: {}
              target:
                entity_id: switch.sw4
            - delay:
                hours: 0
                minutes: 0
                seconds: 2
                milliseconds: 0
            - service: switch.turn_off
              metadata: {}
              data: {}
              target:
                entity_id: switch.sw4
        icon_template: >-
          {% if is_state('binary_sensor.tomillo26_door_status', 'off') %} # door closed
            mdi:door
          {% elif is_state('binary_sensor.ebytein2', 'on') %} # door open
            mdi:door-open
          {% endif %}
   "

Remove the word sequence: from turn_on: and turn_off: action sections, that makes the section invalid. Also, remove the in-line comment on value_template:, turn_on:, and turn_off: fields. In-line comments in yaml will break your configuration.

Only use comments before or after fields.

Dear Petro,
Thanks a lot, it is working now!