Help with contact notifications within a smartApp

thermostat

(Joe) #1

Hi all,

I wrote this smartApp to turn my thermostat off when a contact sensor is opened after x minutes. It will also restore the thermostat to it’s previous mode when all contact sensors are closed. It also sends you a notification as contact sensors are closed to let you know which ones are still open. Unfortunately this results in a lot of notifications when we are closing the windows for the night. Not to mention the numerous notifications from entering and exiting door.

What I want to do is delay the notification by x minutes and only send it if the # of contact sensors is less than what it was previously.

Here’s my github link

Green Thermostat

Can someone help me figure out how to store the number of open contacts and only send a notification if the number decreases after x minutes?

Sorry if this seems confusing, I am kind of hacking my way through this.