Faulty rule to alert if garage door is open too long outside of expected time periods

Any pointers about what's wrong with this rule?

The intent is to alert if the garage door is open for more than 20 min during weekdays except between 5:00pm-7:30pm, or open for more than 20 min weekends except between 8am-9pm.

The garage door sensor itself works correctly, but I don't get any alerts if it's open for an extended period.


Select Actions for Garage door left open
IF ((	Day in Monday, Tuesday, Wednesday, Thursday, Friday(T)  AND 
	(F)  AND 
	Time between 7:30 PM EDT and 5:00 PM EDT(T)
)  OR 
(	Day in Saturday, Sunday(F)  AND 
	Time between 9:00 PM EDT and 8:00 AM EDT(F)
) [FALSE]) THEN
	Delay 0:20:00
	IF (Garage Door Opener open(F) [FALSE]) THEN
		Notify Phone1 - Hubitate App, BBE100-5 and Speak on Livingroom, Bedroom, Office, Kitchen(volume: 100): 'Garage door left open since %time%.'
	END-IF
END-IF

Did you experiment with just one day at one time for troubleshooting purposes? Once that's right, then you could expand the rule. Start with simply if it's open for more than 20 minutes and get that to work. If you're using RM4 I see that you don't have a cancel delayed actions, so if the garage does close before 20 minutes, you will still get the notification regardless.

The rule is quite complicated and I recommend that you break it up so that you can get one thing to work before moving on and adding more conditions.

This is what I see - your timeframe looks backwards at first glance, which is confusing me. simply make it that time is not between 500pm and 730 pm. earliest time first. Yours looks to be the opposite, so it will notify you only between 5pm and 730pm. Timeframes run from the first time listed to the second. So instead of two hours you have 22 hours. In short, I would start with something like this. Excuse the abberviations as I'm limited on time.

Triggers should be - sensor "changed" Perhaps a time of day trigger as well.
IF
sensor is closed then cancel delayed actions
ELSE IF time is between 730 pm and 5PM and day is MTWTF OR SS between 900 pm and 800am and sensor is open then delay 20 minutes and speak your notification.
end if

I apologize for the quick response. I hope this helps you?

What triggers do you have for the rule?

@5fe94872fdbd2dbd06a8 Not sure what problem the 2 AND's will cause in the first IF statement.

Can you post a screenshot of your rule, including the triggers?

If you're using RM4 I see that you don't have a cancel delayed actions, so if the garage does close before 20 minutes, you will still get the notification regardless.

Why would there still be a notification? The first action after the 20min delay expires is a test of whether the door is open at the moment.

I do see now that there's the possibility for a false alarm, for example:

Tuesday, 8pm garage door opens
	event(1) triggers
	20 min delay starts

8:05pm door closes
	previous delay continues running

8:19pm door opens
	event(2)
	20 min delay starts

8:20pm 
	20min delay from event(1) expires
	test (door open) succeeds, false alarm sent that the door has been open since 8:00PM

8:21pm door closes
	
8:39pm
	20min delay from event(2) expires
	test (door open) fails, no alert sent

The rule is quite complicated and I recommend that you break it up so that you can get one thing to work before moving on and adding more conditions.

Good suggestion.

This is what I see - your timeframe looks backwards at first glance, which is confusing me. simply make it that time is not between 500pm and 730 pm. earliest time first. Yours looks to be the opposite, so it will notify you only between 5pm and 730pm.
Timeframes run from the first time listed to the second. So instead of two hours you have 22 hours. In short, I would start with something like this. Excuse the abberviations as I'm limited on time.

That's what I intended -- during a timeframe beginning from 7:30PM
until the following 5:00PM (which happens to be on the next day), send
an alarm if the door is open for more than 20min.

Where can I find documentation on the "time between" format? I
searched the documentation ("time between", time restriction, read
https://docs.hubitat.com/index.php?title=Rule-4.0) and I didn't find a
specification for the time format, or any indication that a time range
cannot span midnight (ie., that the start time in 24hr notation must be
lower than the end time).

If that is a requirement, then the Boolean negation you suggest should be fine.

Also, if that is a requirement then RM4 should reject (not save, not display the "Done" button) the rule until the syntax is corrected.

Triggers should be - sensor "changed" Perhaps a time of day trigger as well.

The trigger is:

Garage Door Opener open

I apologize for the quick response. I hope this helps you?

No apology -- much appreciated.

It would be much easier to debug if you were to post a screenshot of the rule. Your first problem is that your trigger is incorrect. You want to have the trigger be the Garage door changing, not just opening. This is the action you want to have:

IF ((	Day in Monday, Tuesday, Wednesday, Thursday, Friday(T)  AND 
	(F)  AND 
	Time between 7:30 PM EDT and 5:00 PM EDT(T)
)  OR 
(	Day in Saturday, Sunday(F)  AND 
	Time between 9:00 PM EDT and 8:00 AM EDT(F)
) [FALSE]) AND (Garage Door Opener open(F) [FALSE]) THEN
	Delay 0:20:00  Subject to Cancel
    Notify Phone1 - Hubitate App, BBE100-5 and Speak on Livingroom, Bedroom, Office, Kitchen(volume: 100): 'Garage door left open since %time%.'
ELSE
        Cancel Delayed Actions
END-IF
Garage Door Opener open

I now understand the benefit of setting the trigger to "changed" -- to allow the delayed rule to be canceled.

That still doesn't explain why the original rule doesn't alert.

Screenshots, instead of copying text? Ick. Many more steps on the part of the user (create screen shot, edit screenshot to remove personal info, upload screenshot), much harder to read on the part of all forum members (resolution, image size, unusable if the rule is too large to fit on one screen, virtually unreadable on anything smaller than a large tablet), and worst of all, screenshots are a dead-end -- they don't provide text that could be copied & pasted for the benefit of other owners...a screenshot of text-based rules is the equivalent of taking a JPG of source code.

Anyway, here's a screenshot. :slight_smile:

Here is part of a rule that uses a trigger of the door contact sensors changed.
It works well. Is this the sort of thing your after?

Your IF statement first sub-expressions (weekday and time between 7:30 and 5:00) has two AND's thus you must satisfy three conditions for the sub-expression to be true but you second condition is a phantom with a False condition. Your IF statement will never be true on weekdays until you fix that problem.

@pseudonym Thank you sir, I just mentioned that above but it got ignored!

Ah, I now see the NULL "AND" condition in the test for M-F/7:30P-5P.

Thanks for pointing that out.

(Feature request....which I will submit separately....why doesn't RM do this kind of basic logic verification before allowing a rule to be "Done"?)

Hmmm... I can't seem to find a way to edit the conditional action to remove the extra AND -- I'd rather not delete it and then re-create it.

Any suggestions?

(Oh, how I long for a text editable form of the rules!)

You can't. You have to erase the entire expression and start over.

Got it now...thanks.

Following up... I've "edited" and cleaned up the rule somewhat...however, it sends an alert at 20min after the garage door is opened, meaning that the code to cancel the pending alert doesn't work.

There is only a single alert, which implies that the detection that the door is closed does work.

Any suggestions?


your delayed action needs to be set to be Cancel-able.

That was it, exactly.

Many thanks.

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