I need help with a presence sensor

I'm try to have my motion sensor wait 2 minutes before turning on a light. If after the 2 minutes no movement is sensed the light stays off. If there's motion after the 2 minutes the light turns on

What app are you using to do this on Hubitat? Pretty much all of them that you might use for this purpose have some option that will do what you want (Room Lighting, Motion Lighting, Basic Rule, Simple Automation Rules, etc.). If you already have something set up, sharing that here will get you the best help. If you don't, I think Basic Rule is an easy place to start:

When TEST Motion 1 activates ...
Turn on TEST Switch 1
Wait until TEST Motion 1 motion stops and stays inactive for 2 minutes, then ...
Turn off TEST Switch 1

EDIT: I think I misread your post, assuming you did mean "stays off" and not "turns off." You'll need something else for that, like the custom Rule 5.1 rule below -- though this is a bit of an unusual automation, so describing what you're actually doing might help others come up with alternative approaches that might work better for you.

Would this meet your needs? In Rule Machine:

Trigger: Motion Active: Duration 2 minutes
Action: Light:on

Will it eventually need to be turned off?

1 Like

Is this another way to describe your request?

If motion sensor “sees” a continuous period of more than two minutes of continuous movement, then turn on the light.
Otherwise ignore it until next movement restarts a new period.

Is so, then @Sebastien has your answer up above.

1 Like

I must have this wrong. The light turns on after 2 minutes
I want to be able to walk through the room without the lights coming on. But if I stay in the room it comes on and stays on untill I leave the room not stay off.

Maybe this?

Trigger - motion active

Actions:
Delay 2:00
If motion active, turn on lights

The Delay should prevent retriggering within the 2 minutes.

Things to consider...
How long is the cooldown period on the motion sensor?
What if you happen to be standing/sitting still when the 2 minutes end?

IMHO, a switch or well-placed remote for the lights is a much better idea here, but up to you.

2 Likes

It's a meross present sensor. So sitting still is not a problem.

Only way I could see that happening is if the sensor remained “in motion “ for the rest of the whole two minutes after you got out of its sight.

See if you can reduce its reset (cooldown) time.

1 Like

I set the absence confirmation time down to 20 seconds. On the normal routine when I enter the room light go on, leaving now go off after about 24 seconds.
The new routine when I enter the light stays off and leave before the 2 minutes. After the 2 minute wait in rule light still comes on.

Change the logging to all triggers, events, and actions.
Enable logging on sensor and light.

Then post image of logs so we can really see what is happening.

(By the way, the rule should NOT be triggered if you leave in less than 100 seconds. [2 minutes less 20 second cooldown.]
Set the trigger to 140 seconds if “2 minutes” is important.)

Those log entries are coming from the device.

And they’re probably not actually relevant to your question about how to configure your rule. Even though there is an error.

Post the logs for the rule you have created.

1 Like

I think I have it. Seems to be working

It's probably not doing anything bad, but since it's not being used, remove that ELSE.

I believe I've tried it without the else and the light came back on

That's a coincidence. There's no action associated with that ELSE, so it's not doing anything or otherwise somehow influencing anything.

1 Like

I suggest that you go back to @Sebastien version and show us all the logs from one trip through the room.

Maybe then we can provide some insight.

1 Like

As @hydro311 mentioned, the "ELSE" isn't causing the light to come back on (or do anything at all since there are no actions in it). However, I see an un-cancelled "Delay," which means it will still be there when (and after) the rule re-triggers, so that's probably what's doing it -- but I wouldn't really troubleshoot this version of your rule much more.

I agree that your original rule was best and would second the suggestion to return to that, re-enable all logging for the rule if you turned it off, and then share those logs here to see what might be going on.

I didn't read the thread completely so I apologize if someone else spoke about this - I find that two sensors works better for me - with Zone Motion app. I mention this idea as all my motion sensors seem to have different periods - once activated. so if one is active - and motion occurs again during that window you won't get a second activation. with two sensors, it's much easier to validate room occupancy.
with a 2 min activation window (mine is actually 30 seconds) I'm able to achieve my desires

This is the routine I'm using and it seems to work.