Rule to arm/disarm Ademco Security Panel

Tags: #<Tag:0x00007f616fef08a8>

I am a beginner and have setup openHAB2 and installed a binding for Alarmdecoder. I created alarmdecoder.items file with the following code that I copied from https://github.com/openhab/openhab1-addons/wiki/AlarmDecoder-binding

Group gPanel "alarm panel" (All)

Number alarmPanelStatusRaw	    "panel status: [%d]" (gPanel)  	  {alarmdecoder="KPM:00#status"}
Number alarmPanelStatusReady	    "panel ready: [%d]" (gPanel) 	  {alarmdecoder="KPM:00#status,bit=17"}
Number alarmPanelStatusAway	    "panel away: [%d]" (gPanel) 	  {alarmdecoder="KPM:00#status,bit=16"}
Number alarmPanelStatusHome	    "panel home: [%d]" (gPanel) 	  {alarmdecoder="KPM:00#status,bit=15"}
Number alarmPanelStatusBacklight    "panel backlight: [%d]" (gPanel) 	  {alarmdecoder="KPM:00#status,bit=14"}
Number alarmPanelStatusProgramming  "panel programming: [%d]" (gPanel) 	  {alarmdecoder="KPM:00#status,bit=13"}

Number alarmPanelStatusBypass	    "panel bypassed: [%d]" (gPanel) 	  {alarmdecoder="KPM:00#status,bit=9"}
Number alarmPanelStatusPower	    "panel on AC: [%d]" (gPanel) 	  {alarmdecoder="KPM:00#status,bit=8"}
Number alarmPanelStatusChime	    "panel chime: [%d]" (gPanel) 	  {alarmdecoder="KPM:00#status,bit=7"}
Number alarmPanelStatusAlarmOccured "panel alarm occurred: [%d]" (gPanel)  {alarmdecoder="KPM:00#status,bit=6"}
Number alarmPanelStatusAlarm	    "panel alarm sounding: [%d]" (gPanel)  {alarmdecoder="KPM:00#status,bit=5"}
Number alarmPanelStatusBatteryLow   "panel battery low: [%d]" (gPanel)     {alarmdecoder="KPM:00#status,bit=4"}
Number alarmPanelStatusDelay	    "panel delay off: [%d]" (gPanel)  	  {alarmdecoder="KPM:00#status,bit=3"}
Number alarmPanelStatusFire	    "panel fire: [%d]" (gPanel)  	  {alarmdecoder="KPM:00#status,bit=2"}
Number alarmPanelStatusZoneIssue    "panel zone issue: [%d]" (gPanel)  	  {alarmdecoder="KPM:00#status,bit=1"}
Number alarmPanelStatusArmedStay    "panel armed stay: [%d]" (gPanel)  	  {alarmdecoder="KPM:00#status,bit=0"}

Contact alarmPanelContactReady	    "panel ready: [%d]" (gPanel) 	  {alarmdecoder="KPM:00#contact,bit=17"}
Contact alarmPanelContactAway	    "panel away: [%d]" (gPanel) 	  {alarmdecoder="KPM:00#contact,bit=16"}
Contact alarmPanelContactHome	    "panel home: [%d]" (gPanel) 	  {alarmdecoder="KPM:00#contact,bit=15"}
Contact alarmPanelContactBacklight    "panel backlight: [%d]" (gPanel) 	  {alarmdecoder="KPM:00#contact,bit=14"}
Contact alarmPanelContactProgramming  "panel programming: [%d]" (gPanel)   {alarmdecoder="KPM:00#contact,bit=13"}
Contact alarmPanelContactBypass	    "panel bypassed: [%d]" (gPanel) 	  {alarmdecoder="KPM:00#contact,bit=9"}
Contact alarmPanelContactPower	    "panel on AC: [%d]" (gPanel) 	  {alarmdecoder="KPM:00#contact,bit=8"}
Contact alarmPanelContactChime	    "panel chime: [%d]" (gPanel) 	  {alarmdecoder="KPM:00#contact,bit=7"}
Contact alarmPanelContactAlarmOccured "panel alarm occurred: [%d]" (gPanel)  {alarmdecoder="KPM:00#contact,bit=6"}
Contact alarmPanelContactAlarm	    "panel alarm sounding: [%d]" (gPanel)  {alarmdecoder="KPM:00#contact,bit=5"}
Contact alarmPanelContactBatteryLow   "panel battery low: [%d]" (gPanel)     {alarmdecoder="KPM:00#contact,bit=4"}
Contact alarmPanelContactDelay	    "panel delay off: [%d]" (gPanel)  	  {alarmdecoder="KPM:00#contact,bit=3"}
Contact alarmPanelContactFire	    "panel fire: [%d]" (gPanel)  	  {alarmdecoder="KPM:00#contact,bit=2"}
Contact alarmPanelContactZoneIssue    "panel zone issue: [%d]" (gPanel)    {alarmdecoder="KPM:00#contact,bit=1"}
Contact alarmPanelContactArmedStay    "panel armed stay: [%d]" (gPanel)    {alarmdecoder="KPM:00#contact,bit=0"}

Number alarmPanelBeeps	    	    "panel beeps: [%d]" (gPanel) 	  {alarmdecoder="KPM:00#beeps"}
Number alarmPanelZone	    	    "panel zone: [%d]" (gPanel) 	  	  {alarmdecoder="KPM:00#zone"}
String alarmPanelDisplay	    "panel display: [%s]" (gPanel) 	  {alarmdecoder="KPM:00#text"}

In my sitemap I added alarmPanelStatusReady/Away/Home, and I can correctly see their values change to 0 or 1. Can you please help me in setting up a basic rule to arm my home security to “Stay” at 10:30 pm?
Values before the security is armed:
alarmPanelStatusHome = 0
alarmPanelStatusReady = 1
Values after the security is armed:
alarmPanelStatusHome = 1
alarmPanelStatusReady = 0

Hi Ashish.

Here is one way:
First you need to uncomment this line in the alarmdecoder.cfg file:

# set this to true if you want to send commands to the alarm panel as well
send_commands_and_compromise_security=true

create Switch item (using quick arm):

Switch  armStay    		"Arm Stay"         		(gPanel) {alarmdecoder="SEND#ON=POUND3", autoupdate="false"}

create rule (using Joda time):

rule "Arm Stay"
    when
        Time cron "0 30 22 * * ?"
    then
	sendCommand(armStay,ON)  
end

Hi Carlyle,
I added your code to set my security to “Stay” at 9:06 pm but it didn’t work. Here is the event log:

2017-03-26 21:05:39.631 [ItemStateChangedEvent ] - network_device_a146eaf2_time changed from 272.96847999999999956344254314899444580078125 to 1103.268816000000015264959074556827545166015625

2017-03-26 21:06:14.300 [ItemCommandEvent ] - Item ‘armStay’ received command ON

2017-03-26 21:06:15.117 [ItemStateChangedEvent ] - alarmPanelStatusRaw changed from 131456 to 147840

2017-03-26 21:06:15.181 [ItemStateChangedEvent ] - alarmPanelStatusBacklight changed from 0 to 1

2017-03-26 21:06:15.214 [ItemStateChangedEvent ] - alarmPanelContactBacklight changed from CLOSED to OPEN

2017-03-26 21:06:38.421 [ItemStateChangedEvent ] - network_device_a146eaf2_time changed from 1103.268816000000015264959074556827545166015625 to 4883.762917000000015832483768463134765625

2017-03-26 21:07:03.624 [ItemStateChangedEvent ] - alarmPanelStatusRaw changed from 147840 to 131456

2017-03-26 21:07:03.669 [ItemStateChangedEvent ] - alarmPanelStatusBacklight changed from 1 to 0

2017-03-26 21:07:03.704 [ItemStateChangedEvent ] - alarmPanelContactBacklight changed from OPEN to CLOSED

2017-03-26 21:07:37.600 [ItemStateChangedEvent ] - network_device_a146eaf2_time changed from 4883.762917000000015832483768463134765625 to 4082.9903100000001359148882329463958740234375

The log shows that alarmPanelStatusRaw changed from 131456 to 147840 but on basicUI site, I didn’t see this value (131456) changing to 147840. Btw, I did set send_commands_and_compromise_security to true.

I don’t know what “quick arm” and “joda time” is. I used Eclipse SmartHome Designer to update all the files and I didn’t see any syntax error. Do I need to import any files?

OK.

Quick arm: go to the keypad and hit # and 3 (stay) and see if it arms. If not then quick arm is disabled. Then you will need to use a code in the command I showed. Instead of alarmdecoder=“SEND#ON=POUND3”, use alarmdecoder=“SEND#ON=xxxx3”, where xxxx is your alarm code.

Thanks. That worked like a charm.

I have a question about RFX. In the wiki example, they created an item for an RFX Serial Number. When I looked at the raw data coming out of Alarmdecoder, I saw many RFX Serial Numbers. My house is prewired with sensors for all the doors and windows. Not sure if all those RFX Serial Number were for each sensor. Would I need to create an item for each RFX code? What’s the benefit of these items anyway? Here are some lines from my Alarmdecoder ASCII stream where I have removed the duplicate KPM lines.
[10000001100000003A–],008,[f70000ff1008001c28020000000000]," DISARMED CHIME Ready to Arm "
!RFX:0657456,0c
!RFX:0284256,00
!RFX:0640357,04
[00000301100000000A–],006,[f70000ff1006030028020000000000],“FAULT 06 “
!RFX:0025963,04
!RFX:0851532,04
[10000001100000003A–],008,[f70000ff1008001c28020000000000],” DISARMED CHIME Ready to Arm “
!RFX:0892066,80
!RFX:0892066,00
!RFX:0362125,a0
!RFX:0362125,80
!RFX:0892066,80
!RFX:0672367,04
[00000301100000000A–],006,[f70000ff1006030028020000000000],"FAULT 06 “
!RFX:0413478,04
!RFX:0743016,84
!RFX:0851532,80
!RFX:0851532,80
!RFX:0851532,00
!RFX:0727708,04
!RFX:0362125,84
!RFX:0110979,04
!RFX:0204931,04
!RFX:0222478,04

Glad that worked for you; just keep in mind you have now stored your alarm code in plain text and if anyone should hack into your controller they can easily have it. Therefore, I recommend enabling quick arm. You can find the field in the Honeywell/Ademco programming manual.

If I understand you correctly, “prewired”, meaning you have no wireless sensors on doors or windows? Wireless motion detectors?
If that is the case, then these messages are coming from your neighbor’s houses.

I have only 2 Glass break sensors that are transmitting wirelessly. And
both my neighbors have Prewired houses with no other sensor. Seeing so many
devices makes me wonder if other devices like Smart bell or cameras etc are
being caught too.

I definitely need to enable quick arm. What happens if one of my zones is
open and “arm stay” fails? Is there a way to get an alert?