First post, so go easy on the new guy!
First, hats off to Hubitat support. I appeared to have received a bad Hub that constantly slowed down and restarted itself for no apparent reason. After some back and forth they sent a new hub which seems to be screaming along with no problems!
Now to the matter at hand. I want to acheive the following, which is most likely simple but my new but ever growing Hubitat knowledge and understanding of the lingo is most likely holding me back.
I have Lutron Caseta dimmers everywhere for almost all my lighting. Upon sensing motion from my Ecolink PIR2.5, I want to capture the dimmer's current state, DIM lights to "X" level, then restore dimmer back to original state after no motion for "Y" minutes. It all seemed pretty easy to me and works about 80% of how I would like it to.
The problem I am having: If within the "Y" minutes my motion goes inactive and then back to active it re-triggers the entire rule over thereby capturing the current "X" dimmer level and not the original dimmer level I intend to restore at completion of the rule. I hope I am simply overlooking something simple, but after searching the forums for the better part of today and trying multitude of various rules I am at a loss! Below is where my rule currently stands. Please help!
As you found, the rule will be triggered every time your motion detector is active. I doesn't wait for one iteration of the rule to finish. There can be multiple iterations running at the same time.
You could use Private Boolean in your rule to keep the actions from running until the rule finishes the first time. Something like this:
Office Motion Detector active
IF Private Boolean is False THEN
Set Private Boolean True
... do the stuff in your actions here ...
Set Private Boolean False
Thank you so much! You saved me much more frustration and searching!
What a great tool with endless possibilities....but so much to learn!
Soooo, after some more implementing and testing the original rule you suggested @jabecker, under some circumstances, the rule was still re-capturing the dimmer levels after the rule triggered and changed the lighting level thereby creating a loop where my dimmers will not go back to the previous state before the rule was triggered.
However, your suggestion got me in the right mind-frame to begin to understand the private boolean feature as well as gain a better understanding of the IF THEN logic. A big oversight on my part is making the delay cancel-able and using the IF ELSE command. All that said, I believe I have a solid rule setup that gives the functionality I desire.... that is until further testing! j
In case anyone else is looking for the functionality that I desire, please see below for my current rule. On motion active, capture dimmer levels, set dimmer to level, delay for certain amount of time, set dimmers back to pre-rule state after inactive motion for 'x' amount of time, and here is the key, re-run the rule without recapturing the dimmer level if motion becomes active again during the delay phase. I truly hope this nails down the functionality as pretty much every room in my house will need this return to previous state functionality!
So, my saga continues. The rule above is working mostly as I would like, however looking into the logs I am getting the error below, which from my understanding is due to the fact the rule is being triggered multiple times and running concurrently with itself. Any suggestions on a fix. I am again scratching my head!
Thanks in advance for any ideas!
So I rebuilt the rule from scratch with the same settings and all seems well. I am wondering if I hit the back button or return to apps button when creating the original iteration of this. I will keep watching and keep this thread up to date.
I'm really glad you got it working, and I hope it continues to work without any issues. RM can be persnickety.
So after rebuilding the test rule all seems well for the past 24 hours. I decided to move forward and try to implement this into my kitchen which generally has a scene set by the mode when no motion is active and a scene set by motion. I used the Simple Lighting App for the mode scenes and used a modified verision of the above rule for the motion trigger/return to previous state. At first I had the following, which worked but seemed unnecessarily long:
Turns out it was as I didn't realize you could not only set delay per mode, but if I were to create scenes for each of my motion events I could also set a scene per mode. The unruly (pun) rule above was simplified to the following:
Now I realize this may be obvious to the more veteran Hubitat-ers out there, but I figured I would document my whole process for any other newbies out there. It is just the tip of the iceburg and I am loving the seemingly limitless possiblities. What a great feeling to have it work correct, exactly as I want it, without those pesky errors showing in the log.
Thanks again for the gentle nudge in the right direction @jabecker.