Hey everyone - I've been a ST user for a few years and now I'm migrating to Hubitat. My rule building skills certainly need work. So, let's see if I can explain this so it's clear...
In this example, here's what my rules do:
Rule 1 - Motion sensor activity turns on lights to 100%
Rule 2 - Motion sensor inactivity sets lights to 25%, waits 1 minute, then sets them to 0.
During that 1 minute wait, a time based rule sets one of those lights to 1% (my time based nightlight rule), but then when the minute is up, the lights all get set to 0, and my nightlight is gone).
Make sense? How can I avoid having my nightlight extinguished by this? I know just about anything is possible with this system, I'm just not experienced enough to make it happen. LOL
You could check the level of the light after the 1 minute wait an If 25% set to 0 or if 1% don't change the level. Or you could have the rule set the light to 0 or 1% based upon the current time.
Thanks! This hurt my brain a little bit, but it seems to be working as I want. Any gaps in logic seen, or suggestions for improvement? This is of course only the rule to turn the lights off. The one to turn them on is the easy part.
The only other formulation I might suggest involves capturing the current state of Entry 2 and restoring it at the end of your rule. Also, unless you foresee inserting more steps within your IF-THEN clauses, I'd recommend sticking with Simple Conditionals (no need for END-IF, and easier to read/rearrange).
This just puts Entry 2 light level back to where it was before the Rule ran. I eliminated the rest because I assume you have a different rule for Motion == Active, and that rule could very easily include a CANCEL action to stop the Inactive rule.
Ok - I think I got it all in one rule now. Though helpful to know the capability, I'm actually not concerned about capturing the state of Entry 2 before this runs, since nightlight (Entry 2 bulb) only comes on during Night mode, and this rule doesn't run during Night mode.
I'm not sure I completely follow your logic but you have an IF statements that isn't doing anything. The rule triggers on motion active. You then have a Wait for motion inactive. I don't think the first IF (motion active) Exit Rule will do anything only milliseconds after the motion sensor went inactive. You also made the Delay cancelable but you don't actually cancel it. You need to add something like Cancel Delayed Actions before the Delay to actually cancel it.
Thanks for reviewing it and giving feedback. It seems to be working as I'd hoped. Motion sets 3 lights to 100, then it waits for the motion sensor to go to inactive, when it then sets them to 25 (w/entry 2 being conditional), then it waits for 1 min, when it then sets them to 0. I put the if motion then exit to make it start over if there's motion detected during those two "inactive" periods. Before setting the delay to cancelable, it didn't seem to start that countdown over if there was motion. It seems once I set it to cancelable, it killed that countdown when there was motion during that part of the rule processing. Is that not how it works?
No, that's not how cancelable works. Instead of Delay use Wait for event: elapsed time 0:01:00 and delete both IF () Exit Rule. If the motion goes active again the Wait will be canceled and no further actions will be executed. That sounds like what your trying to do. Or you could leave the Delay as is and add Cancel Delayed Actions as the first action and delete both IF () Exit Rule. That'll do basically the same thing.
If you really want to keep both IF () Exit Rule you could just add Cancel Delayed Actions a the first action. They won't hurt anything but they're not doing anything either.
Thanks - in order to optimize the rule, I will try the wait option for 1 min, and remove the exit statements. I'll report back my findings when I get the chance to try that!