I am malformed, please a little advice

I an trying to write a script but I am new to HA, I have given it my best shot but computer says no. How do I get the script god to accept my YAML? Do I have to sacrifice my children?

Message malformed: extra keys not allowed @ data[‘pump_timer_script’]


pump_timer_script:
  alias: Pump and Solenoid Sequence
  sequence: [
    - service: switch.turn_on
      entity_id:
        - switch.a16_pump1
        - switch.switch.a16_sol1
    - delay:
        seconds: "{{ states('input_number.spray_time') | int }}"
    - service: switch.turn_off
      entity_id: switch.a16_sol1
    - service: switch.turn_on
      entity_id: switch.a16_sol2
    - delay:
        seconds: "{{ states('input_number.spray_time') | int }}"
    - service: switch.turn_off
      entity_id: switch.a16_sol2
    - service: switch.turn_on
      entity_id: switch.a16_sol3
    - delay:
        seconds: "{{ states('input_number.spray_time') | int }}"
    - service: switch.turn_off
      entity_id: switch.a16_sol3
    - service: switch.turn_on
      entity_id: switch.a16_sol4
    - delay:
        seconds: "{{ states('input_number.spray_time') | int }}"
    - service: switch.turn_off
      entity_id: switch.a16_sol4
    - service: switch.turn_on
      entity_id: switch.a16_sol5
    - delay:
        seconds: "{{ states('input_number.spray_time') | int }}"
    - service: switch.turn_off
      entity_id: switch.a16_sol5
    - service: switch.turn_on
      entity_id: switch.a16_sol6
    - delay:
        seconds: "{{ states('input_number.spray_time') | int }}"
    - service: switch.turn_off
      entity_id: switch.a16_sol6
    - service: switch.turn_on
      entity_id: switch.a16_sol7
    - delay:
        seconds: "{{ states('input_number.spray_time') | int }}"
    - service: switch.turn_off
      entity_id: switch.a16_sol7
    - service: switch.turn_on
      entity_id: switch.a16_sol8
    - delay:
        seconds: "{{ states('input_number.spray_time') | int }}"
    - service: switch.turn_off
      entity_id:
        - switch.a16_pump1
        - switch.a16_sol8
    - delay:
        minutes: "{{ states('input_number.wait_time') | int }}"
    - service: script.turn_on
      target:
        entity_id: script.pump_timer_script 
        ]


Remove the square brackets [ ] from your sequence.

pump_timer_script:
  alias: Pump and Solenoid Sequence
  sequence:
    - service: switch.turn_on
      entity_id:
        - switch.a16_pump1
        - switch.switch.a16_sol1
    - delay:
        seconds: "{{ states('input_number.spray_time') | int }}"
    - service: switch.turn_off
      entity_id: switch.a16_sol1
    - service: switch.turn_on
      entity_id: switch.a16_sol2
    - delay:
        seconds: "{{ states('input_number.spray_time') | int }}"
    - service: switch.turn_off
      entity_id: switch.a16_sol2
    - service: switch.turn_on
      entity_id: switch.a16_sol3
    - delay:
        seconds: "{{ states('input_number.spray_time') | int }}"
    - service: switch.turn_off
      entity_id: switch.a16_sol3
    - service: switch.turn_on
      entity_id: switch.a16_sol4
    - delay:
        seconds: "{{ states('input_number.spray_time') | int }}"
    - service: switch.turn_off
      entity_id: switch.a16_sol4
    - service: switch.turn_on
      entity_id: switch.a16_sol5
    - delay:
        seconds: "{{ states('input_number.spray_time') | int }}"
    - service: switch.turn_off
      entity_id: switch.a16_sol5
    - service: switch.turn_on
      entity_id: switch.a16_sol6
    - delay:
        seconds: "{{ states('input_number.spray_time') | int }}"
    - service: switch.turn_off
      entity_id: switch.a16_sol6
    - service: switch.turn_on
      entity_id: switch.a16_sol7
    - delay:
        seconds: "{{ states('input_number.spray_time') | int }}"
    - service: switch.turn_off
      entity_id: switch.a16_sol7
    - service: switch.turn_on
      entity_id: switch.a16_sol8
    - delay:
        seconds: "{{ states('input_number.spray_time') | int }}"
    - service: switch.turn_off
      entity_id:
        - switch.a16_pump1
        - switch.a16_sol8
    - delay:
        minutes: "{{ states('input_number.wait_time') | int }}"
    - service: script.turn_on
      target:
        entity_id: script.pump_timer_script 

Hi Tom,

thank you, but I did that and got this instead:
Message malformed: extra keys not allowed @ data[‘pump_timer_script’]

Where are you putting this script?

In Settings > Automation and Scenes > Scripts > Add Script > Create New Script > then the three dots and ‘Edit in YAML’ and pasting it in

If that’s where you’re pasting it, remove the first line. Upon saving it, you will be prompted to supply a name for the script (or to rename it, given that you have already supplied it with an alias).

Thank you Taras, that is the solution!