These were very useful. Here's what I ended up doing..
I used a big if statement using status. I then made a number of additions:
1) I created a state variable to keep track of the number of minutes since the last activity
2) I grouped the switches into programs grouped by area of the house.
3) I created a state variable to tell me if anyone was home.
4) Created a program to drive the state variable based on the set of inactivity.
Example of what I used to detect activity:
If
Status 'Interior Lights / Basement Rec Room Back Door' is On
Or Status 'Interior Lights / Basement Rec Room Back Door' is Off
Or Status 'Interior Lights / Basement Stairs Top - Main' is Off
Or Status 'Interior Lights / Basement Stairs Top - Main' is On
Or Status 'Interior Lights / Server Room' is On
Or Status 'Interior Lights / Server Room' is Off
Then
$MinutesSinceLastDownstairsLightEvent = 0
Repeat 1440 times
Wait 1 minute
$MinutesSinceLastDownstairsLightEvent += 1
Else
- No Actions - (To add one, press 'Action')
I then reset the timeouts to a large number at midnight. I then combine these sub-programs with a master program which looks for activity on any of the timeouts like this:
If
(
$MinutesSinceLastDoorEvent < 21
Or $MinutesSinceLastUpstairsLightEvent < 21
Or $MinutesSinceLastDownstairsLightEvent < 21
Or $MinutesSinceLastGarageEvent < 21
Or $MinutesSinceLastMainFloorLightEvent < 21
Or $MinutesSinceLastMainFloorMotionEvent < 21
Or $AlarmStayModeActive is 1
)
And $SomeoneHome is 0
Then
$SomeoneHome = 1
Send Notification to 'EmailToRod' content 'SomeoneHomeReport'
Set Scene 'Home Buttons' On
Else
- No Actions - (To add one, press 'Action')
This gives me an e-mail every time the ISY determines that someone is home because there was activity or because the alarm system is set to "Stay" because I will always know we are home if the Alarm is armed to "Stay".
For those curious this has done a relatively good job although it tends to timeout artificially during the day because people don't open the doors or turn on and off lights a whole bunch during the day.
My next attempt is going to be to create a state machine that changes state of home or not based on activity detection + door changes. For example, if I detect activity then I know someone is home and someone is home until I detect a door event. Then I go into a timeout mode like above to see if the door event resulted in someone leaving.