Haiku HH push notifications only when OPII armed?

pct88

Member
I have set up Haiku Helper to push notifications to my iPhone whenever there is motion detected from the perimeter detectors on my Omni Pro II.  Now that the weather is warm I would like to add code to limit these notifications to be sent only when the OPII is armed-  otherwise yard work leads to endless notifications that are not of concern.
 
I am capable of modifying existing code, but making more significant changes is a bit beyond my experience level.  Presumably it is something like this?
if(zone.number==24) && SystemArmedStatus == armed
 
Thanks!
 
 
function onZoneNotReady(zone) {
 
if(zone.number == 24) { // Match Driveway Cartel vehicle detector
helper.sendNotification(controller, zone.bestDescription + ' vehicle detected.');}
 
else if(zone.number == 11) { // Match Street Side PIR
helper.sendNotification(controller, zone.bestDescription + ' motion detected.');}
 
else if(zone.number == 12) { // Match Patio Side PIR
helper.sendNotification(controller, zone.bestDescription + ' motion detected.');}
}
 
This is probably what you are looking for:
 
 
Code:
else if(zone.number == 24 && controller.areaWithNumber(1).mode > 0) {
   // ...
}
or if you want to use it in a few places:
Code:
// Add the line below before the first "if" statement
var mode = controller.areaWithNumber(1).mode;

else if(zone.number == 24 && mode > 0) {
   // ...
}
 
Thanks Maksim-  thanks for your assistance.  For anyone who may be interested this is my code:
 
 
//Last updated May 15, 2014
//
var ZoneTimerPorchPIR = null;
var ZoneTimerDoorbell = null;
 
function onAreaArm(area) { //Pause iTunes when alarm system is armed
     helper.executeAppleScript(controller,'tell application "iTunes" to pause');}
 
function onAreaDisarm(area) { //Resume iTunes when alarm system is disarmed
     helper.executeAppleScript(controller,'tell application "iTunes" to play');}
 
function onZoneNotReady(zone) {
     var mode = controller.areaWithNumber(1).mode;
 
if(zone.number == 10 && ZoneTimerPorchPIR == null && mode > 0) { // Match Front Porch PIR if timer=null, then wait 1 minute after first trip to "debounce" for people standing on porch waiting
     helper.sendNotification(controller, zone.bestDescription + ' motion.');
     ZoneTimerPorchPIR = setTimeout(function(){ZoneTimerPorchPIR = null}, 60*1000);}
 
else if(zone.number == 14  && mode < 1 ) { // Match Doorbell and if OPII is disarmed indicate routine activation
     helper.sendNotification(controller, zone.bestDescription + ' rung while disarmed.');
 
else if(zone.number == 14 && mode > 0) { // Match Doorbell and if OPII is in any armed mode, indicate that in notification, if timer=null, then wait 90 seconds after first ring to ignore multiple rings
     helper.sendNotification(controller, zone.bestDescription + ' rung while SYSTEM ARMED.');
     ZoneTimerDoorbell = setTimeout(function(){ZoneTimerDoorbell = null}, 90*1000);}
 
else if(zone.number == 24) { // Match Driveway Cartel vehicle detector
     helper.sendNotification(controller, zone.bestDescription + ' vehicle detected.');}
 
else if(zone.number == 11 && mode > 0) { // Match Hamilton Ave Side PIR
     helper.sendNotification(controller, zone.bestDescription + ' motion detected.');}
 
else if(zone.number == 23 && mode > 0) { // Match Screen Porch Door East
     helper.sendNotification(controller, zone.bestDescription + ' door opened.');}
}
 
Back
Top