Working on some new logic that turns on some holiday lights between November 5th and November 30th starting at sunset. This also changes a system level variable (Holiday Lights) to either true or false which is used in another rule machine automation.
Tonight 10:30pm came around and my else statement didn't fire changing the variable and turning off two lights.
I'm sure this is an easy fix for an experiences rule machine writer.
That's not at all how if/then/else works, or more precisely, that's not how triggers work.
Your rule triggers only once at Sunset -5 minutes. It then runs all the actions, skipping those that don't meet the "if" condition.
Is there something you didn't show in the screenshot that would retrigger it again later? If not, this can't work.
It looks like you can dump the whole if/then statement. Have you first action turn on the lights. Then have an action to wait for the time to be 10:30, then have the next action be to turn off the lights.
The logic flow is one trigger to start the rule, an initial action, a delay until a later time, then finally another action after the delay/wait is over.
Correct - what Alan wrote above is true for that second rule too.
The documentation for RM is pretty darn thorough -- for a better understanding of what triggers, conditionals, and actions are and how they all relate to one another, it's a good reference to have handy (it has a useful index on the right side)...
So 10:30pm came around tonight and only part of my actions ran at that time. It set the HolidayLights variable to false, but didn't run my off commands?
The logs for rule 55 show the actions ran at 4:47 and then again at 4:53. Did you open the rule and 'run actions' at 4:53? That's what it looks like, and then it looks like you clicked either "update rule" or "done", which re-initialized the rule at 4:54:43. When the rule re-initialized that reset the wait, so the 10:30 actions never ran. You do have to be careful about updating rules while they have pending waits and delays.
That, however, doesn't explain why your other rule shows HolidayLights going to false at 1030. Is there a third rule that could have set that to false? If not, I'm not sure what's going on.
No there isn't any other rules running that would set that variable to false, that is what has my stumped. I'll see what happens tonight and report back.
After sunset today, click the settings gear icon at the top or rule #55, scroll all the way to the bottom, and look at the scheduled jobs. It should show the scheduled actions for 10:30. Do NOT click update or done afterwards, as that will re-initialize the rule.
(If you do click one of those by accident, you should be able to go into the rule, click "run actions" and then navigate away without clicking update or done. That will re-run the "on" actions and re-schedule the 10:30 off actions
If you go to Settings -> Hub variables and click on the name "HolidayLights" it will show you what apps are using the variable at the bottom of the list. If you haven't looked there already, can you check that and confirm no other rule is using it that might have switched it at 1030?