# Bridging Velbus with TCP through snap package

**URL:** <https://forum.velbus.eu/t/bridging-velbus-with-tcp-through-snap-package/15814>\
**Category:** For developers\
**Created:** [June 11, 2019, 12:20pm UTC](https://forum.velbus.eu/t/bridging-velbus-with-tcp-through-snap-package/15814 "2019-06-11T12:20:03Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![VEL448](https://forum.velbus.eu/user_avatar/forum.velbus.eu/vel448/32/4186_2.png) [@VEL448](https://forum.velbus.eu/u/VEL448)\
**Post date:** [June 11, 2019, 12:20pm UTC](https://forum.velbus.eu/t/bridging-velbus-with-tcp-through-snap-package/15814/1 "2019-06-11T12:20:03Z")

</div>

Hello everyone

We’ve made a snap package to easily run a Velbus TCP gateway on any snapd-compatible Linux distribution.

To install, simply run these two commands;

snap install velbus-tcp  
snap connect velbus-tcp:raw-usb :raw-usb

The server will now listen at 27015 (which you can connect to with VelbusLink).

Source code and further information can be found at [https://github.com/velbus/velbus-tcp-snap](https://github.com/velbus/velbus-tcp-snap)

---

<div class="post-metadata">

**Author:** ![MDAR](https://forum.velbus.eu/user_avatar/forum.velbus.eu/mdar/32/4215_2.png) [@MDAR](https://forum.velbus.eu/u/MDAR)\
**Post date:** [July 1, 2019, 6:39am UTC](https://forum.velbus.eu/t/bridging-velbus-with-tcp-through-snap-package/15814/2 "2019-07-01T06:39:26Z")

</div>

Hi

Do you have a systemd service file to automate the starting and stopping of this service in Linux?

---

<div class="post-metadata">

**Author:** ![VEL524](https://forum.velbus.eu/user_avatar/forum.velbus.eu/vel524/32/4069_2.png) [@VEL524](https://forum.velbus.eu/u/VEL524)\
**Post date:** [July 1, 2019, 7:10am UTC](https://forum.velbus.eu/t/bridging-velbus-with-tcp-through-snap-package/15814/3 "2019-07-01T07:10:00Z")

</div>

Hi MDAR,

This snap starts automatically. It does not require a systemd service file.

To start the snap:

> snap start velbus-tcp

To stop the snap:

> snap stop velbus-tcp

---

<div class="post-metadata">

**Author:** ![MDAR](https://forum.velbus.eu/user_avatar/forum.velbus.eu/mdar/32/4215_2.png) [@MDAR](https://forum.velbus.eu/u/MDAR)\
**Post date:** [July 1, 2019, 7:19am UTC](https://forum.velbus.eu/t/bridging-velbus-with-tcp-through-snap-package/15814/4 "2019-07-01T07:19:58Z")

</div>

Thanks 🙂

I meant to start the service at boot up 😉

---

<div class="post-metadata">

**Author:** ![VEL524](https://forum.velbus.eu/user_avatar/forum.velbus.eu/vel524/32/4069_2.png) [@VEL524](https://forum.velbus.eu/u/VEL524)\
**Post date:** [July 1, 2019, 7:50am UTC](https://forum.velbus.eu/t/bridging-velbus-with-tcp-through-snap-package/15814/5 "2019-07-01T07:50:19Z")

</div>

Hi MDAR,

It starts automatically at boot up. 😄

You can check the status of the snap with

> snap services velbus-tcp

It should say  
Startup: enabled  
Current: active

---

<div class="post-metadata">

**Author:** ![MDAR](https://forum.velbus.eu/user_avatar/forum.velbus.eu/mdar/32/4215_2.png) [@MDAR](https://forum.velbus.eu/u/MDAR)\
**Post date:** [January 9, 2020, 8:04am UTC](https://forum.velbus.eu/t/bridging-velbus-with-tcp-through-snap-package/15814/6 "2020-01-09T08:04:32Z")

</div>

Hi

I’ve got some bad news ☹

I tried to install this Snap on a fresh Ubuntu 18 device and it failed ☹

The commands I ran were

```
apt-get install snaps
 
snap start velbus-tcp

```

Snap installed correctly, but velbus-tcp failed.

The second snap command

```
snap connect velbus-tcp:raw-usb :raw-usb

```

Reported that there wasn’t a raw-usb plugin available

 ![Screenshot_20200109-080022_SSH%20Client](https://forum.velbus.eu/uploads/default/original/2X/b/ba55fd392ac634c21b8f845fb3fd5e30762274a2.jpeg)

 ![Screenshot_20200109-080208_SSH%20Client](https://forum.velbus.eu/uploads/default/original/2X/1/1146cacb9c4e2d2dbcdcb49d67742163b74b42bc.jpeg)

There were a number of lines of text displayed during the installation of velbus-tcp but they were on the same line so couldn’t be captured.

Extra info

```
root@odroid:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic

 root@odroid:~# ls /dev/serial/*
  dev/serial/by-id:
 
  

Velleman_Projects_VMB1USB_Velbus_USB_interface-if00
  
/dev/serial/by-path:
platform-dwc2_b-usb-0:1.2:1.0

```

---

<div class="post-metadata">

**Author:** ![VEL448](https://forum.velbus.eu/user_avatar/forum.velbus.eu/vel448/32/4186_2.png) [@VEL448](https://forum.velbus.eu/u/VEL448)\
**Post date:** [January 9, 2020, 8:30am UTC](https://forum.velbus.eu/t/bridging-velbus-with-tcp-through-snap-package/15814/7 "2020-01-09T08:30:42Z")

</div>

Hi MDAR

To get the full output snap log, you can use ‘snap changes’ together with ‘snap tasks ’ e.g.

 ![image](https://forum.velbus.eu/uploads/default/original/2X/8/8678e5a917f2b1b48ff07d4e29101cc497d82d89.png)

It seems the snap can’t be installed due to a seccomp error.

Looks like a snapd error, following a similar thread on the official snapcraft forum I found it might be kernel related:

> **[Cannot apply seccomp profile using hello-world](https://forum.snapcraft.io/t/cannot-apply-seccomp-profile-using-hello-world/2751/6)**
>
> I have the files… how do I attach them or send?

Try to create a new thread over on their forum.

Also, you should not have to install snapd on a fresh Ubuntu 18, so might also have something to do with that.

Kind regards

---

<div class="post-metadata">

**Author:** ![Swimmer](https://forum.velbus.eu/letter_avatar_proxy/v4/letter/s/41988e/32.png) [@Swimmer](https://forum.velbus.eu/u/Swimmer)\
**Post date:** [February 26, 2020, 4:32pm UTC](https://forum.velbus.eu/t/bridging-velbus-with-tcp-through-snap-package/15814/8 "2020-02-26T16:32:21Z")

</div>

And how do you connect if all is ok, from Velbuslink ? Chosing Network connection adding the IP and the port, or Signum/USBIP choice ?

---

<div class="post-metadata">

**Author:** ![VEL448](https://forum.velbus.eu/user_avatar/forum.velbus.eu/vel448/32/4186_2.png) [@VEL448](https://forum.velbus.eu/u/VEL448)\
**Post date:** [February 26, 2020, 5:18pm UTC](https://forum.velbus.eu/t/bridging-velbus-with-tcp-through-snap-package/15814/9 "2020-02-26T17:18:38Z")

</div>

You should select ‘Network’, filling in the IP/port.

---

<div class="post-metadata">

**Author:** ![JDV\_Electrics](https://forum.velbus.eu/letter_avatar_proxy/v4/letter/j/df705f/32.png) [@JDV\_Electrics](https://forum.velbus.eu/u/JDV_Electrics)\
**Post date:** [September 10, 2020, 10:58am UTC](https://forum.velbus.eu/t/bridging-velbus-with-tcp-through-snap-package/15814/10 "2020-09-10T10:58:40Z")

</div>

Is it also possible to use in openhab? Witch port should i use? I tried 8080 but its online for one second and then its give communication error.

Kind regards

---

<div class="post-metadata">

**Author:** ![VEL448](https://forum.velbus.eu/user_avatar/forum.velbus.eu/vel448/32/4186_2.png) [@VEL448](https://forum.velbus.eu/u/VEL448)\
**Post date:** [September 10, 2020, 11:13am UTC](https://forum.velbus.eu/t/bridging-velbus-with-tcp-through-snap-package/15814/11 "2020-09-10T11:13:36Z")

</div>

The default port for the connection is 27015 you can check whether you can connect with VelbusLink.

For more configuration options, check [https://github.com/velbus/velbus-tcp-snap](https://github.com/velbus/velbus-tcp-snap)

---

<div class="post-metadata">

**Author:** ![MDAR](https://forum.velbus.eu/user_avatar/forum.velbus.eu/mdar/32/4215_2.png) [@MDAR](https://forum.velbus.eu/u/MDAR)\
**Post date:** [August 21, 2021, 8:52am UTC](https://forum.velbus.eu/t/bridging-velbus-with-tcp-through-snap-package/15814/13 "2021-08-21T08:52:40Z")

</div>

Just an update.

I have revisited the `velbus-tcp’ snap and can report that after a little bit of a bump in the road, it’s now working perfectly and very fast.

I’ve set it up so that the local machine has a restricted unsecured connection for software like [OpenRemote](http://openremote.io), [openHAB](http://www.openhab.org) & [Home-Assistant](http://www.hass.io).

With a second secured port (TLS, SSL & Authentication) for VelbusLink, [Control4](http://www.control4.com), Crestron, Elan, URC-Automation etc

I’m very happy with the setup on two different types of devices.

Everything I did can be reviewed here :-

> <https://github.com/velbus/velbus-tcp-snap/issues/6>
>
> Installed it on a Odroid C4 system - installation was successful and easy
> 
> but… VelbusLink version: 10.6.0.0 crashes on connect :
> 
> (an error occurred while performing the operation. A report will be made at ... 
> 
> \[sniplet\]
> exception number : 4
> exception class : EIdSocketError
> exception message : Socket Error # 10054 Connection reset by peer.
> 
> 
> Also tried the VelServ on exactly the same infra - and that does work so it's not the connection itself.

---

<div class="post-metadata">

**Author:** ![RCZ](https://forum.velbus.eu/letter_avatar_proxy/v4/letter/r/bbce88/32.png) [@RCZ](https://forum.velbus.eu/u/RCZ)\
**Post date:** [August 22, 2021, 6:13am UTC](https://forum.velbus.eu/t/bridging-velbus-with-tcp-through-snap-package/15814/14 "2021-08-22T06:13:56Z")

</div>

Got it working - on an Odroid C4 with the following:

1. Commands:

```auto
apt update
apt install snapd
snap install core
snap install velbus-tcp
snap connect velbus-tcp:raw-usb :raw-usb

```

had to install Snap Core manually

_while core18 got installed automatically - core was required else the log indicated a failure in bind\_network and main and snap connect velbus-tcp:raw-usb :raw-usb would not work_

1. Set the listening ports to dual (to have Auth/TLS enabled for VelbusLink software and no Auth/TLS for OpenHab)

```auto
snap set velbus-tcp \
    tcp.host=0.0.0.0,127.0.0.1 \
    tcp.port=27015,54934 \
    tcp.relay=true,true \
    tcp.ssl=true,false \
    tcp.auth=true,false \
    tcp.authkey=62fa0c49-b0ba-486a-abcd-blablablablabla,

```

1. used serial\by-id\ for the bus connection - and set autodetect to false

```auto
snap set velbus-tcp serial.autodiscover=false 

```

I trying to get it to work with a USB-\>RS232 converter (to avoid sticking in a USB in the front of VMBRSUSB) as well as the regular USB

[for USB]

```auto
snap set velbus-tcp serial.port=/dev/serial/by-id/usb-Velleman_Projects_VMB1USB_Velbus_USB_interface-if00

```

For the Serial one - it’s writing (meaning I can send controls through OpenHab) - but the receiving part is not working. I’ve checked the serial converter in Windows (VelbusLink) directly and there it works so the wired connection is okay… not sure if its a programming thing then…

[for serial RS232]

```auto
snap set velbus-tcp serial.port=/dev/serial/by-id/usb-FTDI_US232R_FTGY89BK-if00-port0

```

---

<div class="post-metadata">

**Author:** ![MDAR](https://forum.velbus.eu/user_avatar/forum.velbus.eu/mdar/32/4215_2.png) [@MDAR](https://forum.velbus.eu/u/MDAR)\
**Post date:** [August 23, 2021, 9:38am UTC](https://forum.velbus.eu/t/bridging-velbus-with-tcp-through-snap-package/15814/15 "2021-08-23T09:38:30Z")

</div>

Hi @RCZ

Great to hear the you’ve got `velbus-tcp` working… Almost

> [@RCZ](#):
>
> but the receiving part is not working

It suddenly occurred to me that this might be something to do with the RS242 RTS / DTS signalling.

Unfortunately that’s way beyond me, you’ll need a wizard like @VEL448 or @VEL524 to shine some light on that.

(You know what my solution is, but it’s not exactly sanctioned)

---

<div class="post-metadata">

**Author:** ![VEL448](https://forum.velbus.eu/user_avatar/forum.velbus.eu/vel448/32/4186_2.png) [@VEL448](https://forum.velbus.eu/u/VEL448)\
**Post date:** [August 25, 2021, 9:56am UTC](https://forum.velbus.eu/t/bridging-velbus-with-tcp-through-snap-package/15814/16 "2021-08-25T09:56:10Z")

</div>

We’ve not tested the snap for correct operation with RS-232 interfaces, @MDAR might be on to something as the DTR flag is not set;

> <https://github.com/velbus/python-velbustcp/blob/d26ffdfc3558c6bf4df6cef21fa4e7a91b50f51c/lib/connection/bus.py#L242>

We’ll try to get a fix out for this soon

---

<div class="post-metadata">

**Author:** ![MDAR](https://forum.velbus.eu/user_avatar/forum.velbus.eu/mdar/32/4215_2.png) [@MDAR](https://forum.velbus.eu/u/MDAR)\
**Post date:** [August 25, 2021, 11:19am UTC](https://forum.velbus.eu/t/bridging-velbus-with-tcp-through-snap-package/15814/17 "2021-08-25T11:19:46Z")

</div>

This wouldn’t be an issue if there was a USB port on the top edge… 🤷‍♂️

I’ve been asking for years 😿

However, I know there are installations that only use the RS232 connection.

I’ll just continue with my little hack for now.

---

<div class="post-metadata">

**Author:** ![RCZ](https://forum.velbus.eu/letter_avatar_proxy/v4/letter/r/bbce88/32.png) [@RCZ](https://forum.velbus.eu/u/RCZ)\
**Post date:** [October 27, 2021, 1:30pm UTC](https://forum.velbus.eu/t/bridging-velbus-with-tcp-through-snap-package/15814/18 "2021-10-27T13:30:08Z")

</div>

hi

was there an update on this one already? can we use the RS232 now?

---

<div class="post-metadata">

**Author:** ![VEL524](https://forum.velbus.eu/user_avatar/forum.velbus.eu/vel524/32/4069_2.png) [@VEL524](https://forum.velbus.eu/u/VEL524)\
**Post date:** [October 29, 2021, 7:37am UTC](https://forum.velbus.eu/t/bridging-velbus-with-tcp-through-snap-package/15814/19 "2021-10-29T07:37:50Z")

</div>

It’s in our backlog to implement this. We’ll also accept pull requests. 🙂

---

<div class="post-metadata">

**Author:** ![MDAR](https://forum.velbus.eu/user_avatar/forum.velbus.eu/mdar/32/4215_2.png) [@MDAR](https://forum.velbus.eu/u/MDAR)\
**Post date:** [November 15, 2021, 1:14pm UTC](https://forum.velbus.eu/t/bridging-velbus-with-tcp-through-snap-package/15814/20 "2021-11-15T13:14:13Z")

</div>

> [@MDAR](#):
>
> I have revisited the `velbus-tcp’ snap and can report that after a little bit of a bump in the road, it’s now working perfectly and very fast.

Just a quick update

I’ve created a small script to automate the installation of this Snap package.  
It should also add [avahi](https://avahi.org/) and broadcast the [presence of the Velbus bus connection](https://github.com/velbus/velbus-tcp-snap/issues/10)

[www.mdar.co.uk/dl/velbus/velbus-tcp.sh](https://www.mdar.co.uk/dl/velbus/velbus-tcp.sh)

```auto
mkdir /opt/velbus-tcp
cd /opt/velbus-tcp
wget www.mdar.co.uk/dl/velbus/velbus-tcp.sh -O /opt/velbus-tcp/velbus-tcp.sh
sh velbus-tcp.sh

```

---

<div class="post-metadata">

**Author:** ![RCZ](https://forum.velbus.eu/letter_avatar_proxy/v4/letter/r/bbce88/32.png) [@RCZ](https://forum.velbus.eu/u/RCZ)\
**Post date:** [November 15, 2021, 2:07pm UTC](https://forum.velbus.eu/t/bridging-velbus-with-tcp-through-snap-package/15814/21 "2021-11-15T14:07:43Z")

</div>

did you also do the pull request and editted for serial connections?

[Next page](https://forum.velbus.eu/t/bridging-velbus-with-tcp-through-snap-package/15814.md?page=2)
