Sunset automation

I have been using HA for around for weeks now and I have done some basic automations and scripts which I have linked to Alexa with the Home Assistant skill, along with a subscription to Nabu Casa. These all seem to work fine and I am beginning to get a good basic understanding of YAML but I am far from there yet. One thing I am struggling with is a sunset automation which runs in HA. The idea is that at sunset, the landing, hallway and kitchen lights turn on 30 minutes before sunset. These areas are quite dark, so hence the offset. I want then for the porch lights to turn on at sunset, no offset, but this is not happening as they turn on at the same time as the other lights. I am guessing it is a sequencing issue but I just cannot see it. Rightly or wrongly I have used CoPilot to help. I find this is good way for me to visualise and to begin to understand the coding structure, but using AI has it’s limitations. The code below is what I have and was hoping someone could see where I am going wrong. I suspect it is a sequencing issue but I could be miles off track, so any help is appreciated.

alias: Sunset Automation
description: Porch lights turn on at sunset, other lights at different offsets.
triggers:
  - event: sunset
    offset: "-00:30:00"
    trigger: sun
  - event: sunset
    offset: "00:00:00"
    trigger: sun
actions:
  - target:
      entity_id: light.kitchen_cupboards
    data:
      brightness_pct: 100
    action: light.turn_on
  - target:
      entity_id: light.kitchen_plinth_lights
    data:
      brightness_pct: 60
    action: light.turn_on
  - target:
      area_id:
        - hallway
        - landing
    data:
      brightness_pct: 50
    action: light.turn_on
  - target:
      area_id: front_door
    data:
      brightness_pct: 40
    action: light.turn_on
mode: restart

Your first trigger at -30 will set it off all the actions. The second trigger will never cause actions to run unless you turn off that automation just before sunset -30 and turn if on just after -30 then it will turn on both set of lights.
You need 2 automations. You could put a delay 30mins after first action and have just one automation but that has it’s own risks.

Remove these two bits and put them in a separate automation.

Thanks for the quick reply. I’ll give it a go

Would this work?

alias: Porch Lights at Sunset
description: Turns on porch lights at a customizable offset from sunset.
triggers:
  - event: sunset
    offset: "00:00:00"
    trigger: sun
actions:
  - target:
      area_id: front_door
    data:
      brightness_pct: 40
    action: light.turn_on
mode: restart

Yes.

Great. I have also removed the lines as suggested from the other code. Thanks again