Zone Automation Configuration

I’m looking to turn the front porch lights on when I come home using OwnTracks and a Zone. When I enter the home zone after sunset, turn the lights on, wait 4 minutes, then turn them off.

I see the tracker as home, but never turned the lights on. Does this look correct?

- alias: Lights - Front Porch - Come Home After Sunset
  trigger:
    platform: zone
    entity_id: device_tracker.phone_capo
    zone: zone.home
    event: enter
  condition:
    condition: sun
    after: sunset
  action:
- service: light.turn_on
      data:
        brightness: 255
        entity_id:
          - light.porch
    - delay: '00:04:00'
    - service: light.turn_off
      data:
        entity_id:
          - light.porch

You could just use the state of the device tracker as the trigger

When the state changes to home,it’s entered the home zone.

@MontyRisk here is an automation that I use in my own setup.
You can see how similar it is to yours:

## Arriving HOME! Turn on entrance light
- id: presence_detect_home_entrance_light
  alias: Detect Home Entrance Light On
  trigger:
    - platform: homeassistant
      event: start
    - platform: state
      entity_id: group.presence_me
      to: "home"
    - platform: state
      entity_id: group.presence_friends
      to: "home"
  condition:
  - condition: or
    conditions:
    - condition: state
      entity_id: group.presence_me
      state: "home"
    - condition: state
      entity_id: group.presence_friends
      state: "home"
  action:
    - service: light.turn_on
      data:
        entity_id: !secret light_entrance
        # brightness_pct: 100
        # color_name: white
        brightness: 255
        kelvin: 3000

Mine looks like this:

trigger:
  platform: state
  entity_id: device_tracker.XXXX
  to: 'home'
condition:
  - condition: sun
    after: sunset
    after_offset: "-00:45:00"

a negative after_offset means up to 45min before sunset is valid too
a positive after_offset means from 45min after sunset is ok

Edit:
Actualy I combine it with “condition: or” so I can have that offset when weather is bad. Bad weather usualy means it’s dark earlier that day. When weather is good I don’t need it.

    - condition: or
      conditions:
        - condition: and
          conditions:
            - condition: or
              conditions:
                - condition: sun
                  after: sunset
                  after_offset: "-00:45:00"
                - condition: sun
                  before: sunrise   
                  before_offset: "00:45:00"
            - condition: numeric_state
              entity_id: sensor.yr_symbol
              above: '1' 
        - condition: or
          conditions:
            - condition: sun
              after: sunset
            - condition: sun
              before: sunrise

Thanks for the feedback. I tried modifying mine to be more simpler. I think there is an issue with MQTT, so I will create a new thread. Thanks for your help everyone.