visonic-powerlink2
v1.0.1
Published
Allows you to get and set the status of a Visonic security system (i.e. arm or disarm it) via its PowerLink2 communication module
Maintainers
Readme
visonic-powerlink2
Allows you to get and set the status of a Visonic security system (i.e. arm or disarm it) via its PowerLink2 communication module
Install
$ npm install --save visonic-powerlink2Usage
var PowerLink2 = require("visonic-powerlink2");
var powerLink2 = new PowerLink2({
host: "10.0.1.200",
username: "your-username",
password: "your-password"
});
powerLink2.getStatus(function (error, status) {
if (error) {
console.log(`Error getting status: ${error}`);
return;
}
console.log(`Status: ${status}`); //=> Status: disarmed
});
powerLink2.setStatus(PowerLink2.STATUSES.ARMED_HOME, function (error) {
if (error) {
console.log(`Error getting status: ${error}`);
return;
}
console.log(`Status set successfully`);
});
API
PowerLink2
STATUSES
Map of possible statuses
DISARMEDARMED_HOMEARMED_AWAYEXIT_DELAY– Can only get, not set, this status. Occurs when the system has begun arming; allowing people to exit.UNKNOWN– Can only get, not set, this status.
new PowerLink2(config, [log])
configObjecthoststring – The IP address, or hostname, of the PowerLink2. (The IP address will match your router's, but with the last block being.200, if DHCP is used)usernamestring andpasswordstring – The details to log into the PowerLink2 with. By default, they'reAdminandAdmin123respectively. (Be sure to change the password!)debugoptional boolean – Turns on extensive logging, to help debug issues, when set totrue(default:false)
logoptional Function - Logging function
getStatus(callback)
Get the current system status
callbackFunction - Callback to call with the status or error (error, status). Status will be a value fromPowerLink2.STATUSES
setStatus(status, callback)
Sets the system status (i.e. arms or disarms the system)
statusstring - The status to set. Use a value fromPowerLink2.STATUSEScallbackFunction - Callback to call (error)
