Turn off lights, but delay every time motion is triggered

I can’t get my head around this…

I have a fibaro switch for the lights and also a Hue motion sensor.
I can easily turn on the fibaro/lights when motion is triggered on the motion sensor.
After 10 minutes I want them to turn off. Easy with a delay in the same flow.

But here comes the tricky part:
If I’m still in the room I want to reset the 10 minute delay / adding time so it always turns off 10 mins after the last movement registered.
If I trigger at 12:00 it will turn off at 12:10.
But if I’m in the room 12:05 it will still turn off at 12:10 and the second delay happening 12:15 is obsolete.
Result: Lights turns off while I’m in the room and I start jumping around to trigger the sensor…

I’ve tried to a global variable, but it always get overruled by the first run.

Any good ideas? The best would be if you could set a global timer and just add time to it, but I don’t see this option.

Someone made a post exactly about this “problem” years ago, and is still relevant:

I guess you have searched the forum before posting this question, so i’m not going to mention it.

Or just use “Zone activity” without any extra apps?

IF zone is active
THEN turn on light

IF zone is inactive for 10 minutes
THEN turn off light

Brilliant, using the Zone Activity works really nice.
I wasn’t aware about this nice feature :slight_smile:

Light turns on and if I’m still in the room the turn on period will be extended with no interruption.

I was unsure what the definition is, but it seems only to be related to the motions sensors. Testing by starting the ventilation (Fibaro based) in the same zone does not impact the “activity”.
I did try to sneak in a hand, hitting the Fibaro light switch without triggering the motion sensor - the lights will stay on as there was no motion (I don’t need that and it will never happen, just testing)

Hi there,

I do think i’ve made this feature for my toilet downstairs with using the zones,
Maybe this will give you additional info

If toilet is occupied THEN turn on light

if no movement dim light to 5%

if zone is then not active for 1minute turn off light

Zone activity is triggered by both motion sensors and door sensors.