Can I have two services in Turn_on of Template light?

Hi,
I am trying to do 2 things in the Turn_on and Turn_off of a template light

  1. set a parameter (an input_text helper)
  2. call a script.
    The configuratin.yaml entry is
      entry_light:
        friendly_name: "Entry Light"
        unique_id: "entry_light_template"
        turn_on:
          service: input_text.set_value
          data:
            value: link007_entry
          target:
            entity_id: input_text.scene_to_use
          service: script.light_on_with_upb_sync
        turn_off:
          service: input_text.set_value
          data:
            value: link007_entry
          target:
            entity_id: input_text.scene_to_use
          service: script.light_off_with_upb_sync

The 1st thing I notice is in the log
WARNING (SyncWorker_3) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "service". Check lines 58 and 63
and secondly
ERROR (MainThread) ....... Z-Build UPB to light 3: If at step 2: Error executing script. Service not found for choose at pos 2: Unable to find service script.light_off_with_upb_sync
The script does exist and functions if triggered manually.

I am sure the errors are tangled upon each other
How can I do the two things I need at ‘turn_on’ and ‘Turn_off’? Or am I barking totally up the wrong tree.

Thanks for any advice
JC

You just need to delineate the list items by using hyphens:

      entry_light:
        friendly_name: "Entry Light"
        unique_id: "entry_light_template"
        turn_on:
          - service: input_text.set_value
            data:
              value: link007_entry
            target:
              entity_id: input_text.scene_to_use
          - service: script.light_on_with_upb_sync
        turn_off:
          - service: input_text.set_value
            data:
              value: link007_entry
            target:
              entity_id: input_text.scene_to_use
          - service: script.light_off_with_upb_sync

Drew,
Thanks that made it behave better.
But how did you know these were needed? I get confused when someimes things are and sometimes not. For example in the following snippet ‘conditions’ and 'condition; do need a dash but ‘sequence’ does not.

      - conditions:
        - condition: template
          value_template: '{{ trigger.event.data.command == ''deactivated'' }}'
        - condition: state
          entity_id: light.entry_light
          state: 'on'
        sequence:
        - service: light.turn_off
          data: {}
          target:
            entity_id: light.entry_light

Sorry for such beginners question.
JC

By understanding the difference between lists and dictionaries… YAML for Non-Programmers (make sure to read at least through the section “On Indentation”)

You little ripper! at last an explanation. Especially knowing there is a contracted form of list item which goes to explain some of my confusion.
I cannot thank you enough
JC