Porch lights on/off

Hi all.

Can somebody help me please? I don’t have any code to put here as I don’t know how to begin.

I want to set up an automation.

Requirement is, 4 people in a family, anyone can come at anytime, porch light should come on after sunset. So the group can be one person or more than one person coming home.

Light stays on for 5 minutes and then turns off.

I have attempted this but the light turns on for each person, so it may turn on once or upto 4 times if all 4 people comes home once.

I did get some input from Lanky but I still can’t understand.

Can someone help me? Thank you

hi, I assume your peson device trackers are configured.

Then start with the following and expand as needed:

trigger; entity; numeric state
zone.home
above
0

condition; entity; state
sun.sun
below horizon

action to turn in light
action to wait 5 min
action to turn off light