Jump to content

Motion Countdown with Different Delays for Different Times of Day


elgwhoppo

Recommended Posts

Hey all, really enjoying the programming aspect of the ISY994 that I have. I wanted to submit a couple programs that I wrote that are working, but I'm pretty sure are sub-optimal. Looking for any advice to make this easier at scale when I have multiple scenes: 

 

Goal:

 

During evening hours between sunset and 1AM, the 60 minute motion countdown is reset any time there's motion 

During the night hours if there's motion between 1AM and sunrise, bring the lights up to 25% brightness for 3 minutes then turn off

 

This program turns on the light and sets the original countdown plus the counter variables to the 60 minutes. 

 

Downstairs - Evening Motion On - [iD 0007][Parent 0001]

 
If
        Status  'First Floor / Motion #1 Motion' is On
    And From    Sunset  - 30 minutes
        To      12:59:59AM (next day)
 
Then
        Set Scene 'All Downstairs' On
        $Evening_Lamp_Motion_Counter  = 60
        $Evening_Lamp_Original_Number  = 60
 
Else
        Run Program 'Downstairs - Evening Motion Off' (If)
 
This program will turn off the downstairs (called by the else statement above) only if the idle countdown counter is <1. 
 
Downstairs - Evening Motion Off - [iD 0008][Parent 0001]
 
If
        $Evening_Lamp_Motion_Counter < 1
 
Then
        Set Scene 'All Downstairs' Off
 
Else
   - No Actions - (To add one, press 'Action')
 
This program is continually looping all day every day.
 
Downstairs-  Motion Countdown Loop - [iD 0006][Parent 0001]
 
If
        $Evening_Lamp_Motion_Counter > 0
    And Status  'First Floor / Motion #1 Motion' is Off
 
Then
        Wait  1 minute 
        $Evening_Lamp_Motion_Counter -= 1
        Run Program 'Downstairs-  Motion Countdown Loop' (If)
 
Else
        Run Program 'Downstairs - Evening Motion On' (If)
        Wait  1 minute 
        $Evening_Lamp_Motion_Counter  = $Evening_Lamp_Original_Number
        Run Program 'Downstairs-  Motion Countdown Loop' (If)
 
 
This program turns the lights on to 25% between 1AM and sunrise, then turns them off. 
 
Downstairs - Night Motion - [iD 0004][Parent 0001]
 
If
        From     1:00:00AM
        To      Sunrise - 30 minutes (same day)
    And Status  'First Floor / Motion #1 Motion' is On
 
Then
        Set 'First Floor / Lights / Kitchen Sink Light Bulb' 25%
        Set 'First Floor / Lights / Living Room Corner' 25%
        Set 'First Floor / Lights / Play Kitchen' 25%
        Wait  3 minutes 
 
Else
        Set Scene 'All Downstairs' Off
 
 
Seems to be working fine for me, but I'm wondering if I can do this with fewer programs? Doesn't seem there's any way to put an If statement in a then or else without calling another program. 
 
Thanks all!
 
Joe
 
Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...