Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Macros, Scripts, and Formulas Repository
 PowerHome Messageboard : PowerHome Macros, Scripts, and Formulas Repository
Subject Topic: ELK Status and State Macros Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
jaysonc
Newbie
Newbie


Joined: October 21 2007
Location: United States
Online Status: Offline
Posts: 26
Posted: November 26 2007 at 11:50 | IP Logged Quote jaysonc

In integrating my ELk with PH I found that I occasionally wanted to have
action take effect when I was leaving or arriving home. It turned out that
only looking at the status (armed, disarmed, etc) was not enough detail. I
found that I needed to also know the sate (full armed, exit timer, etc).
Here are the scripts I created to pull these items into global variables.

Global Variables:

ELK STATUS
ELK STATE

Notes: You will notice that the status macro also calls some additional
macros (ALARM ARMED AWAY, ALARM ARMED VACATION, etc) based
upon if the status has changed. I did not include those macros as they
would be very specific to individual needs. Create them or disable the
calls as required. If you do use them, do not remove the logic check
before the call unless you know why you are removing it. You WILL get
multiple messages for the same state/status. Also, line wrap seems to
have caused embedded carriage returns to be added to some insert
statements. Any you find should be removed.

ELK STATUS MACRO:

insert into macroheader values ('STORE ARM STATUS','Decode Elk Arming
Status',0,0,1);
insert into macrodetail values ('STORE ARM STATUS',1,31,'',NULL,'2',0,'');
insert into macrodetail values ('STORE ARM STATUS',2,1,'STORE ARM
STATE',1,'',0,'');
insert into macrodetail values ('STORE ARM STATUS',3,27,'',NULL,'case
(left("[TEMP5]",1) when "0" then "DISARMED" when "1" then "AWAY" when
"2" then "STAY" when "3" then "STAY_INSTANT" when "4" then "NIGHT"
when "5" then "NIGHT_INSTANT" when "6" then "VACATION")',0,'');
insert into macrodetail values ('STORE ARM STATUS',4,10,'ELK
STATUS',NULL,'"[TEMP5]"',0,'');
insert into macrodetail values ('STORE ARM
STATUS',5,15,'[EMAILNAME]',NULL,'jaysonc@mac.com',0,'');
insert into macrodetail values ('STORE ARM
STATUS',6,15,'[EMAILSUBJECT]',NULL,'Unknown ELK Status Found',0,'');
insert into macrodetail values ('STORE ARM STATUS',7,20,'',NULL,'" System
set to status [TEMP5]"',1,'');
insert into macrodetail values ('STORE ARM STATUS',8,39,'',NULL,'',0,'');
insert into macrodetail values ('STORE ARM
STATUS',9,26,'',NULL,'DISARMED',0,'');
insert into macrodetail values ('STORE ARM STATUS',10,16,'',NULL,'if
(ph_getglobal_s("ELK STATUS") = "Disarmed", 999, 1)',0,'');
insert into macrodetail values ('STORE ARM STATUS',11,10,'ELK
STATUS',NULL,'"Disarmed"',0,'');
insert into macrodetail values ('STORE ARM STATUS',12,1,'ALARM ARMED
DISARMED',1,'',0,'');
insert into macrodetail values ('STORE ARM STATUS',13,39,'',NULL,'',0,'');
insert into macrodetail values ('STORE ARM
STATUS',14,26,'',NULL,'STAY',0,'');
insert into macrodetail values ('STORE ARM STATUS',15,16,'',NULL,'if
(ph_getglobal_s("ELK STATUS") = "Stay Mode", 999, 1)',0,'');
insert into macrodetail values ('STORE ARM STATUS',16,10,'ELK
STATUS',NULL,'"Stay Mode"',0,'');
insert into macrodetail values ('STORE ARM STATUS',17,1,'ALARM AMED
STAY',1,'',0,'');
insert into macrodetail values ('STORE ARM STATUS',18,39,'',NULL,'',0,'');
insert into macrodetail values ('STORE ARM
STATUS',19,26,'',NULL,'STAY_INSTANT',0,'');
insert into macrodetail values ('STORE ARM STATUS',20,16,'',NULL,'if
(ph_getglobal_s("ELK STATUS") = "Stay Instant Mode", 999, 1)',0,'');
insert into macrodetail values ('STORE ARM STATUS',21,10,'ELK
STATUS',NULL,'"Stay Instant Mode"',0,'');
insert into macrodetail values ('STORE ARM STATUS',22,1,'ALARM AMED
STAY',1,'',0,'');
insert into macrodetail values ('STORE ARM STATUS',23,39,'',NULL,'',0,'');
insert into macrodetail values ('STORE ARM
STATUS',24,26,'',NULL,'AWAY',0,'');
insert into macrodetail values ('STORE ARM STATUS',25,16,'',NULL,'if
(ph_getglobal_s("ELK STATUS") = "Away Mode", 999, 1)',0,'');
insert into macrodetail values ('STORE ARM STATUS',26,10,'ELK
STATUS',NULL,'"Away Mode"',0,'');
insert into macrodetail values ('STORE ARM STATUS',27,1,'ALARM ARMED
AWAY',1,'',0,'');
insert into macrodetail values ('STORE ARM STATUS',28,39,'',NULL,'',0,'');
insert into macrodetail values ('STORE ARM
STATUS',29,26,'',NULL,'NIGHT',0,'');
insert into macrodetail values ('STORE ARM STATUS',30,16,'',NULL,'if
(ph_getglobal_s("ELK STATUS") = "Night Mode", 999, 1)',0,'');
insert into macrodetail values ('STORE ARM STATUS',31,10,'ELK
STATUS',NULL,'"Night Mode"',0,'');
insert into macrodetail values ('STORE ARM STATUS',32,1,'ALARM ARMED
NIGHT',1,'',0,'');
insert into macrodetail values ('STORE ARM STATUS',33,39,'',NULL,'',0,'');
insert into macrodetail values ('STORE ARM
STATUS',34,26,'',NULL,'NIGHT_INSTANT',0,'');
insert into macrodetail values ('STORE ARM STATUS',35,16,'',NULL,'if
(ph_getglobal_s("ELK STATUS") = "Night Instant Mode", 999, 1)',0,'');
insert into macrodetail values ('STORE ARM STATUS',36,10,'ELK
STATUS',NULL,'"Night Instant Mode"',0,'');
insert into macrodetail values ('STORE ARM STATUS',37,1,'ALARM ARMED
NIGHT',1,'',0,'');
insert into macrodetail values ('STORE ARM STATUS',38,39,'',NULL,'',0,'');
insert into macrodetail values ('STORE ARM
STATUS',39,26,'',NULL,'VACATION',0,'');
insert into macrodetail values ('STORE ARM STATUS',40,16,'',NULL,'if
(ph_getglobal_s("ELK STATUS") = "Vacation Mode", 999, 1)',0,'');
insert into macrodetail values ('STORE ARM STATUS',41,10,'ELK
STATUS',NULL,'"Vacation Mode"',0,'');
insert into macrodetail values ('STORE ARM STATUS',42,1,'ALARM ARMED
VACATION',1,'',0,'');
insert into macrodetail values ('STORE ARM STATUS',43,39,'',NULL,'',0,'');


ELK STATE MACRO:

insert into macroheader values ('STORE ARM STATE','Decode Elk Arming
State',0,0,1);
insert into macrodetail values ('STORE ARM STATE',1,27,'',NULL,'case
(left("[TEMP10]", 1) when "0" then "NOT_READY" when "1" then "READY"
when "2" then "FORCEABLE" when "3" then "TIMER" when "4" then "FULLY"
when "5" then "FORCED" when "6" then "BYPASSED")',0,'');
insert into macrodetail values ('STORE ARM STATE',2,10,'ELK
STATE',NULL,'"[TEMP10]"',0,'');
insert into macrodetail values ('STORE ARM
STATE',3,15,'[EMAILNAME]',NULL,'jaysonc@mac.com',0,'');
insert into macrodetail values ('STORE ARM
STATE',4,15,'[EMAILSUBJECT]',NULL,'Unknown ELK State Found',0,'');
insert into macrodetail values ('STORE ARM STATE',5,20,'',NULL,'" System
set to state [TEMP10]"',1,'');
insert into macrodetail values ('STORE ARM STATE',6,39,'',NULL,'',0,'');
insert into macrodetail values ('STORE ARM
STATE',7,26,'',NULL,'NOT_READY',0,'');
insert into macrodetail values ('STORE ARM STATE',8,16,'',NULL,'if
(ph_getglobal_s("ELK STATE") = "Not Ready", 999, 1)',0,'');
insert into macrodetail values ('STORE ARM STATE',9,10,'ELK
STATE',NULL,'"Not Ready"',0,'');
insert into macrodetail values ('STORE ARM STATE',10,39,'',NULL,'',0,'');
insert into macrodetail values ('STORE ARM
STATE',11,26,'',NULL,'READY',0,'');
insert into macrodetail values ('STORE ARM STATE',12,16,'',NULL,'if
(ph_getglobal_s("ELK STATE") = "Ready", 999, 1)',0,'');
insert into macrodetail values ('STORE ARM STATE',13,10,'ELK
STATE',NULL,'"Ready"',0,'');
insert into macrodetail values ('STORE ARM STATE',14,39,'',NULL,'',0,'');
insert into macrodetail values ('STORE ARM
STATE',15,26,'',NULL,'FORCEABLE',0,'');
insert into macrodetail values ('STORE ARM STATE',16,16,'',NULL,'if
(ph_getglobal_s("ELK STATE") = "Forecable", 999, 1)',0,'');
insert into macrodetail values ('STORE ARM STATE',17,10,'ELK
STATE',NULL,'"Forecable"',0,'');
insert into macrodetail values ('STORE ARM STATE',18,39,'',NULL,'',0,'');
insert into macrodetail values ('STORE ARM
STATE',19,26,'',NULL,'TIMER',0,'');
insert into macrodetail values ('STORE ARM STATE',20,16,'',NULL,'if
(ph_getglobal_s("ELK STATE") = "Exit Timer", 999, 1)',0,'');
insert into macrodetail values ('STORE ARM STATE',21,10,'ELK
STATE',NULL,'"Exit Timer"',0,'');
insert into macrodetail values ('STORE ARM STATE',22,39,'',NULL,'',0,'');
insert into macrodetail values ('STORE ARM
STATE',23,26,'',NULL,'FULLY',0,'');
insert into macrodetail values ('STORE ARM STATE',24,16,'',NULL,'if
(ph_getglobal_s("ELK STATE") = "Fully Armed", 999, 1)',0,'');
insert into macrodetail values ('STORE ARM STATE',25,10,'ELK
STATE',NULL,'"Fully Armed"',0,'');
insert into macrodetail values ('STORE ARM STATE',26,39,'',NULL,'',0,'');
insert into macrodetail values ('STORE ARM
STATE',27,26,'',NULL,'FORCED',0,'');
insert into macrodetail values ('STORE ARM STATE',28,16,'',NULL,'if
(ph_getglobal_s("ELK STATE") = "Force Armed", 999, 1)',0,'');
insert into macrodetail values ('STORE ARM STATE',29,10,'ELK
STATE',NULL,'"Force Armed"',0,'');
insert into macrodetail values ('STORE ARM STATE',30,39,'',NULL,'',0,'');
insert into macrodetail values ('STORE ARM
STATE',31,26,'',NULL,'BYPASSED',0,'');
insert into macrodetail values ('STORE ARM STATE',32,16,'',NULL,'if
(ph_getglobal_s("ELK STATE") = "Armed with a bypass", 999, 1)',0,'');
insert into macrodetail values ('STORE ARM STATE',33,10,'ELK
STATE',NULL,'"Armed with a bypass"',0,'');
insert into macrodetail values ('STORE ARM STATE',34,39,'',NULL,'',0,'');


Sample PH Trigger:

insert into triggers values ('ELK STATUS MSG','Elk Arming Status
Changes','STORE ARM STATUS',26,'[Elk Controller Name]',5,1,'1',1,0,0);

--
Jayson



__________________
--
Jayson
Back to Top View jaysonc's Profile Search for other posts by jaysonc
 

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