pingmustard Newbie
Joined: September 13 2010
Online Status: Offline Posts: 18
|
Posted: September 05 2012 at 02:25 | IP Logged
|
|
|
Hi all, I'm trying to setup a custom security system module based on time, motion, and audible alarm, and gps. I'm currently poking and playing around with macros/formulas/integration with PH via web server. I'm looking to bump some ideas and solutions and hopefully steer me away me from a deadend scenario. For equipment I have insteon motion sensors, light switches, and appliance module that can turn horn on/off. All are insteon devices.
The general idea/goals:
1. Setup motion sensor so that first floor ( family sleeps upstairs) has sensors that activate and will trigger alarm if motion detected AND
A. Time is between 11pm and 5 am,
B. or if everyone is out of the house
2. When alarm activated
A. Send email/SMS
B. blink lights on first floor for 5 minutes
C. Activate alarm by turning on appliance for 30 minute
3. To deactivate alarm, press any light switch in a secretive order ( eg on off on on within 5 seconds)
A. Should also be ale to deactivate alarm remotely via phone
4. (Added after asking Dave): When alarm is initially triggered, play something audible so user is aware alarm activation is pending. Is it possible to playback this only on remote speakers on a specific playback device/ card? or possibly run TTS only via these remote speakers?
5. (added after asking dave): How to possibly integrate with existing Revo security cameras? Since this system isn't actually based on IP camera, I'm wondering what sort of integration with PH I could possibly do? Has anyone else ventured down this route?
I also have some android Phones whereby I can detect locale changes and would like to communicate this information to ph. What is the easiest way to bridge this. Some idea I had was maybe invoke message to the ph web server, or tcp socket. One of the design decision would be to Minimize having to modify the android app as it would definitely take more time to redeploy.
Thanks!
Ben
Dave's much appreciated response in case others want to see :)
------------------------
To handle your custom alarm, I would break it down into component parts. The first thing I would do is create a total of 3 global variables. One of them would be something like NIGHTTIME and I would have a couple of timed events at 11pm and 5am that changes this global. The 11pm timed event changes the NIGHTTIME global to 1 and the 5am timed event changes the NIGHTTIME global to 0. This will make it easier for you to compare rather than doing time comparisions in multiple places and also makes it easy to adjust the times it you like. The second global would be OCCUPIED and would be 1 when people are home and 0 when people are gone. You didnt provide any details on how to determine if anyone is home so you would need to come up with the appropriate events to set this global. The last global is basically a flag that is set when the alarm is activated and also used to shut the alarm off early. I would call this global ALARMACTIVE and initially set it to 0.
Next, I would create a macro called ACTIVATEALARM. The macro would look something like this:
10 Jump if(ph_ismacrowaiting("ACTIVATEALARM") > 0,999,1)
20 Formula Immediate ph_sendsmtpemail(...use an email that corresponds to your SMS devices
30 Device Control INSTEON+your alarm ID+ON
40 Set System [LOCAL1] now()
50 Label LOOP1
60 Goto Label if(ph_getglobal_n("ALARMACTIVE") = 0,"ALARMOFF","")
70 Device Control INSTEONGROUP+your light ID+ON
80 Wait 1
90 Device Control INSTEONGROUP+your light ID+OFF
100 Wait 1
110 Goto Label if(ph_secondsdiff(ph_getvar_t(1,1),now()) < 300,"LOOP1","")
120 Wait 25 * 60
130 Label ALARMOFF
140 Set Global ALARMACTIVE 0
In line 70 and 80, I would use an Insteon group command rather than a direct command since these are quicker as they're not acknowledged.
Next, I would create a trigger on global variable ALARMACTIVE. In the action, if the global is changed to 1, then launch the above macro. If the global is changed to 0, then issue a ph_killmacrowaiting("ACTIVATEALARM") + ph_insteon("your alarm id",ioff,0)
The next thing you need to do is create triggers for your first floor Insteon motion sensors. You can put this in the boolean field:
if(ph_getglobal_n("NIGHTTIME") = 1 or ph_getglobal_n("OCCUPIED") = 0,1,0)
The action for the trigger would be to change the global variable ALARMACTIVE to 1 (which through a cascade effect will file the trigger on the ALARMACTIVE global which will cause the macro to run).
Now all you need is to be able to change the ALARMACTIVE global via a phone. This can be done via the built in webserver or you could create a CC button, etc. You also want to disarm on a sequence of Insteon light buttons. Lots of ways to do this but I would have a global that stores a sequence of events. Create triggers for each of your light buttons so that an on for light 1 appends a 1 to the global. An off for light 1 appends a 2. An on for light 2 appends a 3, an off appends a 4. An on for light 3 appends a 5, an off appends a 6, etc. Create a trigger on the global and check to see if it equals your sequence (for example 121421) and if it does, change the ALARMACTIVE global to 0. You would probably also need a global to track the time of the last keypress so if the keystroke didnt come in within a certain time, you would blank the global.
For your GPS to your android phones, simplest would probably be for them to invoke a custom PHP webpage (if the Android GPS program can do that). This custom PHP page could then set a global which could in turn fire a trigger, etc.
Hope this helps.
PS. I would also ask these questions on the PH forum. You'll get some other opinions as well.
Dave.
|