Using Rule Machine for Motion Lighting

So, you might be asking: "Why not just use motion lighting?"

Well, I'm using a very similar rule for my kitchen to set color based on time. So my question is: How do I get a rule to wait until the motion sensor is inactive before it starts the timer to turn off the light, or dim, or do whatever else the rule does? I threw this together by reading a few other posts, and it still doesn't do what I expect, which is keep the lights on until no motion is detected, and then start the timer, cancelling it when motion is detected again, etc, until the lights finally just turn off when no motion has been detected in that window.

imgur com/a/pCRgdQx

1 Like

This should do it.


Motion sensor changed

If motion sensor active
Cancel delayed actions
Turn on light
Else if motion is inactive
And light is on
Turn off light after 2 min delay (cancelable)
End if


A single minute to get a reply. This is why I love this community. Gonna test and report back.

Yep. Worked 100%. First forum question answered in a flash!


I use Rule Machine for all of my Motion Lighting. It allows for some very creative things.

My bedroom is controlled by mode and won't turn off the lights if they are below 95%


Conversely in the bathroom, it won't turn them off if the lights are over 95%

And my kitchen rule has different delays depending on which lights are on. Also, since i usually turn the lights off via a pico and the first motion sensor going inactive would cause the lights to come back on, I had to add a variable,

And all will only turn the lights on if all the lights in the room are off. Hope that gives you some inspiration. :slight_smile:


I know, already solved with plenty of examples, but...


One little tip that will save you a LOT of time in the future....check out the command "Set color temperature and level by mode". Basically it shrinks down into one command what you're doing with your nested set of If/else if's. Much quicker and about 1/10th as many clicks. :slight_smile:

Also, you really should have an End-If at the end, just to be complete.


Good tip with the "per mode" option. I just implemetet it.

1 Like

How'd I do now?

1 Like


Maybe a dumb question, but here we go!

Can one copy and paste RM rules from the forum to RM somewhere?
Like one can when adding drivers and apps?

Kind regards,

Unfortunately not. This has been requested many times.

I kinda had the feeling of that, so please add me to the wishlist.

Sad though, that would help sooo many users that struggle with the logic, as me...

I am used to define rules and criteria in the triggers, before an action is allowed, but I think the logic is a bit off from this in the RM. Which in my simple mind complicates the human logic way of rules...

A cut and paste from other forum heroes would be awesome...

Just saying, no pun intended.

And there my living room lights went off.... Hahaha


I don't know about the OP but that sure as hell answered a lot of my questions. I find the motion lighting app very limited, now my sensor are rocking just the way I like them so a huge cheers from me :smile:

1 Like

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