| Author |  | 
      
        | narc Groupie
 
  
  
 Joined: November 21 2006
 Location: United States
 Online Status: Offline
 Posts: 49
 | 
          Hey Guys,
           | Posted: February 20 2010 at 13:12 | IP Logged |   |  
           | 
 |  
 I have an Elk M1 Gold and am able to read the Digital I/O zones with it, so I know that it and power home are talking correctly.
 
 I have an Insteon motion sensor that fires a trigger, and the trigger runs a macro. This all works fine. Now I need to bind it to some script or logic of some kind. What I want to do is this:
 
 If ElkState == Armed then
 Turn on InsteonOutput1 for 2 minutes
 Else
 Turn on InsteonOutput2 for 5 minutes
 End if
 
 If Motion is redetected then I want to update the timers so that it is always 2 and 5 minutes after last motion that the devices turn off.
 
 I can not figure out how to do any of the following:
 - The if statement
 - Detect if the Elk is armed
 - Turn on an output for X minutes and update timers on redetect.
 
 Any and all help is appreciated.
 
 - jason
 
 Edited by narc - February 20 2010 at 13:14
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | grif091 Super User
 
  
 
 Joined: March 26 2008
 Location: United States
 Online Status: Offline
 Posts: 1357
 | 
          As for the 2/5 minute interval and extending it, use ph_createtimedevent1 to create a Timed Event for either 2 minutes or 5 minutes which turns off the lights at the end of its time cycle.  This call allows you to define the Timed Event ID.  Subsequent Motion Sensor events can extend the time of an existing Timed Event with a ph_modifytimedevent call.   The Macro turns the devices ON initially, the Timed Event turns the devices OFF.
           | Posted: February 21 2010 at 08:33 | IP Logged |   |  
           | 
 |  
 You can define triggers which fire on ELK state changes.  You would have to keep the latest Armed/Disarmed state in a Global variable and use that to gate whether the Timed Event is set for 2 minutes or 10 minutes.   I do not know if there is a way to directly query the ELK Armed/Disarmed state.  If that capability exists it should be documented in the ELK documents somewhere,
 
 
 __________________
 Lee G
 | 
       
        | Back to Top |     | 
       
       
        |  |