Jump to content

need help with variables/programming


Recommended Posts

Posted

ISY user for 10+ years, but have never done advanced programs using variables.  Just the basic stuff.

Looking for assitance on creating a program/variable to help with something.  I've never worked with variables so am clueless.

We have 2 insteon sensors in the garage(front/back garage), that turn on the light when motion is detected..  Here is what I am looking to do.

If either motion sensor detects motion I want the light to come on in garage.

If it is peak power time 3pm to 8pm Monday to Friday I want the light to turn off after 4 minutes.

If non-peak time (other than above) I want light to turn off after 12 mins.

However if someone reenters area and motion is sensed, I want the light to stay on and "time to turn off" restarted. 

In addition I have a keypadlinc. If the B button is on (garage override) I want nothing to turn off.   This would be a override for if I was working in the garage and wanted to make sure the light never turned off.

Any helpful hints?  

Thanks much in advance.

Adam

 

Posted

I don't think you need variables for this application. Here are things I defined that you'll need to substitute:

  • Program1, Program2 & Program3 - name them something meaningful
  • Garage-Motion-Sensor1 & Garage-Motion-Sensor2 - pick the devices you use today
  • Keypad.GarageLight - Pick the keypad . the key you have set up for this today
  • Garage Lights - The actual light switch being turned on and off


Program1: This program handles the main logic. Either motion sensor being activated will reset the timer. You will want to set you motion sensors to On Commands Only  and Transmit Whenever Motion is sensed in the settings... you need to take them down and put them in linking mode (press the set button) if they are not already set this way.

If
        (
             'Garage-Motion-Sensor1' is switched on
          Or 'Garage-Motion-Sensor2' is switched on
        )
    And 'Keypad.GarageLight' Status is Off
 
Then
        Set 'Garage Lights' On
        Run Program 'Program2' (If)
        Wait  12 minutes 
        Set 'Garage Lights' Off
 
Else
   - No Actions - (To add one, press 'Action')

 

Program2: This program handles the 4 minute off at peak times and is called by the first program above. Disable this program (right click on it) so it can only be called by program1 

If
        On Mon, Tue, Wed, Thu, Fri
        From     3:00:00PM
        To       8:00:00PM (same day)
 
Then
        Wait  4 minutes 
        Set 'Garage Lights' Off
        Stop Program 'Program1'
 
Else
   - No Actions - (To add one, press 'Action')

 

Program 3: This program may not be necessary but provides direct control if the keypad is turned on or off. It assumes you want the garage light on when you press it. Note this uses Status and Program1 uses Control. This difference is on purpose.

If
'Keypad.GarageLight' Status is on
 
Then
        Set 'Garage Lights' On
Else
        Set 'Garage Lights' Off
        


Variables can get tricky and sometimes more time needs to be spent figuring out how to get them right. Don't get me wrong, I use them, but I try to avoid and use the ISY's event driven capabilities

Paul

Archived

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

×
×
  • Create New...