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

If you connect via TCP the velbus serial device should not be mounted anymore…

The velbus snap package will own the device, so no need to add it to the docker

2 Likes

After using the by-id path for years, because there was only one Velbus idProduct, I’ve had to come back to your solution.

I’ve expanded it a little, to include the three varieties of Velbus IDs.

Creating this file

/etc/udev/rules.d/V80-usb-serial-velbus.rules

With this content

SUBSYSTEM=="tty", ACTION=="add|change", ATTRS{idVendor}=="10cf", ATTRS{idProduct}=="0b1b", SYMLINK+="ttyVelbus-VMBRSUSB"

SUBSYSTEM=="tty", ACTION=="add|change", ATTRS{idVendor}=="10cf", ATTRS{idProduct}=="0b1c", SYMLINK+="ttyVelbus-VMBUSB-20"

SUBSYSTEM=="tty", ACTION=="add|change", ATTRS{idVendor}=="10cf", ATTRS{idProduct}=="0516", SYMLINK+="ttyVelbus-VMBSIG"

on a reboot or replug of the USB, the OS will create an easily identifiable Symlink when the module is (re)plugged in.

My output looks like this with this command

ls -l /dev/ttyV*

lrwxrwxrwx 1 root root 7 Jul 27 08:13 /dev/ttyVelbus-VMBRSUSB -> ttyACM1

lrwxrwxrwx 1 root root 7 Jul 27 08:13 /dev/ttyVelbus-VMBSIG -> ttyACM2

lrwxrwxrwx 1 root root 7 Jul 27 08:13 /dev/ttyVelbus-VMBUSB-20 -> ttyACM0

@Stef_Coene
Thank you so much for suggesting this and sharing your solution.


Taking this thought a stage further, I’m trying to work out how to recreate the Auto-Restart that @jeroends has with VelServ.

Does anyone fancy testing this for me?

A uDev rule to restart velbus-tcp when the USB is plugged in.

udev rule /etc/udev/rules.d/v90-USB-serial-velbus-tcp.rules

SUBSYSTEM=="tty", ACTION=="add|change", ATTRS{idVendor}=="10cf", ATTRS{idProduct}=="0b1b", RUN+="sleep 2s & sudo snap restart velbus-tcp"
SUBSYSTEM=="tty", ACTION=="add|change", ATTRS{idVendor}=="10cf", ATTRS{idProduct}=="0b1c", RUN+="sleep 2s & sudo snap restart velbus-tcp"
SUBSYSTEM=="tty", ACTION=="add|change", ATTRS{idVendor}=="10cf", ATTRS{idProduct}=="0516", RUN+="sleep 2s & sudo snap restart velbus-tcp"

Everything I have been working on can be found in this ZIP file

https://www.velbus.co.uk/dl/velbus/velbus-tcp.zip


An experimental thought…

Does anyone know if a single rule like this would work?

/etc/udev/rules.d/v99-USB-serial-velbus-tcp-reset.rules

SUBSYSTEM=="tty", ACTION=="add|change", ATTRS{idVendor}=="10cf", ATTRS{idProduct}=="0b1b", SYMLINK+="ttyVelbus-VMBRSUSB",  RUN+="sleep 2s & sudo snap set velbus-tcp serial.port=/dev/ttyVelbus-VMBRSUSB"
SUBSYSTEM=="tty", ACTION=="add|change", ATTRS{idVendor}=="10cf", ATTRS{idProduct}=="0b1c", SYMLINK+="ttyVelbus-VMBUSB-20", RUN+="sleep 2s & sudo snap set velbus-tcp serial.port=/dev/ttyVelbus-VMBUSB-20"
SUBSYSTEM=="tty", ACTION=="add|change", ATTRS{idVendor}=="10cf", ATTRS{idProduct}=="0516", SYMLINK+="ttyVelbus-VMBSIG",    RUN+="sleep 2s & sudo snap set velbus-tcp serial.port=/dev/ttyVelbus-VMBSIG"

Theory being that when a Velbus USB device is plugged in, the rule will set a symlink, wait 2 seconds, set the SNAP Package to the new ttyVelbus-xxxxx port, which will cause it to restart

@PrzemoF @RCZ
Is this something you fancy trying for me?

(As I don’t run openHabian for example, I’ll test it with DietPi machines I have)

1 Like

Good evening MDAR,

I was on vacation in July and I must have missed your message dated from 19 July…until tonight :scream_cat:.

Meanwhile I reinstalled Openhab a few times because an Openhabian upgrade ruined everything. Pi was running hot and no rules where executed anymore. I ran your revisited zip (see last message) but still no Velbuslink connection via TCP/IP. All the rest(OH) is working fine again. I didn’t have a lot of time recently but I’m wondering if others experiencing the same problem?

It’s not an urgent one but if I can help you testing…let me know.

Kind regards and sorry for this dust covered reply!

Jona

1 Like

No problem.

I’ll start another thread, specially to address your issue, which will make it easier for others to find in the future should they come looking for openHABIAN issues.

Cool. I will keep an eye on it :wink:. Thanks for your help!!!