Control lights on x minutes after motion

So I know how to make a rule and turn on the lights when motion is detected then delay turn that off after 3 minutes.

Is that the best way to turn off lights after x amount of minutes? I was thinking there was a way to detect the last time motion was detected vs this firing everytime motion is detected.

I do that with an Zone Motion Controller built in App that is in Hubitat. It will do what you need.