This is my first post here, but I've been using the ISY for a while now and have a question about an ISY program that misbehaves when the Query All program runs. I'm hoping someone with more knowledge can help.
Basics of Programs
I created a series of programs that uses the sun and the status of the all the downstairs lights to determine when it's been 'dark' in the downstairs part of the house for more than 15 minutes. Then when the garage door is opened, I look to see if it's been dark for more than 15 minutes and I turn on a bunch of lights that we would ordinarily turn on or need on when getting home. The reason I added the part about being dark for 15 minutes is that I don't want to turn off every light in the house while leaving, open the garage door to leave, and instantly have all the lights turn back on because technically it's dark and the garage door is open. I was trying to leave!
Issue
The first few days we had this program, it all worked great, but every morning my wife would go downstairs and find all the lights are on, even the stairs lights which are only really on while walking up and down the stairs. This went on for a couple days until I checked the logs and found out that apparently the Query All program that runs at 3am temporarily sets the garage door status to open, tricking my program into turning on the lights.
Possible Solutions
One way I thought to get around this would be to add a delay to make sure it's 'open' for more than a few seconds before triggering the lights, but I really would like the lights to turn on the instant the garage door opens. Another option is to simply remove the Query All program - I'm not sure what the implications of doing so, as I still don't know what purpose this program serves. A third option would be to set a blackout period in the program that's checking for the garage door to be open and if it's been dark for more than 15 minutes. This would work, but hopefully I never come home between 3:00 and 3:01 am. Also, as a developer by trade, this is just not the right way to do things.
Now What?
I'd love to know what is the recommended way to handle such a situation. I'd also love to know what purpose the Query All program actually serves. Any advice to rectify this issue would be appreciated.
Program Code For Anyone Still Reading
Here are the programs, for anyone curious or wanting to implement a similar idea. Also, for bonus points, you can tell me how to write these more efficiently!
Downstairs Dark More Than 15 Minutes
If
Program 'Any Kitchen Lights On' is False
And Program 'Any Living Room Lights On' is False
And $Downstairs_Dark_More_Than_15_Minutes is 0
Then
$Downstairs_Dark_More_Than_15_Minutes = 2
Wait 15 minutes
Run Program 'Downstairs Dark More Than 15 Minutes Part 2' (If)
Else
- No Actions - (To add one, press 'Action')
Downstairs Dark More Than 15 Minutes Part 2
If
Program 'Any Kitchen Lights On' is False
And Program 'Any Living Room Lights On' is False
And $Downstairs_Dark_More_Than_15_Minutes is 2
And From Sunset - 30 minutes
To Sunrise + 30 minutes (next day)
Then
$Downstairs_Dark_More_Than_15_Minutes = 1
Else
- No Actions - (To add one, press 'Action')
Downstairs Dark More Than 15 Minutes Part 3
If
Program 'Any Kitchen Lights On' is True
And Program 'Any Living Room Lights On' is True
Then
$Downstairs_Dark_More_Than_15_Minutes = 0
Else
- No Actions - (To add one, press 'Action')
Garage Door Open Night
If
Status 'Outside / Garage Door-Sensor' is On
And $Downstairs_Dark_More_Than_15_Minutes is 1
Then
Set Scene 'Home' On
Else
- No Actions - (To add one, press 'Action')