Previously a few people gave me nice help with my RM rules for my light issue that put me on the right track, but still fails to work exactly right so I wanted to put this out there again. I finally came up with this rule......
I am looking for the motion/on, setting dimmer level via mode, auto off, AND manual override via using a switch or Dashboard that also does an auto off if no motion.
My rule now works EXCEPT if I never enter the room and manually turn on the light, it will never time out by itself. I need to actually enter the room before the off rule with start the off delay command. So this is the last issue I need a suggestion about with my rule.
The motion lighting app likely can do all you need. I use that for most of my “courtesy” lighting (ie turning a light on as a person walks into a room, different brightness depending on mode, and turning off after a delay after motion stops)
If you want to do it in RM4 ... next post I will include a screenshot of an RM4 rule I use as a “welcome home” - it is not exactly what you want - it does turn on an entry light (presence trigger instead of motion) and kill it after a delay.
It has only one “else” and lots of “else-if” conditionals.
Motion Lighting was intended to avoid the complexity attendant with trying to do lighting control with a RM rule, or often multiple rules. At one point I had something like 60 rules doing motion lighting stuff, and just realized that dealing with the sorts of issues that come up made more sense in a single, somewhat specialized app.
Motion Lighting is getting a new feature in the next release: Contact sensors can turn on the lights in addition to motion.
@buckchucko Unless you're determined to have a complex rule. check out ML. It can handle what you're trying to do, I think.
This is the RM4 welcome home rule I am running. Just as an example of nested conditionals and else-if. (Oh and note - I am an amateur and I am sure there are 103 other, better, ways to do what I have working now after weeks of "trial and blunder")
Basically it is a complicated way to turn on a light at the entry when either my wife or I arrive home, then time out and turn off after 10 min.
There are a few tweaks in it... also
adjusting HSM depending on how it was found and what time we are arriving home.
inserts a wait of 3 min from presence being detected before turning on the light and starting the 10 minute countdown to off.
will also turn on the entry light when the door is opened on our way out.
If you really want to use RM4, you might try splitting up your conditions so they're not quite so complex. Something like this might work:
Occupance *changed* OR
OFC Light turns on
If occupancy active THEN
If OFC Light is off THEN
Cancel Delayed action
Dimmer per mode: OFC Light
Off: OFC Light --> delayed 0:08:00 (cancel)
I tried jabecker's RM.
As far as the motion activation goes, all is fine.
But back to the issue of physical switch (or dashboard) light on and no motion tripped, the light comes on for about 5 seconds and then turns off. So this part is still a problem.
Use RM if you want to, but this doesn't seem right. You're using "active" in your rule, which is part of the Motion capability, but if that happens to be coming from something else (vibration?), it would be possible to rework the driver or use a custom app or rule to get it to report with standard usable motion attributes if that's the problem here. Again, do what you want, but this shouldn't be the reason why.
"You're using "active" in your rule, which is part of the Motion capability, but if that happens to be coming from something else (vibration?),"
Not sure what you mean by vibration. My device DOES report with motion attributes via my ELK panel.
The method to communicate to my ELK panel requires the use of 1 App and 3 drivers. It would be a nightmare to go about tweaking these as you suggested.
My use of RM also puts all my lighting things in one convenient location as well. I dont understand why people are down on using RM. I thought this was the end all for creating automation exactly how you want it with so much abilities at hand.
I'm not saying you shouldn't use RM, but I'm still confused: if you're using the device and its attributes in RM, you can do so in any app (unless it's a custom attribute not part of a standard capability, which it doesn't sound like it is--Motion is one capability that requires implementation of the motion attribute you're using). Again, use what you want--I just like to help people avoid making their life harder than it needs to be by using RM if they don't need to.
You have an "Else" "If" combo when Ithink you actually want to be use ELSE IF's. That rule is not formatted correctly for what you said you want.
So, change your Else's to ELSE IFs using the following IF statement and then Remove the IF. That is why you are missing to END-IFs at the end of the Rule also.
Do you have logging turned on? Can you see what's happening in the log? Are there any other rules that might be turning the light off?
I set up a similar rule and it worked as expected... i.e. the light turned on with motion, and turned off again in 2 minutes. I turned the light on via the dashboard, and it turned off again after two minutes. I turned the light on via the dashboard, waited a minute, then triggered the motion detector. The light turned off 2 minutes after the motion.
I did make one change: I moved the Cancel Delayed Actions to be before the check to see if the light is off.
I tweeked jabecker's example rule and I wanted to post the revision. The problem I ran into was that during the Day mode, if I physically turned on a light, it would turn off at the off delay time. It would never stay on.
I figured the the RM did this because Day mode was omitted from the Set dimmers action. Now, I can turn on a light during the day and it functions just like Eve and Night modes.