Nighttime Routine [SOLVED]

Hi All,

OK so I've got this routine working quite nicely, thanks to those who helped me out already especially @BorrisTheCat for the information on variable and switch connectors, that actually made simplifying my other rules much easier too!

I've got the routine working almost as I want it but I can't work out one thing, I have an IF - ELSE clause in the rule as you'll see below, I wanted to make it so that the notification under the IF statement would return saying that %device_name% was still open. however that didn't work when I tried it as it returned a device name of "Nighttime" which is my local variable. I'm presuming maybe I have to create local variables for each contact sensor to be able to call the ones that are open?

As I couldn't get this to work I changed the announcement to be "There are doors or windows still open, Please close them immediately, the alarm will be set in 4 minutes"

Ideally I want it so that if the IF is triggered it will return a notification sating which doors and windows are still open based on the contact sensors it's checking.

I've stared at this for a few days pondering how to make this work but i'm stuck .

I want the action under the if statement below to return a statement identifying which contact sensors are still open.

So here's what I have so far:

1 Like

1st although not need in this case you should always end a IF THEN with a END IF to show the rule that that part is finished. In this case just add it to the end (its in the same place as the IF THEN and ELSE).

%device% will always return what has triggered the rule in this case that is always the local variable that you have set so the above is correct.

For this best place is to check out @Cobra "check open contacts" app. If not done already, sign up for his website to get access you his apps and drivers :grinning:. Then using this rule you can trigger his app which will do exactly what you're after. I have a switch that automatically turns back off so that I can ask GH to "check the house"


I’ve signed up for @Cobra website that app sounds perfect!

Thanks again @BorrisTheCat!

Just wanted to say again, thanks for your help once again! I got access to cobra's site and installed the app and integrated it into the rule. Works like a charm!!

1 Like

No worries, happy to help :grinning:

I have been struggling with this exact same scenario too, for my nighttime rule to check windows and doors are closed. Each time it returns 'set night'. my rule is a bit messy as i've been trying different permutations of %device% and %value% to see what works.....

Anyway thanks for the tip, i'll get on it!

I implemented @Cobra app for open close and tacked it onto a vitrual switch which is flicked in the nighttime routine and works great, tested it last night and it returned exactly what I wanted listing the contacts that were still open.

So my nightime routine now looks like this, the line On:Nighttime security check switch runs the app and returns the contacts that are still open:

1 Like

This is the setup i'm using in the Check Open Contacts app from @Cobra for the nighttime routine i'm only checking the downstairs contacts:

Nighttime Security Check is a virtual switch. Also I've duplicated this app for an alexa routine where I can just state "Alexa Security Check" and Alexa returns a list of open contacts for the whole house. For one off checks and that is also initiated when the alarm is armed into away mode to make sure no contacts are left open

1 Like

Also for the whole house security check I have set Follow Me as the speech device so that wherever we are in the house Follow Me issues the response to the active rooms and speakers.

Sorry if all this is too much information I'm just deep in this routine in my mind at the moment as this is the one i've been working on but I think this is sorted now so I can move on to refine other rules that I threw in a little bit slapdash when I first got my Hubitat a month ago!