Help with config file "automation"

I can’t my automation script to work. If I only have one section “alias” without the “-” it works ok, but as soon as I add a second automation, I believe I have to include the “-”, but then HASS will not restart. I think it might be an indentation issue, but I’ve tried many combinations with no success, please see code below, the “automation” text has no indentation. Thanks for your help.

automation:
  - alias: Turn on red light when movement detected
    trigger:
      platform: state
      entity_id: sensor.aeotec_zw100_multisensor_6_burglar_4_10
      from: '0'
      to: '8'
    condition:
      condition: time
      after: '23:00:00'
      before: '07:00:00'
    action:
      service: light.turn_on
      entity_id: light.aeotec_zw098_led_bulb_level_2_0
      data:
        brightness: 100
        rgb_color: [255,10,0]
  - alias: Turn on lights at sunset
    trigger:
      platform: sun
      event: sunset
      offset: "-01:00:00"
      - action:
          service: light.turn_on
          entity_id: light.aeotec_zw098_led_bulb_level_2_0
          data:
            brightness: 255
            rgb_color: [255,255,255]
#      - action:
#          service: switch.turn_on
#          entity_id: switch.switch.aeotec_zw096_smart_switch_6_switch_3_0

Check home_assistant.log - it should give you the line that your error is on.

But that last action that’s got a -, that’s probably the issue. Each automation has a single automation. It should be a sibling of trigger.

Thank you. That worked. So how can I perform two actions based on one trigger? i.e. the part that I have commented out.

I assumed I could nest multiple actions using the minus “-”?

This is the code I have now which seems to be working

  - alias: Turn on lights at sunset
    trigger:
      platform: sun
      event: sunset
      offset: "-01:00:00"
    action:
      service: light.turn_on
      entity_id: light.aeotec_zw098_led_bulb_level_2_0
      data:
        brightness: 255
        rgb_color: [255,255,255]
#      - action:
#          service: switch.turn_on
#          entity_id: switch.switch.aeotec_zw096_smart_switch_6_switch_3_0

@patfelst

The “-” indicates a list. In your code you have two services to run as an action. So both services should be within the list.
Use this:

 - alias: Turn on lights at sunset
    trigger:
      platform: sun
      event: sunset
      offset: "-01:00:00"
    action:
      - service: light.turn_on
        entity_id: light.aeotec_zw098_led_bulb_level_2_0
        data:
          brightness: 255
          rgb_color: [255,255,255]
      - service: switch.turn_on
        entity_id: switch.switch.aeotec_zw096_smart_switch_6_switch_3_0

Thanks again, that also solved the problem, once I removed the typo of two “switch” in “entity_id: switch.switch.aeotec_… etc”