This project should be used in combination with a client, such as node-velbus-client.
Using Raspbian Jessie Lite (download, installation, expand filesystem, update, static IP address)
# add nodejs repository
echo 'deb https://deb.nodesource.com/node_4.x jessie main' | sudo tee --append /etc/apt/sources.list.d/nodesource.list
# add nodejs repository key
wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
# enable https repositories
sudo apt-get install apt-transport-https
# update installation sources
sudo apt-get update
# install nodejs
sudo apt-get install nodejs
# update installation sources
sudo apt-get update
# install git
sudo apt-get install git
# clone this project
git clone https://github.com/pdpotter/node-velbus-server.git
# install dependencies
$(cd node-velbus-server; npm install)
# install initial config
$(cd node-velbus-server/server; cp config.sample.js config.js)
If node-velbus-server is running as a daemon (see below), stop the daemon before updating and start it again after updating.
# update node-velbus-server
$(cd node-velbus-server; git pull)
# update dependencies
$(cd node-velbus-server; npm install)
The server can be configured by editing the settings in
node-velbus-server/server/config.js
. The default settings are:
(function() {
exports.velbus = {
device: '/dev/ttyACM0'
};
exports.websocket = {
port: '8001'
};
}).call(this);
Check which device the Velbus is connected to by checking the results of
ls /dev/ | grep ttyACM
If necessary, edit the velbus.device
setting (the default value is ttyACM0
).
The port on which node-velbus-server is reachable using a websocket can be
changed by editing the websocket.port
setting (the default value is 8001
).
(based on init-script-template)
If node-velbus-server was not installed in the home directory of the pi user,
update the dir
setting on line 12 in
node-velbus-server/daemon/node-velbus-server
accordingly.
# copy daemon file
sudo cp node-velbus-server/daemon/node-velbus-server /etc/init.d
# make it executable
sudo chmod 755 /etc/init.d/node-velbus-server
To start the daemon, execute
sudo /etc/init.d/node-velbus-server start
To stop the daemon, execute
sudo /etc/init.d/node-velbus-server stop
To run the daemon on startup, execute
sudo update-rc.d node-velbus-server defaults