Window open warning rule

Hi guys, i've had Hubitat about a week and a half, it is fantastic! but it has been a steep learning curve on the more technical coding aspects. The community here has been brilliant too.

I have rules setup for a lot of stuff and things are running great.

One thing I am trying to do is setup a rule where if a contact sensor is open for more than 2 hours either send me a notification in PushOver (service already integrated) or maybe have Alexa speak it.

However I can't find a way to set a caveat to state it has to have been open for that long. I can setup rules for open and closed but not sure how to do an "If open for x amount of time then..."

Any help would be appreciated.

There are several ways to handle this, Here is one:
A rule with window open as a trigger.
Put a delay for two hours in the actions.
After the delay, have a conditional which tests whether the window is open.
Inside the conditional, put your notification.

Here is something I use.
Ignore the private boolean bit. Leave it out.
In this rule if the door is open it will repeat the announcement every hour until it is closed.
When the door is closed the second if stops the repeating actions and the delayed actions.
Hope this helps.


Thanks :slight_smile: i'll give that a go :slight_smile:

So this is what i've cobbled together but no idea if it will work and it's too late now to leave a window open for 2 hours!

i'll give it a try in the monring

There's a resetting local variable there to count how long the window has been open for in hours but not sure if that will work

Why do you need a variable?
Once your rule starts repeating there is nothing that stops it.
Your trigger needs to be 'changed' as there is no trigger for the windows closing.
Why not just copy mine. It does work OK. :+1:

I was just wondering if I wanted to put in a variable to be able to count the length of time the window has been open, so the notification would be "bedroom window has been open since 10am, which is 2 hours"

On your rule :

  • how to stop the repeating every 2 hours ?
  • if Bedroom Window( A ) stay open, Kitchen Window ( B ) open for 10 minutes then close... The %device% , %time %, % open time % is A, or B, or both AB ?

You can do this in HSM custom as well. I have one that lets know is front door is unlocked for more than 10 mins


The built-in Notifications app can also do this, and it's much simpler to setup than a rule machine rule.


I second this approach. The built-in Notifications App is the simplest way to accomplish this. I use it for monitoring all doors In my house.


I had no idea HSM had a custom monitoring section, I have HSM mirroring my ring alarm for status toggles and I have intrustion activites set for the different modes but i'd not noticed this customer monitoring section. I think this will work brilliantly!

I'll setup some customer monitoring rule now and see :slight_smile:

I also like that I can tie the HSM custom rules into only running in certain modes. I.e if the bedroom window is open over night I don't want an alert every 2 hours, but if it's open during the day I do want an alert.

Thanks this looks exactly what I was trying to do and a lot easier than all the conditional coding above that didn't work!

I didn't show the whole rule above that doesn't show different actions for different modes.
The rule started in RM2.5 and I've just updated as RM has evolved.
I did try the notification app when it was released but it never worked well for me.
Maybe I'll have another look at it but I'm a believer in If it ain't broke, don't fix it.
Then again I'm also a tinkerer............. :wink:
As long as you get things to work as you want them to that's all that matters.

thanks for your help @bobbles, I'm not using notifier as I try to avoid it after some early attempts that didn't work very well.

However i'm setting up rules using HSM custom monitoring as per @deanturner39 's suggestion above.

I've only just setup the rules but the interface is real easy to do and it'll send notifications through Echospeaks and Pushover so should be exactly what i'm looking for :slight_smile:


Thanks @deanturner39 worked a treat, i've setup a HSM rule for 2 4 and 6 hour notifications for the windows and doors I wanted, left the kitchen window open and 2 hours later we got the alert on all the devices we wanted it on. perfect, thanks. The only down side is you can't copy a rule in HSM custom so had to create each one separately but other than that it works great.

1 Like

Good stuff! glad it helped you. :+1:

Found one slight issue of my own making today when none of the alerts working but that's becuase I have HSM synced to DisarmAll when my house alarm is disarmed in a morning rather than HSM being synced to Disarm only. So when I disabled my house alarm this morning it also disabled all my alert rules haha. Sorted that and just tested it and working like a charm again :slight_smile:

What were the problems that you were running into?

HSM can work fine for many of the same types of notifications, but I have found the notifications app to be very effective. In some cases it can provide more advanced logic than an HSM custom monitoring rule, but remains far simpler to use than rule machine.