How-To : Install and Run VelServ - a Velbus TCP Gateway

Hi

To make life even easier to setup Velserv, I’ve created a script to download and setup.

http://www.mdar.co.uk/dl/velserv-setup.sh

Use a terminal and try these commands…

wget http://www.mdar.co.uk/dl/velserv-setup.sh

cat velserv-setup.sh

sudo sh velserv-setup.sh

When the script has completed it’s final step, you should see something like this :

user@Linux_MiniServer:/# systemctl status velserv
● velserv.service - Velserv
   Loaded: loaded (/opt/velserv/velserv.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-03-24 17:55:34 GMT; 47s ago
  Process: 2345 ExecStartPost=/bin/bash -c /bin/pidof velserv >> /var/log/velserv.log (code=exited, status=0/SUCCESS)
  Process: 2338 ExecStartPost=/bin/bash -c /bin/echo Velserv Started $(date) >> /var/log/velserv.log (code=exited, status=0/
  Process: 2334 ExecStartPost=/bin/bash -c /bin/touch /var/log/velserv.log (code=exited, status=0/SUCCESS)
  Process: 2327 ExecStart=/opt/velserv/velserv -d /dev/serial/by-id/usb-Velleman_Projects_VMB1USB_Velbus_USB_interface-if00
 Main PID: 2332 (velserv)
    Tasks: 4
   Memory: 104.0K
      CPU: 86ms
   CGroup: /system.slice/velserv.service
           └─2332 /opt/velserv/velserv -d /dev/serial/by-id/usb-Velleman_Projects_VMB1USB_Velbus_USB_interface-if00 -p 6000

Mar 24 17:55:34 Ubuntu-Home systemd[1]: Starting Velserv...
Mar 24 17:55:34 Ubuntu-Home systemd[1]: Started Velserv.

It will stay in that state until you press q

Good luck

If you want to keep an eye on the amount of times Velserv is started at boot up, take a look at the log file it appends

cat /var/log/velserv.log

I can’t remember what inspired me to write this script, ahem… @CobleS @RossJe

4 Likes

Haha, great!
Keep in mind that there 's a minor update in the current version, so we’re now at version 1.6 :slight_smile:

1 Like

I’m very glad you approve :smiley_cat:

I’ve added a line in the velser-setup.sh script that will pull down the latest version of your velserv.c file from now on :smile:

2 Likes

@MDAR

Tried your script today with a friend, works perfect! :ok_hand:

1 Like

For the correct /dev/ entry, you can also create a udev rule:
cat /etc/udev/rules.d/99-usb-serial.rules :
SUBSYSTEM==“tty”, ATTRS{idVendor}==“10cf”, ATTRS{idProduct}==“0b1b”, SYMLINK+=“ttyVelbus”

This will create a /dev/ttyVelbus based on the vendor and producti ID.

This was needed when I used an older PI.
It didn’t created a symlink in /dev/servial

Stef

1 Like

Just a thought, but

How can we update to a newer version? As I mentioned :

But I already have velserv running, so now what… :thinking:

Bernd

Hi

Once Jerome advised that he had added an update, I tweaked the install script to pull down the very latest code from Jerome’s website.

Simply running the script again will update VelServ.

However, the change is very minor and “If it ain’t broke, don’t fix it”

I know what you mean…
But I tried a part of your script:
wget https://raw.githubusercontent.com/jeroends/velserv/master/velserv.c -O /opt/velserv/velserv.c
and I got a write error. I did stop velserv before trying the update. Will your script be able to overwrite the already running/installed version?
Just me begin curious. :innocent:

Hey CobleS,
what error did you get, permission denied? Try to put sudo in front of your command, so: sudo wget https://raw.githubusercontent.com/jeroends/velserv/master/velserv.c -O /opt/velserv/velserv.c
After that compile the file with : gcc -o velserv velserv.c -lpthread (or if this gives you an error, sudo in front of it)

1 Like

Yeah, that’s the plan.

My installation script overwrites everything :slight_smile: (dangerous, but true)

As Jerome rightly says, try prepending sudo to give each command write privileges for everywhere.

However, unless you’re using an RS232 link to Velbus, the tweak that Jerome made won’t affect your installation.

@jeroends was right, I didn’t put “sudo” in front of the command
@MDAR I’m not using RS232, so I won’t update :slight_smile:
Still good to know that I can use the scirpt if I want to update, whatever makes my life easier :wink:

1 Like

i have installed velserv on a rasberrypi that also runs openhabian.
The VelServ works, the usb cable is also connected, the network connection installed in openhab. but no Velbus things are discovered.
Do these have to be entered manually or am I doing something wrong.:wink:

this is the log file in openhab:

2019-08-09 11:26:56.774 [vent.ItemStateChangedEvent] - VelbusNetworkBridgeHuis_LastSeen changed from 2019-08-09T11:22:14.117+0200 to 2019-08-09T11:26:56.730+0200

2019-08-09 11:27:56.804 [vent.ItemStateChangedEvent] - VelbusNetworkBridgeHuis_LastSeen changed from 2019-08-09T11:26:56.730+0200 to 2019-08-09T11:27:56.776+0200

this is the configuration in network binding:

Hostname or IP
127.0.0.1
Port
6000
Retry
1
Timeout
5000

Refresh Interval
60000

Hi

A quick scan with the Inbox in PaperUI should find everything (eventually).

Just to double check, can you access your network with VelbusLink, via the TCP port of your PI?

Restarting openHAB2 might do the trick.

are you sure the velserv has connection? Try to connect with Velbuslink, if that works you’re sure :slight_smile: .The problem is that velserv exists in 2 parts, a distribution part and a gateway. The distribution part keeps running even when the gateway is down, so it could look like velserv is still running.

behind restarting openhab2 I see the following in the log:


but the velbus link via tcp also doesn’t work.
So I think as Jeroends says the gateway is down, How can I restart it?

I also requested the status of the velserv:

Curious…

This command will restart VelServ

sudo systemctl restart velserv

Please do let us know how you get on

restarted the velserv:
cannot yet connect to Velbus link via tcp. on openhab I see:

have you’ve tried to connect with velbuslink? You can make a connection choosing the TCP/IP in the connection dialog, then fill in your ip address and port 6000. Do a scan and if you don’t get a timeout your velserv is up and running fine.
Other posibility is looking at a more verbose session of velserv. First stop your velserv service with “sudo systemctl stop velserv”. The go to the dir where the velserv program lives: “cd /opt/velserv”.
Here you can start the server manually and add some verbose options, in your case type: “./velserv -d /dev/serial/by-id/usb-Velleman_Projects_VMB1USB_Velbus_USB_interface-if00 -p 6000 -vvvvvv” and copy the output here. You can end the program with the key combination “ctrl c”. In this way you can see every client connect and disconnect + monitor the data on the bus.

succes

when I go through velbuslink I always get an error


an unexpected error has occurred, we have disconnected the bus

result of monitoring: