Hey Sharek326 I have a countdown timer (timers and pesters) that starts 45 seconds after motion is no longer detected by the motion sensor. If motion is detected at any time while the countdown timer is counting down, it resets the countdown timer and starts the countdown process over. Once the timer zeros out it fires off a trigger to turn off the lights.
Once the countdown timer reaches 20 seconds I have the lights dim down some, so we know the lights will be turning off if we do not trip the motion sensor. Saves us from having lights turn off if we are still in the room.
I have this in my MBR so I also have to set the condition for the lights not to turn on from motion detection if the house is put into sleep mode. When I first set this up, I got up in the middle of the night and had the MBR lights come on.