Turn on, for a short duration, then turn off code

as @arretx said:

- id: '1708744525201'
  alias: New Front Porch Light on Door opening After sunset 2-23-24
  description: ''
  trigger:
  - platform: state
    entity_id:
    - binary_sensor.lumi_lumi_sensor_magnet_aq2_87da0008_on_off
    from: 'off'
    to: 'on'
  condition:
  - condition: state
    entity_id: sun.sun
    state: below_horizon
  action:
  - service: switch.turn_on
    metadata: {}
    data: {}
    target:
      device_id: e0f4c7d64634bd117c387dd8fcba3ad8
  delay:
    hours: 0
    minutes: 4
    seconds: 0
    milliseconds: 0
  action:
  - type: turn_off
    device_id: da1decfe8b469feb3e5e0ec596c8cdc6
    entity_id: adcf612f106de094ea6dc8d6182efef7
    domain: light
  mode: single

you should also avoid using device_id… explained here.