Setup a DSC EVL-3 proxy with nodealarmproxy

I use an EVL-3 to extend my DSC alarm to my OH install. I have been frustrated by the fact that the EVL will only talk to a single server. This makes testing difficult as I have to take production down. I prefer to test for days not minutes and cannot leave production down all of this time.

I created a simple lightweight Debian 9 vm to act as my alarm proxy based on the nodealarmproxy project by Matt Martz. You can find the git repo here: https://github.com/martzcodes/NodeAlarmProxy

There isn’t a ton to it and there are probably easier, better, more secure… ways and I’m open to comments. I chose Debian as my os but you can adapt to whatever OS you want. Most *nix will be very similar but installing node will differ between them.

I recommend using sudo but am writing this as logged in as root… adjust accordingly.


Install OS.

I installed Debian with only SSH server
2 core, 256MB ram, 8GB HD (to give you an idea of how light it is)

Install Node

apt install curl git
wget https://deb.nodesource.com/setup_6.x
chmod +x setup_6.x
apt install nodejs

Test with:

nodejs -v
npm -v

You should get a version number back.

Install nodealarmproxy
Pick a location to install your node_modules to. I placed them in var

cd /var/
npm install https://github.com/martzcodes/NodeAlarmProxy.git

Configure nap
It creates a nap-example.js that you can run with. I just ignored it and created my own called nap.js. He was using smarthings with some additional stuff.

You will need to change password, serverpassword, actualhost

cd /var/node_modules/nodealarmproxy
nano nap.js

I used the following where password and server password are your EVL’s password and actual host is the ip of your EVL:

var nap = require('./nodealarmproxy.js');

var alarm = nap.initConfig({ password:'1111',
        serverpassword:'1111',
        actualhost:'192.168.x.y',
        actualport:'4025',
        serverhost:'0.0.0.0',
        serverport:'4025',
        partition:1,
        proxyenable:true,
        atomicEvents:true
});

var watchevents = ['601','602','609','610','650','651','652','654','656','657'];

alarm.on('data', function(data) {
        console.log('npmtest data:',data);
});

alarm.on('zone', function(data) {
        console.log('npmtest zoneupdate:',data);
});

alarm.on('partition', function(data) {
        console.log('npmtest partitionupdate:',data);
});

At this point, you can simply go to where nodealarmproxy is (/var/node_modules/nodealarmproxy) and run:

node nap.js

This will start the proxy in that console. You could run it out of screen and call it a day if you like but you will need to do this at boot and if it crashes, it won’t attempt to recover. I set it up as a system service. I would recommend starting it manually like this to test prior to setting up the service as it will spit logging to the console instead of syslog. Remember you must disconnect your OH instance from the EVL or it will error out as unable to connect.

Install as service
I created a user to run the service as, create the service file, enable and start it:

useradd nap
nano /etc/systemd/system/nap.service

Paste the following with adjustments to your install locations of node and nodealarmproxy as needed:

[Unit]
Description=nodealarmserver

[Service]
ExecStart=/usr/bin/node /var/node_modules/nodealarmproxy/nap.js
Restart=always
 # Restart service after 10 seconds if node service crashes
 RestartSec=10
 # Output to syslog
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=nodealarmproxy
User=nap
Group=nap

[Install]
WantedBy=multi-user.target

systemctl enable nap.service
systemctl start nap.service

You can review output by tailing /var/log/syslog

Configure OH
This doesn’t even really deserve mention… simply change your thing file to point to the new ip of the dsc proxy. If you kept the password the same, it will just connect. All items and other thing definitions remain untouched. You can switch back just as easily.

I now have my production 2.1 OH, a test 2.1 OH install for messing with rules and sitemaps and a 2.2 snapshot build all talking to the same DSC proxy instance. Hope this helps somebody!

2 Likes