From bbec7b7795c792865a6c6ea0306a0711a783386f Mon Sep 17 00:00:00 2001 From: caseyd Date: Tue, 11 Feb 2014 11:39:35 -0800 Subject: [PATCH 1/3] Added Elk Zone Change (ZC) handling. msgData for ZC messages now has zone and zoneStatus attributes. zoneStatus values are from p53 of ELK-M1_R232_Protocol document. --- lib/parser.js | 11 ++++++++++- lib/protocol.js | 22 ++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/lib/parser.js b/lib/parser.js index eb76cdb..8a69eb9 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -39,6 +39,9 @@ var parseMessage = function(msg) { case 'AS': msgData = parseArmingStatusData(msgData); break; + case 'ZC': + msgData = parseZoneChange(msgData); + break; } return msgData; } @@ -75,6 +78,12 @@ var parseArmingStatusData = function(msgData) { return msgData; } - +var parseZoneChange = function(msgData){ + + var theState = msgData.dataRaw.substring(3,4); + msgData.data.zone = msgData.dataRaw.substring(0,3); + msgData.data.zoneStatus =var theStateCode = protocol.zoneStates[msgData.dataRawsubstring(3,4)]; + return msgData; +} module.exports.parseMessage = parseMessage; \ No newline at end of file diff --git a/lib/protocol.js b/lib/protocol.js index bf31f0e..168d17d 100644 --- a/lib/protocol.js +++ b/lib/protocol.js @@ -1085,6 +1085,25 @@ var events = { //7001 – 7208 = Output status, 1 = On } +var zoneStates = { + '0': 'Unconfigured', + '1': 'Normal Open', + '2': 'Normal EOL', + '3': 'Normal Short', + '4': 'not used', + '5': 'Trouble Open', + '6': 'Trouble EOL', + '7': 'Trouble Short', + '8': 'not used', + '9': 'Violated Open', + 'A': 'Violated EOL', + 'B': 'Violated Short', + 'C': 'Bypassed Open', + 'D': 'Bypassed EOL', + 'F': 'Bypassed Short' +} + + var armStatuses = [ 'Disarmed', 'Armed Away','Armed Stay','Armed Stay Instant', 'Armed to Night','Armed to Night Instant','Armed to Vacation' @@ -1118,9 +1137,12 @@ var alarmStates = { 'B': 'Verify Fire' } + + module.exports.commands = commands; module.exports.words = words; module.exports.events = events; +module.exports.zoneStates = zoneStates; module.exports.armStatuses = armStatuses; module.exports.armUpStates = armUpStates; module.exports.alarmStates = alarmStates; \ No newline at end of file From 9f476628e631c6be88f4435e3eee0ad2387ec906 Mon Sep 17 00:00:00 2001 From: caseyd Date: Tue, 11 Feb 2014 11:45:37 -0800 Subject: [PATCH 2/3] (correcting stupidity, premature commit) --- lib/parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/parser.js b/lib/parser.js index 8a69eb9..fa2db6a 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -82,7 +82,7 @@ var parseZoneChange = function(msgData){ var theState = msgData.dataRaw.substring(3,4); msgData.data.zone = msgData.dataRaw.substring(0,3); - msgData.data.zoneStatus =var theStateCode = protocol.zoneStates[msgData.dataRawsubstring(3,4)]; + msgData.data.zoneStatus = protocol.zoneStates[msgData.dataRaw.substring(3,4)]; return msgData; } From 39995813eac37a303ee256d070f5b3f4a927182c Mon Sep 17 00:00:00 2001 From: CaseyD Date: Fri, 22 Apr 2016 17:24:05 -0700 Subject: [PATCH 3/3] gah! relearing this stuff. doofus. this is a backup emacs buffer which shouldn't be here. --- package.json~ | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 package.json~ diff --git a/package.json~ b/package.json~ deleted file mode 100644 index 9de9dcd..0000000 --- a/package.json~ +++ /dev/null @@ -1,29 +0,0 @@ -{ - "author": "Kevin O'Hara ", - "name": "elkington", - "description": "A node.js module for interfacing with the Elk M1 Gold automation controller", - "keywords": [ "elk", "home", "automation", "security", "hardware", "m1", "m1xep", "elkm1", "home"], - "version": "0.1.0", - "repository": { - "type": "git", - "url": "git://github.com/kevinohara80/elkington.git" - }, - "main": "index.js", - "engines": { - "node": ">0.6.x" - }, - "dependencies": { - "safereturn": "*" - }, - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "scripts": { - "test": "mocha --reporter spec" - }, - "bugs": { - "url": "http://github.com/kevinohara80/elkington/issues" - }, - "license": "MIT" -}