| Author |  | 
      
        | lizaoreo Groupie
 
  
 
 Joined: February 11 2013
 Location: United States
 Online Status: Offline
 Posts: 75
 | 
          Okay, I got my camera set up on the back porch and triggers for motion configured in Blue Iris.  I made a macro in PH to turn the back porch light on for 10 minutes (IE, someone pulled up or opened the door) and setup Blue Iris to run the macro when it detects motion.  After 10 minutes, it turns off the light.
           | Posted: August 26 2013 at 14:23 | IP Logged |   |  
           | 
 |  
 The problem I discovered this week (like 2 days after I set it up) is that when someone is unloading the car or just doing something outside that takes longer than 10 minutes, they trigger the macro (Yay), but they trigger it several times, so then the light comes on, then starts turning off randomly as the 10 minute timers run out.
 
 Is there a way I can do a smart timer so that every time the macro triggers after the initial time it just resets the timer rather than making new ones?
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | dhoward Admin Group
 
  
  
 Joined: June 29 2001
 Location: United States
 Online Status: Offline
 Posts: 4447
 | 
          The way I handle this is to usually do a Jump or Goto Label as the first line of a macro.  Something like:
           | Posted: August 26 2013 at 15:28 | IP Logged |   |  
           | 
 |  
 
 
| Code: 
 
    
    | 
      
       | 10 Goto Label if(ph_ismacrowaiting("YOURMACROID") = 0,"CONTINUE","")
 20 Formula Immediate ph_extendmacrowait("YOURMACROID",10 * 60,0)
 30 End Macro
 40 Label CONTINUE
 50 ...
 
 |  |  |  
 The above was from memory so may need to be checked for accuracy.
 
 Hope this helps,
 
 Dave.
 
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | lizaoreo Groupie
 
  
 
 Joined: February 11 2013
 Location: United States
 Online Status: Offline
 Posts: 75
 | 
          Aha, there are more formulas for macro commands, that was kind of my first path of thought, but I couldn't find the right formula commands.
           | Posted: August 26 2013 at 15:34 | IP Logged |   |  
           | 
 |  
 Thanks Dave
 | 
       
        | Back to Top |     | 
       
       
        |  |