Motion stayed inactive for at least 2 minutes

Hi,

I haven't used rule machine for some time and now I need to set an urgent rule. The condition will be based on motion sensorstayed inactive for at least 2 minutes.
How can I do this ?

I believe you can now do this within the trigger, either way, a wait or delay should do the trick. Let me take a look.

Yes, that was it:

Setup your trigger like this:

To achieve a rule something like this:

If you were in fact quite specific when you said condition, I expect you may want to use a simple wait:

inside a rule like this:

But I believe the purpose of the "sticky" trigger I believe it is known as, was to reduce the time to setup the last rule or at least the inactive part.

2 Likes

thanks. But I'm not sure if any of these 2 methods will really help me achieve what I'm trying to do.

I am actually trying to set a "condition" (not a trigger) which will make sure the sensor did not get any active signal for the last 2 minutes.
So it could have changed state to inactive either 2 minutes ago or a lot more than that.
For example, the sensor might have changed to "inactive" 5 hours ago. So a "wait" would not help me in that scenario. Because we don't know when it was changed to inactive.

Am I wrong ?

How else can I achieve this ?

Are you trying to look back in time 2 minutes? You could use a variable to track when the sensor goes inactive then use that to compare to the current time. Otherwise, Wait for Expression can be used to determine if the state stays inactive for the next 2 minutes even if it went inactive 5 hours ago.

actually I am trying to achieve this:

> if "Entrance Door contact changes to open"
>   then
>      if Entrance Multisensor's "motion was inactive for at least 2 minutes"
>       then
>         A
>      else
>         B
>     end if;
> end if;

I believe you can do this with two rules and a boolean hub variable (BolVar)

Rule 1

Trigger Events
Entrance contact opened

Actions to Run
IF (BolVar is true) THEN
A
ELSE
B
END-IF

Rule 2

Trigger Events
Entrance Multisensor active

Actions to Run
Set BolVar false
Wait for event: Entrance Multisensor inactive --> duration: 0:02:00
Set BolVar true
1 Like

Or a single rule. When you go to add an IF condition, there's an option for "time since event" that will do this.

3 Likes

thanks. that's what I was looking for.
And I didn't see the direct condition type "time since event" because I was expecting to have it as an option in the condition type "motion inactive" :slight_smile:

2 Likes

Actually, does this take into account motion becoming active again? Perhaps you would want a Required Expression as well to make sure motion is not currently active?

That depends on what the OP wants. Like for like with the way their rule is written, it does the trick.

True. But would that be your understanding at least, that if motion became active, the time since would simply go back to the last time it became inactive, and you would need to handle active motion in addition to that "time since" condition? If only for my own understanding.... :slight_smile:

The requirement was just to check if it had been at least two minutes since motion went inactive. If it went active before the evaluation, then the condition evaluates false and we move on. I would presume the use case is to figure out if someone just walked out a door versus walking in when the door was opened.

1 Like

Actually I set my condition like this:

I want to make sure that there was no motion in the last 2 minutes.
I guess these 2 conditions combined with an AND would do the trick. ?

1 Like

Ah...the light bulb just went off. I see what you mean @sburke781. The OPs new setup would handle that.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.