Rule machine newbie

Hello everyone.
Just moved over from SmartThings to He. Just love the reliability of habitat compared to smart things I've already transferred over 57 of my devices still have to do about 20 more.

I need some help creating a rule in Rule machine for my exhaust fan in my bathroom.

I want the fan to start after two minutes of motion being detected.

And I want fan to stop 10 min after motion has stopped

if anyone could help me out with this I would really appreciate it

Welcome to our community!

The rule you want looks like this:

Trigger Event:  motion active
Actions:
   Turn on fan, delayed 0:02:00
   Wait for Conditions: motion inactive duration 10:00
   Turn off fan

If motion goes active during the ten minutes, the wait is cancelled, and the rule runs again, starting the wait for inactive over, waiting for it to be inactive for 10 minutes. Eventually, the 10 minutes is over, and the fan turns off.

4 Likes

Yes! I finally got it to work. Thank you for pointing me in the right direction..

Bruce, question -

In your example if motion became inactive after a minute, I believe that the ‘delayed on’ doesn’t get cancelled and would still turn of the fan … no?

I would have thought a (cancelable) was necessary and a Cancel delayed actions after the wait.

Yes, but he said he didn't want the fan to turn off for "10 minutes after motion has stopped." He didn't say anything about not turning the fan on in the case you describe.

1 Like

Lol. Ok got it. I just read

I want the fan to start after “two minutes of motion” being detected.

differently than you did.

Now that I think about it it actually makes a lot of sense how would I be able to add a cancel event to my rule?

It depends on exactly what how you want this to work. One thing to bear in mind is how motion sensors work. They detect motion and give an event to that effect. If motion stops for an interval of 15 to 30 seconds, depending on the device model, they will send an inactive event. The person triggering the motion may still be in the room where the sensor is, and will retriever motion active, but after this intervening inactive event. For this reason, most motion activated automations require a certain period of no motion at all before turning things off, like 1 to 5 minutes.

So in your case, with a delayed on, what is to happen during those two minutes? How is one to interpret a motion inactive event? If you say that you want continuous motion active for two minutes, that may very well never happen, or only happen some of the time.

Think about what is actually going on in the room. There are different possibilities.

  • Some one comes into the room and immediately leaves, not to return.
  • Some one comes into the room and stands or sits still for 20 seconds, but continues to use the room and move around some.
  • Some one comes into the room and continuously moves around.

I think you'll find the first two the most common, and the second the case you're trying to solve for. Obtaining a solution that handles both of the first two cases is tricky. So perhaps you should decide which is the case you care the most about and solve for that.

2 Likes

I see what you mean.

I definitely would like to incorporate the second option into my rule.

Someone comes into the room and stands or sits still for 20 seconds, "but continues to use the room and move around some". I believe it would execute as expected 80 % of the time. How would I accomplish this? Thanks again.

Unless you are determined to use Rule Machine, I suggest you use the built-in Motion Lighting app. It handles everything you seem to want, and more, and is much simpler to set up for a newcomer.

1 Like

The rule I posted above does this. It doesn't try to do anything special about the 2 minutes between when someone first enters the room, and the fan turns on. Worst case is that someone goes into the room and immediately leaves. The fan would still turn on and then off after 10 minutes.

Yes Rule machine is very involved. I agree with you I will keep using motion lightning. App and keep tinkering with Rule Machine in the side.

Yes it does thank you for your help.

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