In this How to, @jeroends and I will try to briefly explain how to download, compile and auto-start VelServ.
A simple and effective Linux TCP server for Velbus.
If you are a Windows user and need a TCP server for Velbus, then @Golfy has created a great purebasic application that can be found here : https://forumtest.velbus.eu/t/an-other-velbus-server-purebasic/5523/53
Download the VelServ code
For now, you can download VelServ 1.5 in a neat Zip file from my website, this will be moved to GitHub soon (This post will be updated)
The Zip file contains :-
Compile.txt - An archive file with how to use GCC to compile for your Linux OS
readme.txt - A brief explanation of how to compile velserv for your Linux OS and how to run the velserv.service file
top-velserv.sh - A Linux script to run TOP with a filter for Velserv, a historical script I used before using systemd
velserv.c - the C code for Velserv 1.5
velserv.service - The Linux SystemD service file, set to use port /dev/ttyACM0 and port 6000
velserv.sh - A script file to simplify starting VelServ with startup values that differ from the defaults
Version-1.5.txt - A version ID file
How To
For now it is just the text from the readme.txt file
source can be downloaded at the following link: leachy.homeip.net/velbus/velserv.c
Use GCC to compile the C code for your system
sudo apt-get install gcc
Or
sudo apt-get install build-essential
Use this command line to compile for your system
gcc -o velserv velserv.c -lpthread
Usage: ./velserv -csfvhV] -d DEVICE] -a ADDRESS] -p PORT]
Tip : try to run as root
-s --server act as server only, gateway will be disabled
when in server mode, the address is always 127.0.0.1
-c --client act as client only, server wil be disabled
-d --device INTERFACE device where the Velbus interface is connected to
default device is: /dev/ttyACM0
-a --address HOST IP address or hostname where to connect to as client
default is 127.0.0.1
-p --port port where to connect
default is 3788
-f --foreground do not run in background
-v --verbose verbose operation, repeat for debugging output
1 general debug, 2-3 com to socket debug, 4-6 server socket debug
-h --help print this help and exit
-V --version print version information and exit
An example
To start VelServ and use /dev/ttyACM0 and port 6000, the following command line should be used
sudo ./velserv -d /dev/ttyACM0 -p 6000
VelServ as a Linux Service
When enabled, the velserv.service file starts, stops and restarts VelServ as a service in Linux systems that support SystemD.
The velserv.service file is set to use device /dev/ttyACM0 and port 6000, if you wish a different configuration, please edit the service file, you will find the parameters in a line towards the end that starts ExecStart=/opt/velserv
Move the velserv.service file into /etc/systemd/system/
{You can create a symlink if you wish}
with the compiled velserv application in /opt/velserv/ {Edit the verserv.service file if your ./velserv application is in a different folder}
run the following commands to activate velserv.service
sudo systemctl daemon-reload
sudo systemctl enable velserv.service
reboot to get VelServ to load on boot, or to start the service now :-
sudo systemctl start velserv
you can also use
sudo systemctl restart velserv
sudo systemctl stop velserv
or any user can use
systemctl status velserv
Useful Links from this forum
Swapping OpenHab2 from a Serial Bridge to a Network bridge
https://forumtest.velbus.eu/t/velbus-binding-for-openhab/14992/108