Help on Rule

Can someone help me with a rule on motion and lights?
What would a rule machine rule look like to turn off a light if a motion sensor doesn’t see motion for a time period (eg 1 hour). This should be for any way that a light is turned on (manually or via motion detection).


First, if you don't have a reason to use Rule Machine for this, I wouldn't. Two built-in apps can already do this exact automation for you, Simple Automation Rules (formerly "Simple Lighting," as it may still appear if you're on hub firmware v2.1.9 or earlier) or Motion Lighting. Either is much easier to set up than it is to create a rule.

If you did want to use a rule for some reason (learning Rule Machine, or some other aspect to your automation you didn't mention above that these apps can't already do), then I have two recommendations. One is to look at the Rule 4.0 docs, which have a few motion-lighting examples, including one exactly like what you want to do. Second, I'd look at the recent 4/28/20 Hubitat Live starting around 4:29 where they changed their mind about how they suggest setting up this kind of rule. (The behavior of both setups of rules would be the same; they just believe the second one is simpler, so easier for you and possibly the hub.)

All of the above assumes you expect motion at some point. If you want a light to turn off after 1 hour regardless of whether there ever is motion, then you'd need to add something else. But to me it sounds like you're expecting motion at some point and just want to turn the light off an hour after it turns on, regardless of whether you happened to turn it on yourself or if it was turned on by motion detection first.

I could also just give you an exact example rule, but I promise that reading the docs is both helpful and necessary, and they are filled with examples like this, so I know you'll both be able to figure out from there and be happier and more confident with RM in the long run this way. :slight_smile: (But again, if you don't have a reason to use RM: use a "regular" built-in app instead.)