Automation turn on light at presence detection

Hi I would like to set a trigger that automate turn on lights at presence detection for a time of 3 minutes. The times to go into the home.
I’m a newbie and I’m not finding any example to accomplish the duty. Any code help is much appreciated

Is it possible to configure such a away?

automation:
  trigger:
    platform: sun
    event: sunset
   - alias: 'Arriving Home '
  trigger:
    platform: state
    entity_id: device_tracker.iphonexr
    from: 'not_home'
    to: 'home'
  action:
   - service: light.turn_on
     entity_id: light.garage_outdoor_light_8
   - delay: '00:10:00'
   - service: light.turn_off
     entity_id: light.garage_outdoor_light_8