I tried to move a WebCoRE piston to Rule Machine that alerts me if a door has been left open for x minutes and then repeat that alert every 3 minutes.
I wrote the rule, included cancel on truth change and stop repeating on truth change but it's still repeating and my "Door Monitor" switch isn't stopping the repeating if it is ON or OFF. What have I done wrong?
Edit: Tagging @bravenel. You can see that "disabled is true" (Door monitor switch is off) but it's still scheduling the repeat every 3 minutes and sending me an alert even though the condition/rule is false and the door monitor switch disablement switch is off (configured to disable rule when off, enable rule when on).
I did not. I have HSM configured for various things but had an issue a while back so I set it to disable all HSM alerts/alarms (can't recall specifics at the moment)
Now I'm just curious why this RM rule continues to reschedule/repeat when the condition is no longer true as well as when the disablement switch should have it disabled.
I see your point, I'm not an expert but I will not use a contact sensor as a switch(switch to disable the rule), I will try to test myself with my laundry door with one minute notification and see how it goes. I let you know.
After sending me alerts all day, it has finally stopped.
Now it's working as expected again. It has alerted me every 3 minutes all day long. The door correctly reported open and closed and the timer didn't stop when closed. Also my disablement switch didn't work either.
Here's what I perceive as the bug. @bravenel
If the rule becomes true and performs the action and begins the repeatTrue schedule then while in this state, the disablement switch is set to disable the rule, the schedule is reapplied at every interval and the rule's truth is never re-evaluated. The action is just rescheduled and executed repeatedly (without regard to rule truth or disablement). The only way to make the rule stop running is to flip the switch to re-enable the rule and wait until it is re-evaluated after the next scheduled repeatTrue call.
One more thing to add.
Once the rule was re-enabled the alerts didn't actually stop until repeatTrue ran with the door open (rule truth = true) and then again when repeatTrue ran again with the door closed (rule truth = false).
Door Opened. Alert scheduled for 1 minute in (cancels properly if truth changes)
Door remains open at the 1 minute mark, Schedule is applied for repeat every 3 minutes. Alert is received in 3 minutes (cancels properly if truth changes)
Door remains open, rule is disabled by the disablement switch. Alert every 3 minutes persists, disregards door state (open/closed) / rule truth.
Rule is re-enabled by the disablement switch. Alert continues every 3 minutes, disregards door state (open/closed) / rule truth.
Door is opened and held open until the 3 minute repeat schedule passes while the rule is enabled. Alert is received.
Door is then closed after the first 3 minute repeat after turning the rule back on. Schedule repeatTrue schedule is finally deleted and repetitive alerts stop.
I found the bug. Will now look at these variations.
It's not clear to me what should happen when the disablement switch is turned off. It has stopped the repetitions (once bug fixed). Do you think that they should start up again when the disablement switch is turned off? I know as it is now that it won't, as these are chained runIn()s, and once stopped, they won't start up again.
In effect, the disable switch acts as a Stop for repetitions.
I would think, disablement stops further actions, but reenabling would schedule a reeavluation of the conditions otherwise even though conditions are true on reenablement no (true) actions will be performed until events cause the rule to become false and then true again.
It's never been the semantics of a restriction that they cause evaluation of a rule upon expiration. If you restrict something to not run in a mode, and then the mode changes, that would only cause an evaluation if the mode were a condition. A restriction is not a condition. I think that distinction should remain. Which basically means that if a restriction causes a repetition (or a delay) to stop, the lifting of the restriction does not restart the repetition or restart the delay or cause a rule evaluation.
You could make the disable switch a condition of the rule. When it changes state (say, it is turned on), the rule is evaluated, and it evaluates to false then (condition is switch = off). Then, assume the door stays open, and the disable switch is turned off, rule is evaluated, and the repetitions start again.
It's not that, it's just the way RM works. The difference between a condition and a restriction is that a restriction doesn't cause a rule evaluation -- it simply stops the rule from doing anything.
So for the use case you want, instead of a restriction you want the disable switch to be a condition of the rule. If the switch is off, the rule can run, if it is on, the rule cannot run. Door opens, repetition starts. Switch turns on , repetitions stop. Switch turns off, repetitions start up again. Door closes, repetitions stop. Switch is ignored unless the door is open.
as a template to set a reminder for my freezer door not being shut correctly, and think I might be able to use it as part of my Laundry Reminder rule (??) which would be my last rule to migrate over from ST.