Motion Sensor Inactivity Length

If there a way to determine the length of inactivity of a motion sensor in a rule?

IE how long it has been since its see activity ?
are you trying to see if its become unresponsive ?

yes, I want to know how long it has been since there was any activity.

I am trying to setup a rule to monitor if the garage door has been open for longer then x mins and there has been no activity in the garage for x mins.

And do what if that happens? You have to setup the rule assuming that the actions will be necessary. For example if you wanted to have a rule that would close the garage door if no motion was detected in the garage for 10 minutes, that rule would look like this.

Trigger: Garage Motion Changes & Garage Door Changed

If Garage door open and motion inactive.
      Delay for 10 minutes subject to cancel
      Cancel delayed action

Try something like that. You create the delay period you want to have and then cancel that delay if something else happens.

1 Like

I will give it a try, thanks for laying it out. I basically want to just message myself.

I do have a question about the Garage Door Changed, is that just being used to trigger the event? I noticed that the 1st think in the action is to determine the state (open).

Thanks for the help again.

Yes, Rule Machine 4.0 is based on Events triggering the rules to be evaluated. The conditional actions within the rule are what is then evaluated. So, you would want to trigger the rule both on the door opening and the door closing and motion going inactive OR active (I fixed that). That way the delay gets canceled if motion goes active again during the 10 minutes.

And you can just substitute in sending the message. But why wouldn't you just close it. :slight_smile:

This might be a stupid question, but I can't seem to get a & it keeps doing OR. What is the secret?

For triggers? It is always OR for a trigger. You can't have two events happening at exactly the same moment. Triggers have to use OR statements.

Ah... makes sense. Thanks

Also wanted to thank you for a lot of post that I have read from you that solved other "issues" I have had being a newbie to HE, appreciate the effort you put into the board.

1 Like

Thank you for saying that. It means a lot.

1 Like

Assuming you got this working the way you wanted, is there any chance you can post a screenshot of your RULE setup? I'm trying to do something similar, but RULE MACHINE has been updated since this post and I'm having some trouble navigating it.

I want to do what @Ryan780 suggested: Auto close garage door after x minutes of being opened and no motion.

I will give it a look tonight Jill.

This rule is doing what I need it to. Don't know if it is the "right" way but.... it works.

You never said you also wanted to do a repeat. I don't think this is actually working the way you want it to in the long run. For starters, if the motion sensor goes inactive, you won't ever get to the notification. You have an ELSE statement for the motion being active so that action is going to happen every time the sensor is inactive. I think you want to restructure this so that you have one if then statement combining your two conditions with an OR instead of having two if's.

I see your point, I thought I had tested it and it worked correctly, I will give it another look. Thanks

Like i said, try to use an If-then/Else-then structure instead of an If ./then If/then. I think you'll be more successful.

Hi Ryan780

Thanks for giving it a look, I didn't see it last night but figured out why I did what I did today. Tested it and it is working the way I wanted. I will give some "pseudo code" below that explains my choices.

if the door closes
	cancel delayed and repeating actions and exit
	(door is closed, no more timer delay is needed, door isn't open any more)
end if

if the motion sensor is active
	cancel delayed action (will be reset when it falls through)
	stop the repeating action (if it was sending alerts already stop it)
	(this will then fall to the delay to restart the timer)
	exit here is because there is no motion so if a delay
	has already started do not restart it, let it continue
end if

hope this make sense and helps others who find this thread.

Still doesn't make any sense to me. And I still think it's not going to work the way you want. But if you think it is then go with it.

@scott1 - Thanks for posting your screenshot. I've rebuilt it exactly the way you have it for now on my 1st garage door. Once I confirm that it's working as expected - I'll start to play with it.

@Ryan780 - Thanks for the continued support on this. This is my first rule with an IF-THEN. Clearly you have a deep understanding of these. If you have a screenshot, or have the time to spell out what you are suggesting; I'm happy to build a 2nd rule on my 2nd garage door to see which one behaves correctly and then give feedback here.

You want to be notified if there is no motion and the garage door is open for 30 minutes, correct? That's an easy one.


IF (garage door Open AND Motion Inactive THEN
      Delay Actions for 30 Mins (cancelable)
      Repeat actions every 30 mins (stoppable)
           Notify scott's cell......
     Cancel Delayed actions
     End Repeat actions

That's all you need. The else will catch all situations except for the door open and motion inactive.