Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Take action after time if armed Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
narc
Groupie
Groupie
Avatar

Joined: November 21 2006
Location: United States
Online Status: Offline
Posts: 49
Posted: February 20 2010 at 13:12 | IP Logged Quote narc

Hey Guys,

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 View narc's Profile Search for other posts by narc
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: February 21 2010 at 08:33 | IP Logged Quote grif091

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.

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 View grif091's Profile Search for other posts by grif091
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum