Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-alarmdecoder

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-alarmdecoder - npm Package Compare versions

Comparing version 1.2.2 to 1.3.0

LICENSE

38

index.js
/**
* 2017 Alan Ibrus (alanibrus@gmail.com)
* https://alan.ibrus.ee/
*/
'use strict';

@@ -13,21 +13,6 @@ const net = require('net');

if (!zoneConfig || typeof zoneConfig !== 'object') {
throw new Error('No Zones configured');
console.warn('No Zones configured, debug mode activated (listening to zones)');
this.DEBUG_LISTEN_ZONES = true;
}
/*
zoneConfig: {
// 'expander:channel': { name: 'String', type: 'contact/motion/fire' }
'00:01': {
name: 'Front door',
type: 'contact'
},
'00:02': {
name: 'Hallway',
type: 'motion'
},
'00:03': {
name: 'Sauna fire sensor',
type: 'fire'
}
}
*/
this.ip = ip || 'alarmdecoder';

@@ -131,3 +116,2 @@ this.port = port || 10000;

// splitted[0] = bit field

@@ -147,3 +131,4 @@ // splitted[1] = numeric code

zoneChanged(expander, channel, status) {
if (this.zones[expander + ':' + channel]) { // if we have this zone binded
status = (status == '00' ? 0 : 1);
if (this.zones && this.zones[expander + ':' + channel]) { // if we have this zone binded
this.events.emit('zoneChanged', {

@@ -154,2 +139,5 @@ zone: this.zones[expander + ':' + channel],

}
if (this.DEBUG_LISTEN_ZONES) {
console.log('DEBUG: Zone changed: ' + JSON.stringify({ expander, channel, status }));
}
}

@@ -160,3 +148,3 @@

if (i === '6' || i === '7') {
this.bitStatus[i] = parseInt(bitField[i]);
this.bitStatus[i] = parseInt(bitField[i], 10);
} else if (i === '18') {

@@ -180,4 +168,8 @@ this.bitStatus[i] = (bitField[i] === 'D' ? 'DSC' : 'Ademco');

sendKeys(keys) {
this.client.write(keys);
}
enterCode(code) {
this.client.write('#' + code);
this.sendKeys('#' + code);
}

@@ -184,0 +176,0 @@ }

{
"name": "node-alarmdecoder",
"version": "1.2.2",
"version": "1.3.0",
"description": "Node.JS client for listening and parsing AlarmDecoder events over ser2sock",

@@ -5,0 +5,0 @@ "main": "index.js",

# node-alarmdecoder
Node.JS client for listening and parsing AlarmDecoder events over ser2sock.
Node.JS client for listening and parsing AlarmDecoder events over ser2sock. Dependency-free.
Easily control and monitor DSC and Ademco / Honeywell Vista alarm systems with a PC, HA system, PLC or embedded device.
This project was created for my own purpose: monitoring and controlling my DSC home alarm system, paired with Raspberry PI and AlarmDecoder AD2PI.
This project was originally created for my own purpose: monitoring and controlling my DSC home alarm system, paired with Raspberry PI and AlarmDecoder AD2PI.

@@ -19,2 +19,12 @@ AlarmDecoder products:

-----
```javascript
const alarmDecoder = require('node-alarmdecoder');
const myAlarm = new alarmDecoder(ip, port, zoneConfig);
```
Check example code below to understand zoneConfig.
If you run just `new alarmDecoder(ip, port)` without zone configuration, it will run in debug mode
and will help you to debug which expander and channel is used when you activate sensors (by moving around your house for example)
## Events
AlarmDecoder emits 4 events:

@@ -26,7 +36,2 @@ * 'connected' - Successfully connected to AlarmDecoder ser2sock interface

And one method:
* enterCode(code) - You can use this to arm/disarm your panel with the code specified
## Events
### zoneChanged(data)

@@ -47,21 +52,21 @@ ```javascript

message: 'Secure System Before Arming', // System's message
numeric: '000', // Numeric Code: This number specifies which zone is affected by the message. For example, if this message is for CHECK ZONE 22 then the numeric code would be 022. Most of the time this is zero-padded base10, but there are rare occurrences where this may be base16, such as ECP bus failures.
numeric: '000', // Numeric Code: This number specifies which zone is affected by the message. For example, if this message is for CHECK ZONE 22 then the numeric code would be 022. Most of the time this is zero-padded base10, but there are rare occurrences where this may be base16, such as ECP bus failures.
bits: {
Ready: false, // Indicates if the panel is READY
Ready: false, // Indicates if the panel is READY
'Armed Away': false, // Indicates if the panel is ARMED AWAY
'Armed Home': false, // Indicates if the panel is ARMED HOME
'Backlight on': false, // Indicates if the keypad backlight is on
Programming: false, // Indicates if the keypad is in programming mode
Beeps: 0, // Number (1-7) indicating how many beeps are associated with the message
'Zone bypassed': 0, // Indicates that a zone has been bypassed
'AC power': true, // Indicates if the panel is on AC power
'Chime enabled': false, // Indicates if the chime is enabled
'Backlight on': false, // Indicates if the keypad backlight is on
Programming: false, // Indicates if the keypad is in programming mode
Beeps: 0, // Number (1-7) indicating how many beeps are associated with the message
'Zone bypassed': 0, // Indicates that a zone has been bypassed
'AC power': true, // Indicates if the panel is on AC power
'Chime enabled': false, // Indicates if the chime is enabled
'Alarm occured': false, // Indicates that an alarm has occurred. This is sticky and will be cleared after a second disarm.
'Alarm on': false, // Indicates that an alarm is currently sounding. This is cleared after the first disarm.
'Alarm on': false, // Indicates that an alarm is currently sounding. This is cleared after the first disarm.
'Battery low': false, // Indicates that the battery is low
'Entry delay off': false, // Indicates that entry delay is off (ARMED INSTANT/MAX)
Fire: false, // Indicates that there is a fire
'System issue': false, // Indicates a system issue
'Watching perimeter': false, // Indicates that the panel is only watching the perimeter (ARMED STAY/NIGHT)
'Error report': false, // System specific bits. 4 bits packed into a HEX Nibble [0-9,A-F]
'Entry delay off': false, // Indicates that entry delay is off (ARMED INSTANT/MAX)
Fire: false, // Indicates that there is a fire
'System issue': false, // Indicates a system issue
'Watching perimeter': false, // Indicates that the panel is only watching the perimeter (ARMED STAY/NIGHT)
'Error report': false, // System specific bits. 4 bits packed into a HEX Nibble [0-9,A-F]
'Device mode': 'DSC' // 'Ademco' or 'DSC' Mode

@@ -72,7 +77,18 @@ }

## Methods
### sendKeys(string keys)
Send keys directly to alarm system.
`sendKeys('#')` will send only # to your alarm panel
`sendKeys('#5555')` will send #5555, in sequence (#, 5, 5, 5, 5) to your alarm panel
### enterCode(string code)
Just an convinient method.
You can use this to arm/disarm your panel with the code specified. enterCode('1234') sends keys #, 1, 2, 3, 4 to your alarm panel.
## Example code
```javascript
const alarmDecoder = require('node-alarmdecoder');
const config = {
ip: 'alarmdecoder',
const config = {
ip: '192.168.1.100',
port: 10000,

@@ -94,16 +110,8 @@ zones: {

'00:04': {
name: 'Dining room',
type: 'motion'
},
'00:05': {
name: 'Yard door',
type: 'contact'
},
'00:06': {
'00:05': {
name: 'Yard door 2',
type: 'contact'
},
'00:07': {
name: 'Hallway II',
type: 'motion'
}

@@ -123,3 +131,3 @@ // ... more zones

console.log('FIRE ' + (data.state ? 'ON' : 'OFF') + ' @ ' + data.zone.name);
} else if (data.zone.type === 'contact') {
} else if (data.zone.type === 'contact') {
console.log(data.zone.name + (data.state ? ' opened' : ' closed'));

@@ -126,0 +134,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc