more G-Labs products

Author Topic: Security Alarm Trigger Programs - correct program structure templates?  (Read 1401 times)

January 05, 2016, 03:31:53 PM
Read 1401 times

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
I want to use the Security Alarm System options to call a new program of mine called SendStatusText.   Previously I have been tweaking the Security code but I am tired of re-doing that every time I change HG.

This program should only run when called directly from Security or maybe some other places I'll add in the future.  SendStatusText works when I recompile it (it sends me email with camera image attachment, status of alarm, IP address, etc).

When I add either the program id (1001) or the program name (SendStatusText) into the three Security options for armed program, disarmed program and triggered program; SendStatusText does not send the text as it normally does when I  recompile it.

My SendStatusText program Startup Code has only
Code: [Select]
Program.Run();
//tried return true; also but I think this is deprecated?

The Program Code has
Code: [Select]
//code to get ip, image, send text which works on recompile
Program.GoBackground();  //commenting this out causes program to infinite loop and flood of emails :-(

So what is the correct structure of a program for this usage?  I have tried reading through docs but either missed it, not enough detail, or I just don't understand :-)
« Last Edit: January 07, 2016, 02:08:44 PM by kevin1 »

January 07, 2016, 02:04:36 PM
Reply #1

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
Still no luck with this.  Is this documented somewhere what is required for latest HG versions? Would be great if someone could post "templates" of required calls for various types of programs (startup and program):

-Execute one time (for calling with security or another Program.Run() )
-Infinite looping with delay
-Monitoring for events

For each of these cases where to place Program.Run, Background, etc...

Thanks!!!

January 18, 2016, 09:15:25 PM
Reply #2

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
bump... :-)  any ideas why this doesn't work?  If I compile the program (id 1001) it sends the email.  But when I arm/disarm/trigger security it doesn't appear to execute the program 1001 (no email received).




March 24, 2016, 01:34:24 AM
Reply #3

mchias13

  • **
  • Information
  • Jr. Member
  • Posts: 45
did you figure this out?  I think I'm having a similar issue and lost on how to get code to come back from the background.

March 24, 2016, 02:03:52 PM
Reply #4

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
No, but I haven't messed with it since last post.