I was wondering if someone could help me figure out what I'm doing wrong in my programs. The programs should trigger once the last person has left the house, then the goal is to send some notifications at some intervals and eventually turn off lights and devices if no one returns.
My variable $X3 indicates the number of people in the house (works reliably) and $AwayNotified keeps track of whether a notification was sent (to avoid repeat notifications).
When $X3 turns 0 (last person has left the house), I want to send a notification saying that lights will turn off in 15 minutes. If after 15 minutes X3 is still 0, I want to send another message saying lights will turn off in 5 minutes. If after 5 minutes X3 is still 0, the ISY will turn down thermostats, turn off lights and music systems.
My programs are the following (all the Else conditions are empty):
Program Away.S0.Cond (Run at Startup)
If
- No Conditions -
Then
Run Program 'Away.S0.Body' (Then Path)
Program Away.S0.Body
If
- No Conditions -
Then
Run Program 'Away.S1.Body' (Else Path)
Run Program 'Away.S2.Body' (Else Path)
Run Program 'Away.S3.Body' (Else Path)
Program Away.S1.Cond
If
Program 'Away.S0.Body' is True
And $X3 is 0
And $AwayNotified is 0
Then
Run Program 'Away.S1.Body' (Then Path)
Program Away.S1.Body
If
- No Conditions -
Then
Run Program 'Away.S0.Body' (Else Path)
Run Program 'Away.S2.Body' (Else Path)
Run Program 'Away.S3.Body' (Else Path)
Send Notification to 'Default' content 'Absence 1'
Program Away.S2.Cond
If
Program 'Away.S1.Body' is True
And $X3 is 0
And $AwayNotified is 0
Then
Run Program 'Away.S2.Body' (Then Path)
Program Away.S2.Body
If
- No Conditions -
Then
Run Program 'Away.S0.Body' (Else Path)
Run Program 'Away.S1.Body' (Else Path)
Run Program 'Away.S3.Body' (Else Path)
Wait 15 minutes
Send Notification to 'Default' content 'Absence 2'
Program Away.S3.Cond
If
Program 'Away.S2.Body' is True
And $X3 is 0
And $AwayNotified is 0
Then
Run Program 'Away.S3.Body' (Then Path)
Program Away.S3.Body
If
- No Conditions -
Then
Run Program 'Away.S0.Body' (Else Path)
Run Program 'Away.S1.Body' (Else Path)
Run Program 'Away.S2.Body' (Else Path)
Wait 5 minutes
Resource 'DenonPwrOff'
Resource 'SonosMBRStop'
Resource 'SonosMediaRoomStop'
Resource 'SonosLivRoomStop'
Resource 'TStatOffice Away'
Resource 'TStatUpstairs Away'
$AwayNotified = 1
Run Program 'Away.S0.Body' (Then Path)
Program Away.Notified.Reset
If
$X3 > 0
And $AwayNotified is 1
Then
$AwayNotified = 0
Currently, what happens when $X3 turns 0 is that S2Body runs and ends but S3Body does not run. I'd appreciate any tips. Thanks.