RM: Door Alert help

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?

From the App Info page of the RM rule:

Door AlerterBuilt In App

Name Type Value
usePrivateDisable bool
modesY mode
disabled capability.switch Door Monitor
daysY enum
rCapab1 enum Contact
rCapab2 enum
rDev1 capability.contactSensor Back door , Front door , Kitchen door , Patio door
state1 enum open
AllrDev1 bool
disabledOff bool true
repeatHourTrue number
repeatSecTrue number
delayMinTrue number 1
repeatMinTrue number 3
delayMilTrue number
delaySecTrue number
randomTrue bool
cancelTrue bool true
stopRepeatTrue bool true
phoneTrue phone
speakTrue bool true
msgTrue text %device% left open
noteTrue capability.notification
speakTrueDevice capability.speechSynthesis Lannouncer-Venue , PB-PAWNINATOR-PC , PB-Samsung SM-G960U1 , Pushover
operator2 enum
advanced bool
condL1 enum [Back door, Front door, Kitchen door, Patio door] any open
condNotL1 bool

Event Subscriptions

Source Event Handler Filter
Back door contact allHandler true
Front door contact allHandler true
Kitchen door contact allHandler true
Patio door contact allHandler true
Door Monitor switch disabledHandler true

Application State

Name Value
delayStrTrue Delay by 1 minute [Cancel] Repeat every 3 minutes (Stop)
isExpert false
lastEvtValue closed
private true
delayRuleTrue false
actsTrue Delay by 1 minute Cancel Repeat every 3 minutes (Stop) '%device% left open' speak
ruleTruths {}
howMany 2
certainTimes []
n 2
token 1
str [Back door, Front door, Kitchen door, Patio door] any open
eval [1]
installedCapabs [Polling, PowerMeter, PushableButton, IlluminanceMeasurement, CarbonMonoxideDetector, HealthCheck, Battery, Outlet, Valve, Alarm, SpeechSynthesis, MotionSensor, ColorTemperature, PresenceSensor, SmokeDetector, Thermostat, Light, AccelerationSensor, Refresh, RelativeHumidityMeasurement, ThreeAxis, TamperAlert, EnergyMeter, ColorMode, TemperatureMeasurement, Lock, ImageCapture, Notification, SwitchLevel, Tone, Switch, ChangeLevel, Configuration, Actuator, Sensor, ContactSensor, LockCodes, ColorControl]
cstCmds []
success false
ruleType rule
repeating true
msgTrue '%device% left open' [speak]
disabled true
lastEvtName Kitchen door
delayRuleFalse false

Scheduled Jobs

Handler Next Run Time Prev Run Time Status Schedule
repeatTrue Sun Aug 26 16:26:15 CDT 2018 PENDING Once

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).

Did you tried creating your rule with HSM instead RM? Enter to HSM and at the bottom in the custom section.

1 Like

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.

I did the test, and I'm having the same issue, the door will keep sending notifications after it's closed.

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.

Oh rayzurbock!! You found a bug. My bad.... You can guess what it is, what not's killing the repetition....

The disable switch is not stopping the reps, and it should. Will dig in and find out why!

1 Like

I used this way and works fine

2 Likes

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.

No problem. I was just giving my idea of how I thought it might work. You know the internals and big Hubitat picture.

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.

1 Like

Thanks @vjv, I used your suggested rule

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.

2 Likes

I just wrote the same rule except I toggle the hall light until someone closes the door between the laundry room and garage.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.