Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
# Conflicts:
#	package.json
  • Loading branch information
aficustree committed Jan 16, 2018
2 parents 7241678 + 5c4717a commit 79201fc
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# homebridge-alarmdecoder-platform

Homebridge dynamic platform plugin for the alarmdecoder (alarmdecoder.com) interface to Honeywell/DSC Systems. It requires a functioning alarmdecoder-webapp (https://www.alarmdecoder.com/wiki/index.php/AlarmDecoder_WebApp) for the homebridge plugin to contact (via the rest API). Please make sure your webapp is updated with the latest alarmdecoder python package.
Homebridge dynamic platform plugin for the alarmdecoder (alarmdecoder.com) interface to Honeywell/DSC Systems. It requires a functioning alarmdecoder-webapp (https://www.alarmdecoder.com/wiki/index.php/AlarmDecoder_WebApp) for the homebridge plugin to contact (via the rest API). **Please make sure your webapp is updated** with the latest alarmdecoder python package.

This plugin exposes the security system and any configured contact sensors or motion sensors (i.e., the security system's zones) to HomeKit/Homebridge for use in further automations.

The alarmdecoder webui must be setup to push alarm events and zone status changes using the enclosed directions.

**IMPORTANT** The name of the zone in the AlarmDecoder WebUI must have the word 'motion', 'smoke' or 'carbon' in the name for the plugin to use the special motion, smoke or carbon monoxide services, otherwise all zones will load as contact sensors. You can name the zones in `settings->zones->zone name`. Contact sensors are the default so you don't have to put 'contact' in the name anywhere.
**IMPORTANT** The name of the zone in the AlarmDecoder WebUI must have the word 'motion', 'smoke' or 'carbon' in the name for the plugin to use the special motion, smoke or carbon monoxide services, otherwise all zones will load as contact sensors. You can name the zones in `settings->zones->zone name`. **Contact sensors are the default** so you don't have to put 'contact' in the name anywhere.

## Installation

Expand All @@ -32,7 +32,12 @@ Configuration example with explanation
"stateURL" : "http://YOURIP:YOURPORT/api/v1/alarmdecoder",
"zoneURL" : "http://YOURIP:YOURPORT/api/v1/zones",
"setURL" : "http://YOURIP:YOURPORT/api/v1/alarmdecoder/send",
"setPIN" : "YOUR PIN"
"setPIN" : "YOUR PIN",
"DSCorHoneywell" : "Honeywell",
"DSCStay" : "<F4>",
"DSCAway" : "<S5>",
"DSCReset" : "<S7>",
"DSCExit" : "<S8>"
}
]
Expand All @@ -43,6 +48,8 @@ Configuration example with explanation
- The **port** parameter reflects the port the alarmdecoder-sensor will listen for updates from alarmdecoder GUI
- The **stateURL**, **zoneURL** and **setURL** entries show the URL that the plugin will query for the list of zones, the state of the alarm system (and all faulted zones) and the URL to send virtual keypresses. Replcae YOURIP and YOURPORT with the IP and port of the alarmdecoder-webgui interface.
- The **setPIN** is your PIN that you use to arm/disarm the system. Only type the base pin, do not add the arm/disarm button press (i.e., if you arm the system by typing 12342, your pin is 1234)
- The **DSCorHoneywell** should be set to either "DSC" or "Honeywell" depending on the type of alarm panel
- Values for **DSCStay**, **DSCAway**, **DSCReset** and **DSCExit** should not be changed and are not used if the panel type is listed as Honeywell

## Configuration of Alarmedecoder GUI
- Go to your installation of the Alarmdecoder GUI
Expand Down
17 changes: 15 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ class AlarmdecoderPlatform {
this.zoneURL = config.zoneURL;
this.setURL = config.setURL;
this.setPIN = config.setPIN;
this.platformType = config.DSCorHoneywell;
let rePlatformType = new RegExp('dsc','i');
if(rePlatformType.exec(this.platformType)) {
this.isDSC = true;
this.DSCAway = config.DSCAway;
this.DSCStay = config.DSCStay;
this.DSCReset = config.DSCReset;
this.DSCExit = config.DSCExit;
}
this.name = config.name;
this.securityAccessory = null; //used to hold the security system accessory
this.zoneAccessories = []; //used to hold all zone accessories
Expand Down Expand Up @@ -256,6 +265,7 @@ class AlarmdecoderPlatform {
.setCharacteristic(Characteristic.CarbonMonoxideDetected, 0);
}
else if(alarmZone.accessory.getService(Service.SmokeSensor)) {
this.log('zone is a smoke sensor, status is '+alarmZone.faulted);
if(alarmZone.faulted)
alarmZone.accessory.getService(Service.SmokeSensor)
.setCharacteristic(Characteristic.SmokeDetected, 1);
Expand Down Expand Up @@ -313,10 +323,10 @@ class AlarmdecoderPlatform {
var codeToSend = null;
switch (state) {
case Characteristic.SecuritySystemTargetState.STAY_ARM:
codeToSend = this.setPIN+'3';
codeToSend = this.isDSC ? this.DSCStay : this.setPIN+'3';
break;
case Characteristic.SecuritySystemTargetState.AWAY_ARM :
codeToSend = this.setPIN+'2';
codeToSend = this.isDSC ? this.DSCAway : this.setPIN+'2';
break;
case Characteristic.SecuritySystemTargetState.NIGHT_ARM:
codeToSend = this.setPIN+'33';
Expand All @@ -330,6 +340,9 @@ class AlarmdecoderPlatform {
var body = JSON.stringify(tempObj);
this.log(body);
try {
// ignore disarm requests if panel is already disarmed and it's a DSC panel (otherwise it rearms itself)
if(this.isDSC && (state == Characteristic.SecuritySystemTargetState.DISARM) && (this.alarmDecoderSystem.state == 3))
throw('disarm request for DSC panel but system is already disarmed, ignoring');
var response = await axios.post(this.setURL,body,this.axiosHeaderConfig);
if(response.status==200 || response.status==204) //should be a 204
callback(null, response, state);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "homebridge-alarmdecoder-platform",
"version": "1.1.0",
"version": "1.2.0",
"description": "An http-based contact and motion sensor plugin for homebridge: https://github.com/nfarina/homebridge, for use with alarmdecoder. Exposes honeywell/dsc alarm system, motion and contact sensors when used with alarmdecoder.",
"license": "Apache 2.0",
"keywords": [
Expand Down
7 changes: 6 additions & 1 deletion sample-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
"stateURL" : "http://10.0.1.4:2222/api/v1/alarmdecoder",
"zoneURL" : "http://10.0.1.4:2222/api/v1/zones",
"setURL" : "http://10.0.1.4:2222/api/v1/alarmdecoder/send",
"setPIN" : "YOUR PIN"
"setPIN" : "YOUR PIN",
"DSCorHoneywell" : "Honeywell",
"DSCStay" : "<F4>",
"DSCAway" : "<S5>",
"DSCReset" : "<S7>",
"DSCExit" : "<S8>"
}
]
}

0 comments on commit 79201fc

Please sign in to comment.