Security Script

Posted on
Thu May 12, 2011 12:00 am
Brandt offline
User avatar
Posts: 414
Joined: Dec 24, 2008
Location: Mission Viejo, CA

Security Script

I'm trying to setup the indigo security script:
http://www.schollnick.net/wordpress/hom ... ty-script/

It says they execute Action Groups, but action groups don't have conditions! I need conditions!

Also if I could have an Action Group execute a Trigger which does have conditions, What should the trigger type be set to? And how to you have multiple conditions (ANDing conditions) such as ifDark AND Security_Status equals Disarmed? And how do you start a timer to turn a light off when the timer runs out?

Indigo 7 w/ Dual-Band 2413U PLM
macOS High Sierra 10.13.x
2011 iMac 3.4 GHz Intel Core i7

Posted on
Thu May 12, 2011 4:28 am
bschollnick2 offline
Posts: 1355
Joined: Oct 17, 2004
Location: Rochester, Ny

Re: Security Script

pomprocker wrote:
I'm trying to setup the indigo security script:
http://www.schollnick.net/wordpress/hom ... ty-script/

It says they execute Action Groups, but action groups don't have conditions! I need conditions!

Also if I could have an Action Group execute a Trigger which does have conditions, What should the trigger type be set to? And how to you have multiple conditions (ANDing conditions) such as ifDark AND Security_Status equals Disarmed? And how do you start a timer to turn a light off when the timer runs out?


Good questions...

The security script doesn't have incorporated into it a concept of conditions, as it stands.... But the Security Script doesn't have to use Action Groups. You can specify the specific device, and use conditions on that... Assuming that you only want to control a single device...

Are there particular conditions you would like to see, I am starting to design out the next big leap onto Indigo 5, and that would help me add that into it.

You can start a time, by changing the Timer's variable to a number.. Eg Setting Dinner_timer to 600 gives you 5 minutes... Setting it to 0 stops it.

------
My Plugins for Indigo (v4, v5, and v6) - http://bit.ly/U8XxPG

Security Script for v4 - http://bit.ly/QTgclf
for v5 - http://bit.ly/T6WBKu

Support Forum(s) - http://www.perceptiveautomation.com/userforum/viewforum.php?f=33

Posted on
Thu May 12, 2011 10:27 am
Brandt offline
User avatar
Posts: 414
Joined: Dec 24, 2008
Location: Mission Viejo, CA

Re: Security Script

Hi Benjamin,

I'm still very new to Indigo and Insteon, but have had an established home automation system for some time now using Heyu and X10. That being said I can't really start slowly, I have to get everything setup quickly in order to migrate 100%.

I was previously using my DS10a's and MS10a's mostly to control devices. As far as security goes, I never bothered to purchase and setup a security console such as the DS7000 or SC1200, so I had done it all in code to emulate the DS7000 algorithms.

I'm going to go ahead and post some examples of my Heyu scripts regarding these security devices with an explanation of what each one does, and maybe you can help me translate them for use with Indigo and at the same time get a glance of the capabilities of what another HA software system can do and maybe any areas that Indigo or the security script may be lacking.

Here is the format for a Heyu script in the configuration file to assist in reading them:
SCRIPT [-l label] <launch conditions> :: [options] <command line>

<launch conditions> tell Heyu under what conditions the script is to be
launched.

The symbol '::' (two colons) is mandatory, to tell Heyu when the list
of launch conditions ends and the command line begins.

When a script is launched, Heyu provides additional environment vari-
ables containing information from Heyu's record of the state of each
module, plus a few other variables to simplify writing the script. The
script options allow some variation in the type and format of these
environment variables.


Thanks in advance!

Code: Select all
[b]# You have to map the security codes to a house/unit code[/b]

# D - Door & Window Sensors DS10a
alias front_door D1 DS10A 0x9F
alias sliding_glass_door D2 DS10A 0x93
alias laundry_door D3 DS10A 0xE9
alias left_livingroom_window D4 DS10A 0x25
alias right_livingroom_window D5 DS10A 0xF5
alias kitchen_window D6 DS10A 0x1B
alias kitchen_dining_window D7 DS10A 0x11
alias michaels_window D8 DS10A 0x13
alias lynns_window D9 DS10A 0x8F
alias brandts_window D10 DS10A 0xA7
alias melanies_window D11 DS10A 0xB7
alias all_sec_doors_windows D1-11
alias brandts_door D12 DS10A 0x99

# E - Emergency (Security) MS10a's, KR10a's, etc...
alias sec_brandt_keyfob E1 KR10A 0x75
alias sec_lynn_keyfob E2 KR10A 0xA1
alias sec_michael_keyfob E3 KR10A 0xC0
alias sec_all_keyfobs E1-3
alias sec_motion_dining E4 MS10A 0x91
alias sec_motion_livingroom E5 MS10A 0xDC
alias sec_motion_upstairs E6 MS10A 0x10
alias all_sec_motion E4-6

[b]# Sometimes a flag is needed[/b]
# Flag Usage
# flag 1: Security Scripts

[b]# A timer is also needed[/b]
# Timer Usage
# timer 1: Security Scripts
...
# timer 6: Brandt's Room

[b]# DS10a on my bedroom door
script launch conditions (all must be true): alert received, it is night, would change the status (to avoid heartbeats triggering script), and rcva (received over RF w800usb)
action1: If I'm not sleeping then turn on the bedroom lamp and set a timer for 4 minutes;
action2: if I am sleeping then only turn on the lava lamp and set a timer for 4 minutes;
[/b]
# Brandt's Room
SCRIPT brandts_door alert night changed rcva :: ([ $(($x10_brandt_sleep & $isOff)) -ne 0 ] && heyu "on bed_lamp; settimer 6 4:00";
([ $(($x10_brandt_sleep & $isOn)) -ne 0 ] && heyu "on lava_lamp; settimer 6 4:00"
...
# later I have a timeout script which turns the either the bedroom light off, or lava lamp off depending...



################### Security Scripts ####################################

# Functionality for KR10a lighting buttons
SCRIPT sec_all_keyfobs slightson rcva :: heyu allon C    # all lights on to house code C
SCRIPT sec_all_keyfobs slightsoff rcva :: heyu alloff C   # all off on house code C

[b]# This script has multiple sets of launch conditions separated by semi-colons, sort of like an OR between them. So that either a DS10a Alert, MS10a Alert, or KR10a Panic can set off the alarm[/b]
#Script to set off alarm. flag1 is to indicate that the alarm has been activated.
SCRIPT all_sec_doors_windows alert armed rcva notflag1; all_sec_motion alert armed rcva notflag1; sec_all_keyfobs panic rcva notflag1 :: @setflag 1; @settimer 1 4:00; echo $X10_DateString $X10_Function $X10_UnitAlias | mail -s "Alert at home!" 1234567890@txt.att.net; heyu allon C; heyu launch alarm

# **************************Need to make sure that a disarm from the command line works as well.*******
# Add disarm to launch condition per requirement.
SCRIPT sec_all_keyfobs panic disarm rcva flag1; -timeout timer1 :: @clrflag 1; @settimer 1 0

[b]# alarm is the label, this script only executes if flag 1 is set, then it calls the blinker scene with house code O (outside devices), and launches itself again and again until flag1 is unset.[/b]
# Specify script as a -exec script or else it's an error
SCRIPT -l alarm -exec flag1 :: heyu blinker O; heyu launch alarm

# Sensor low-battery or failure notifications
[b]# Send DS10a inactivity to a log since this is frequent.[/b]
SCRIPT all_sec_doors_windows inactive rcva :: heyu show sen | grep -i $X10_UnitAlias >> /var/log/heyu/inactive.log
[b]# Send MS10a inactivity to my email since this is less frequent[/b]
SCRIPT all_sec_motion inactive rcva :: heyu show sen | grep -i $X10_UnitAlias | mail -s "Sensor Failure!" myemail@host.com
[b]# Send low-battery alerts to me as a text message[/b]
SCRIPT all_sec_motion alert clear lobat rcva; all_sec_doors_windows alert clear lobat rcva :: echo $X10_DateString $X10_Function $X10_UnitAlias | mail -s "Low Battery!" 1234567890@txt.att.net

[b]# includes the house code specified when calling it which includes a powerhorn and outside lights[/b]
# Add a sleep after each command to allow time to listen for a disarm command.
SCENE blinker allon $1; sleep .7; alloff $1; sleep .7; allon $1; sleep .7; alloff $1; sleep .7

# Powerhorn siren - This scene deprecated. Combined with blinker scene
#SCENE siren on powerhorn; off powerhorn; on powerhorn; off powerhorn
############### end Security Scripts ############################

Indigo 7 w/ Dual-Band 2413U PLM
macOS High Sierra 10.13.x
2011 iMac 3.4 GHz Intel Core i7

Posted on
Thu May 12, 2011 8:29 pm
Brandt offline
User avatar
Posts: 414
Joined: Dec 24, 2008
Location: Mission Viejo, CA

Re: Security Script

What does this error mean?


Code: Select all
  Error               script error: in file "Security Script v4_03.scpt"
  Error               script error: Invalid date and time date 0 of «script». (-30720)
  Error               error dispatching event to attachment script (-1753)

Indigo 7 w/ Dual-Band 2413U PLM
macOS High Sierra 10.13.x
2011 iMac 3.4 GHz Intel Core i7

Posted on
Fri May 13, 2011 3:47 am
bschollnick2 offline
Posts: 1355
Joined: Oct 17, 2004
Location: Rochester, Ny

Re: Security Script

pomprocker wrote:
What does this error mean?


Code: Select all
  Error               script error: in file "Security Script v4_03.scpt"
  Error               script error: Invalid date and time date 0 of «script». (-30720)
  Error               error dispatching event to attachment script (-1753)


There was a bug in the early versions of the v4 Security script, which would mangle the last triggered data/time for a security device.

Take a look in your Variables, and see if you see an 0, for <devicename>_last_updated.... You will need to check them all. If so, just change the variable to be blank...

That should solve it.

Feel free to grab an updated version of the Security Script from my website @ http://www.schollnick.net/wordpress

------
My Plugins for Indigo (v4, v5, and v6) - http://bit.ly/U8XxPG

Security Script for v4 - http://bit.ly/QTgclf
for v5 - http://bit.ly/T6WBKu

Support Forum(s) - http://www.perceptiveautomation.com/userforum/viewforum.php?f=33

Posted on
Fri May 13, 2011 9:27 am
Brandt offline
User avatar
Posts: 414
Joined: Dec 24, 2008
Location: Mission Viejo, CA

Re: Security Script

Hi sorry to say, but I was using v4.03. Although it did go away on it's own after an hour or so of first using it, not sure it that helps or not.


-Brandt

Indigo 7 w/ Dual-Band 2413U PLM
macOS High Sierra 10.13.x
2011 iMac 3.4 GHz Intel Core i7

Posted on
Fri May 13, 2011 10:39 am
bschollnick2 offline
Posts: 1355
Joined: Oct 17, 2004
Location: Rochester, Ny

Re: Security Script

pomprocker wrote:
Hi Benjamin,

I'm still very new to Indigo and Insteon, but have had an established home automation system for some time now using Heyu and X10. That being said I can't really start slowly, I have to get everything setup quickly in order to migrate 100%.

I was previously using my DS10a's and MS10a's mostly to control devices. As far as security goes, I never bothered to purchase and setup a security console such as the DS7000 or SC1200, so I had done it all in code to emulate the DS7000 algorithms.

I'm going to go ahead and post some examples of my Heyu scripts regarding these security devices with an explanation of what each one does, and maybe you can help me translate them for use with Indigo and at the same time get a glance of the capabilities of what another HA software system can do and maybe any areas that Indigo or the security script may be lacking.


# D - Door & Window Sensors DS10a
alias front_door D1 DS10A 0x9F
alias sliding_glass_door D2 DS10A 0x93
alias laundry_door D3 DS10A 0xE9
alias left_livingroom_window D4 DS10A 0x25
alias right_livingroom_window D5 DS10A 0xF5
alias kitchen_window D6 DS10A 0x1B
alias kitchen_dining_window D7 DS10A 0x11
alias michaels_window D8 DS10A 0x13
alias lynns_window D9 DS10A 0x8F
alias brandts_window D10 DS10A 0xA7
alias melanies_window D11 DS10A 0xB7
alias all_sec_doors_windows D1-11
alias brandts_door D12 DS10A 0x99

# E - Emergency (Security) MS10a's, KR10a's, etc...
alias sec_brandt_keyfob E1 KR10A 0x75
alias sec_lynn_keyfob E2 KR10A 0xA1
alias sec_michael_keyfob E3 KR10A 0xC0
alias sec_all_keyfobs E1-3
alias sec_motion_dining E4 MS10A 0x91
alias sec_motion_livingroom E5 MS10A 0xDC
alias sec_motion_upstairs E6 MS10A 0x10
alias all_sec_motion E4-6
[/code]


The Security script uses (currently) an array of records...
Each record looks like this:

{113, "WorkRoom_Door2", false, false, "Sound Chime", false, false, false, false}, ¬

Sadly the Heyu scripts are just that, scripts, and don't have a direct equivalent in Indigo, but in Indigo v5 I plan to make a lot of the security script redundant, so that it's easier for the user to setup...

But, we'll see what information we can get from your script...

alias front_door D1 DS10A 0x9F

I am assuming 0x9F is the hex code for the security device, so that would be roughly equivalent to:

{159, "Front_Door", False, False, None, False, False, True, "Front_Door"}

The security script monitors for the DS10A / MS10A devices directly, so it doesn't rely on the X10 code...

From there, you can either add Group actions in the Indigo GUI, or specific triggers to Indigo depends on the status change(s) of the devices.

Sadly, there isn't a converter, or an import facility at this time, so I don't have a way to bulk convert these for you....

------
My Plugins for Indigo (v4, v5, and v6) - http://bit.ly/U8XxPG

Security Script for v4 - http://bit.ly/QTgclf
for v5 - http://bit.ly/T6WBKu

Support Forum(s) - http://www.perceptiveautomation.com/userforum/viewforum.php?f=33

Posted on
Fri May 13, 2011 11:02 am
Brandt offline
User avatar
Posts: 414
Joined: Dec 24, 2008
Location: Mission Viejo, CA

Re: Security Script

No big deal I'll get it eventually. Just getting through the learning curve of Indigo itself right now.

Indigo 7 w/ Dual-Band 2413U PLM
macOS High Sierra 10.13.x
2011 iMac 3.4 GHz Intel Core i7

Posted on
Fri Jul 15, 2011 10:20 pm
Brandt offline
User avatar
Posts: 414
Joined: Dec 24, 2008
Location: Mission Viejo, CA

Re: Security Script

I'm trying to create a control page using the Script....how do I set Armed Home and Armed away? it looks like 4.03 only handles Armed or Disarmed for the Security_Status variable.

Indigo 7 w/ Dual-Band 2413U PLM
macOS High Sierra 10.13.x
2011 iMac 3.4 GHz Intel Core i7

Posted on
Sat Jul 16, 2011 5:39 am
bschollnick2 offline
Posts: 1355
Joined: Oct 17, 2004
Location: Rochester, Ny

Re: Security Script

pomprocker wrote:
I'm trying to create a control page using the Script....how do I set Armed Home and Armed away? it looks like 4.03 only handles Armed or Disarmed for the Security_Status variable.


Currently the security script doesn't distinguish from Armed Home / Armed Away.

Part of my rationale there is that unless you have an siren or some interactive nature in the security system, I couldn't figure a reason to distinguish between the two.

If you don't mind me asking, what do you plan to do differently if the alarm is tripped when you're home? And when you're away?

I'll put that on the list for the Indigo 5 rewrite... Currently I am waiting for the next beta of Indigo, which hopefully will include the last few pieces that I need...

------
My Plugins for Indigo (v4, v5, and v6) - http://bit.ly/U8XxPG

Security Script for v4 - http://bit.ly/QTgclf
for v5 - http://bit.ly/T6WBKu

Support Forum(s) - http://www.perceptiveautomation.com/userforum/viewforum.php?f=33

Posted on
Sat Jul 16, 2011 11:13 am
Brandt offline
User avatar
Posts: 414
Joined: Dec 24, 2008
Location: Mission Viejo, CA

Re: Security Script

When a system is armed home, only the door and window sensors trigger the alarm. When a system is armed away, the door/window and indoor motion sensors trigger the alarm....

By the way, On your website all I see is release notes for version 4. Where is the full documentation? How do I actually setup the system to alarm and all that?

Indigo 7 w/ Dual-Band 2413U PLM
macOS High Sierra 10.13.x
2011 iMac 3.4 GHz Intel Core i7

Posted on
Sat Jul 16, 2011 4:55 pm
bschollnick2 offline
Posts: 1355
Joined: Oct 17, 2004
Location: Rochester, Ny

Re: Security Script

pomprocker wrote:
When a system is armed home, only the door and window sensors trigger the alarm. When a system is armed away, the door/window and indoor motion sensors trigger the alarm....

By the way, On your website all I see is release notes for version 4. Where is the full documentation? How do I actually setup the system to alarm and all that?


Currently, once you have finished the installation steps, all you need to do is customize it in the Applescript (Security script).

Take a look in the applescript, and the comments inside run down all the options...

There is going to be major changes in the Indigo v5 version of the security script, removing all applescript components, and making a nice User interface, once all of the needed functionality is available in Indigo v5...

My expectation is that within the next month or so, I will be able to have a public beta available...

------
My Plugins for Indigo (v4, v5, and v6) - http://bit.ly/U8XxPG

Security Script for v4 - http://bit.ly/QTgclf
for v5 - http://bit.ly/T6WBKu

Support Forum(s) - http://www.perceptiveautomation.com/userforum/viewforum.php?f=33

Posted on
Tue Jul 19, 2011 7:14 pm
Brandt offline
User avatar
Posts: 414
Joined: Dec 24, 2008
Location: Mission Viejo, CA

Re: Security Script

I've been seeing this in my log in v5b6:

Error script error: in file "Security Script v4_03.scpt"
Error script error: «script» doesn’t understand the str message. (-1708)
Error error dispatching event to attachment script (-1753)

Indigo 7 w/ Dual-Band 2413U PLM
macOS High Sierra 10.13.x
2011 iMac 3.4 GHz Intel Core i7

Posted on
Tue Jul 19, 2011 7:45 pm
bschollnick2 offline
Posts: 1355
Joined: Oct 17, 2004
Location: Rochester, Ny

Re: Security Script

pomprocker wrote:
I've been seeing this in my log in v5b6:

Error script error: in file "Security Script v4_03.scpt"
Error script error: «script» doesn’t understand the str message. (-1708)
Error error dispatching event to attachment script (-1753)


That's strange.... Have you made any changes to the Security Script configuration recently?

Can you email (benjamin AT schollnick DOT net) me your Security Script? I would like to see what your configuration is...

------
My Plugins for Indigo (v4, v5, and v6) - http://bit.ly/U8XxPG

Security Script for v4 - http://bit.ly/QTgclf
for v5 - http://bit.ly/T6WBKu

Support Forum(s) - http://www.perceptiveautomation.com/userforum/viewforum.php?f=33

Posted on
Tue Jul 26, 2011 10:04 am
Brandt offline
User avatar
Posts: 414
Joined: Dec 24, 2008
Location: Mission Viejo, CA

Re: Security Script

I had emailed you the script, and never heard back from you.

Indigo 7 w/ Dual-Band 2413U PLM
macOS High Sierra 10.13.x
2011 iMac 3.4 GHz Intel Core i7

Who is online

Users browsing this forum: No registered users and 4 guests