I was trying to avoid using private booleans to prevent a rule from triggering while the actions are already running.
But creating a simple conditional trigger based on time since last motion event does not seems to act the way I would expect. So I have gone back to the boolean.
Should a simple conditional trigger based on time since last motion active work?
Are there any other best practices for keeping events from stacking?
Conclusion: The RuleMachine time of last device event cannot be the device that triggered the event. Because that time is always zero.
RuleMachine could use enhancements regarding date-time variables. The concept of now() and date-time math (deltas) is needed.
Alternatively, there could be private virtual devices inside a rule. Like defining a variable.
Or the "Actions" for a rule could become a device to turn on or off.
Or "Time Since Last Event" could point to a variable instead of a only devices.
I wanted to avoid using private booleans because they are not "self maintaining". I dont want to be in the position where an interruption will leave a boolean in a false state where the rule will never run. I have buried "set everything to true" statements in periodic rules to sweep these, but its a kludge.
At post 10pm I can't argue with any heft... So that seems like a good approach to me. Plus, regardless of the time, I can agree with the fact that managing a boolean can be problematic. The more experienced (and awake) users may offer whether there is an option to adjust a private boolean on bootup... ?
I use PBs for stuff that has a relatively short duration (bath fan during shower, dishwasher running, etc) -- that way, the risk of its T/F status somehow getting messed up is low.
I have a house-keeping rule that runs at ~3am nightly that refreshes/resets a bunch of devices and it also ensures all of my PBs = True.
WRT conditional triggers vs required expressions, I decide on that by considering the balance of how often will the trigger event happen overall and how many of those occurences do I want to trigger this rule?
The use of PB's is not an all or nothing thing in terms or correctness, as I have found out in recent weeks, you do need to "manage" them in all circumstances where you update stuff (for me handling opening of blinds in the morning). So there is no "correct" option, just one that can be managed more effectively. I am stilll in favour of PB's in many circumstances, but they need some consideration, like any option.
Ok, I see it. The device update time is set when I trigger the device. But of course by the time my rule sees it, the time since the last event is zero (it just happened).
I understand this issue. I am going to try a virtual device that only my rule uses.
The time is updated instantaneously when the motion device sees me. So the time since it was last activated becomes zero when the rule sees the event..
time since last event cant be -that- event. It has to be some other event.
They really need a 'time since rule was last trigger/run' condition.
I am putting a virtual button in. I will trigger that in my actions. and that will set
my timer.
The virtual button is working as expected. I virtually press the button inside the rule and that event can be used in the "time since last event " conditional trigger.