IR switched light with additional timer

Hi, i’ve added an Sonoff IR sensor to switch on/off the light on my outside area. The Sonoff sensor sends an motion detect immediately when it detects, but has an hysteresis of one minite after that. If the person doe not move a lot, the light switches off after that.
How can i add an additional time of say 5 minutes, the lights stays on, even if no motion is detected? I’ve made it using automation task.