Rule Machine Once Per Day

I have a morning routine that I only want to run once per day. Iā€™ve seen several posts about that scenario, but none seemed to work for my rule. Iā€™m using rule machine since there are multiple if/then conditions. Everything works with the rule, but it is triggering more than once and the delays donā€™t cancel (nor do I want them to start over after the first trigger). I have a predicate condition set for a three hour window in the morning as well so it doesnā€™t trigger beyond morning time.

What I came up with today (and havenā€™t tested yet) is to create a hub variable. The very first action in the rule is to set the hub variable to true and the last action is to set the variable to false (with a long delay to run past the predicate time). I added a predicate condition to only run if the hub variable was set to false. Iā€™m not sure if this will work, but Iā€™m thinking it wonā€™t retrigger because of the variable. Am I on the right path or is there a better way to achieve the run once per day option? Iā€™m assuming that the rule setting itā€™s own predicate to false on the first step of the rule wonā€™t mess up the action. My understanding is that the predicate only affects the triggering, and that once itā€™s allowed to trigger, the predicate can become false with no effect on the rule actions.

Yeah. You can use the built-in variable for every rule Private Boolean instead of creating a separate variable. It starts out true, so the Predicate would be that it is true, and first action sets it to false.... etc. The actions will run even if the Predicate becomes false, as you wondered.

1 Like

So, I had a rule timed out for our morning routine. I only want it to go through the timing once (on the first trigger) and then be inactive until the next morning. I also factored in a cancel trigger because there are times my wife tries to change it up and wants to turn on a light right away. While this rule is running, the light will turn up, but them immediately dim back down to the next scheduled interval on the gradual fade. I tried to put the cancel delays in the same rule because a second rule canā€™t cancel the delays for the first rule (that Iā€™m aware of).

I can get it to only run once with the private Boolean and delayed reset, but that throws my override/cancel out the window because the rule wonā€™t retrigger. If I allow it to retrigger, it either runs multiple gradual fades or sets multiple timed actions. Is there a way to choke down the conditionals to keep it from running over and over?

This actually seems to work. It would be nice if you could pre-stage a dimmer rather than it turning on, but I don't think that is possible(?). The motion is an instant trigger and registers the lights as on. Any retrigger after that routes away from starting the timers over due to the IF condition with the lights on. I can't tell if there are any issues right now. I ran it several times and it seemed to work with all the possible re-triggers I could do. Anyone see any issues?

Some dimmers can pre-stage. I use GE ones.

Donā€™t know if you got it working the way you wanted, but the code above doesnā€™t look right to me: you donā€™t reference the private Boolean in the predicate and donā€™t need to set it in the else-if (which also doesnā€™t look right, I.e., setting to true if true).