Issue with integration to home assistant using USB

I’m currently starting with home assistant. In my home I have a Velbus installation with quite some modules and panels. I have a raspberry pi 5 running HA OS hooked up to my system. After installing the Velbus integration and doing a scan over USB, the system always finds a few modules. However, the number of modules found seems to be different in every scan. One time I find 20, another time 31, even 60 ones. But never does it discover the entire system…
With the VelbusLink software, I never have issues scanning the network. I’m using the Velbus system a few weeks full-time now and don’t notice any poot Quality CAN communications either. It’s always responding fast and working great.

What could be the issue here? I tried: 3 different USB cables, different USB ports on my pi, reloading my configuration using VelbusLink, restarting HA and the integration multiple times,… What else can I try?

:point_right: Own homeassistant linked to Signum

I’m not a HA user, but I do read all the posts and try to keep a good idea of how it works, so I can I support people.

The original / first time HA scans your Velbus network, it can take ages to fully read the bus.

My advice you be

Setup a TCP gateway for the Velbus USB device, so that every bit of software can connect via TCP, instead of swapping the USB cable each time you do anything.

Search this forum for

VelServ or Velbus-tcp

When that is setup, confirm it’s operating correctly by connecting Velbuslink, scan your network to confirm.

Open the Logging tab, so that you can see all the bus activity.

Wipe your HA’s Velbus entries
Point HA to your localhost TCP port and start a scan.

Don’t touch anything else

Take your family out for dinner / theatre / county park & have a lovely time with them.

When you come back, maybe HA will have finished it’s scan and you can then go looking for all the visible and hidden Velbus entities.

Don’t touch HA until your happy that all of your Velbus modules have been interacted with by HA, by reviewing the Velbuslink log.

Save the log so that if you need assistance, you have some hard data to share :wink:

Good luck.

FYI

Have you looked here for other people’s experiences and advice??

(500+ comments, the search function will be your best friend here)

Thank you for your detailed response.

This is something I can try, but is it possible to run this server on home assistant os? So I don’t need additional hardware?

How is this different from te approach of directly using the USB serial interfaces in the Velbus integration? Another way of scanning for the devices?

I was wondering: would it be possible to manually add each module (without having to scan for it) based on the CAN address and the type of module? In the meantime, I’ve tried openHAB to see if I could find all modules there, however there my problem is that the Vmb8dc module is not yet implemented.

I have another similar setup (other house) with a few less modules, there the configuration went flawless. Alle modules were immediately Found. There Is used as Raspberry Pi 4. Therefore I tried with this Pi on the new installation but I’m facing te same issue.

1 Like

You’re very welcome.

Anything to get people over the initial hurdles.

As far as I know, HA OS is just a shaved down Debian OS.

So as long as you can get SSH access, you can install either
VelServ
Or
Velbus

I believe, you have to add a software module within HA Configuration to enable SSH.

This really isn’t my area, but I do recall seeing a post about it on the HA forum.

A quick search should do the trick.

In day to day operation, there is absolutely no difference between a direct USB connection to HA and passing via a TCP Gateway app.

The major advantage is that it enables you to connect Velbuslink at the same time via your LAN / WiFi.

I know that’s possible in openHAB & NodeRed, maybe even with Control4, but I’m not even as good as a novice user in HA.

I think that’s correct, you can ask Daniel if he has time to add the VMB8DC.

@Daniel615be
Is this something you can do?

Is this with HA or openHAB?

Your theory is correct, as far as I can tell

Hi,

VMB8DC-20 is implemented in OH, but for the upcoming v5 release.
If you wish, you can use the package I compiled for v4.3.x with the same updates I implemented for v5.

Releases · Rosen01/openhab-addons

1 Like

In the other setup I Also use Home assistant but the issue is not there.

So now I think I managed to get the VelServ complied and Running on the home assistant os. I had some issues installing gcc but it seemed I had to use apk add instead of apt-get.
However, if I now run
./velserv -d /dev/ttyACM0 -p 6000
I get no error or whatsoever.
I assume it is Running as I get a result when I try pidof velserv

However, if I try to setup TCP in the Velbus integration using 127.0.0.1 and port 6000, it tells me I can’t connect.
Doing the same in VelbusLink Also won’t work.

That’s interesting.

The first question is…

How many USB devices do you have connected to this machine?

IE, can you be 100% sure that ttyACM0 is being used with the Velbus module?

This is the sole reason I prefer to directly address the device, rather than through a symLink

However, I’m not sure that the HA OS has the

/dev/serial/by-id/ path

First

How many USB devices are shown when you try

lsusb ??

Secondly, what happens if you try

ls /dev/serial/by-id -l

Does it show a velleman-xxxxxxxx-vmb ??? usb device?

For example

My velserv.service file actually uses this command for the VMBRSUSB module (different for the VMBSIG or VMBUSB-20 modules)

./velserv -d /dev/serial/by-id/usb-Velleman_Projects_VMB1USB_Velbus_USB_interface-if00 -p 6000

I’m confident that the USB port is the correct one

  • when I was configuring the same for the Velbus integration, I could find some modules…
  • when I’m starting the VelServ and try to configure the Velbus integration again with USB, no entities are found, which I think makes sense as it is occupied by VelServ.
  • I have only 1 USB device connected to my pi. Home assistant is also recognizing that it is velbus

Maybe I should use a different IP? Could the issue be I’m using the localhost but the integration runs in a docker container? Does that make it not local?

What IP should I use then?

May I suggest that you confirm that VelServ is running first, by connecting to it with Velbuslink?

In Velbuslink, you’ll need

The full local network IP address of the machine running VelServ

And port 6000

The authentication and TLS parts should be left blank / un-ticked

When everything works in Velbuslink, you can then move on to getting HA Velbus network bridge up and running.

Depending on how your system is configured for container isolation, you might be able to use

127.0.0.1 as the IP address (loopback)
Or you might have to use the full local network IP address. 192.168.xxx.xxx

I don’t use containers for this very reason.

First scan of velbus integration, is always a bit tricky, and indeed … it needs a lot off time. Work is ongoing to avoid the scan and upload the velbuslink project file instead (already announced in another thread). Hopefully available in next release …

Meanwhile, some suggestions:

  • It’s absolutely a good idea to install velserv. It enables simultaneous connection to velbus for velbuslink and HA integration (velbus-aio). VelbusLink is not only a great logging tool, you will also be able to monitor in real time the HA scan. (just open your project in velbuslink and connect to the bus without scanning, then start new scan in HA and you will see turning the status of your modules to ok one by one)
  • Do the scan when there is low activity on the bus
  • You mention random missing some modules. This might be caused by some coincidental higher activity on the bus (you can trace this with velbuslink once you have installed velserv). I know this is (and should not) be common use, but with some manual work you can easily merge the results of different scans and even add some modules manually.

Steps to manually merge scans:

  • locate the velbus cache on your PI (it should be in a directory .velbuscache, but depends on your os)
  • In the cache you will find files named address.json for each detected module (e.g when you have modules with addresses 10, 205 there should be the files 10.json and 205.json)
  • After an (incomplete) scan, move the json files to a backup folder and relaunch the scan with an empty cache.
  • Repeat previous step until you have all modules detected once
  • Finally merge all json files from the backup(s) in the velbuscache and restart the automation (don’t scan again, and keep a backup of your cache so you have to go through this pain just once!)
  • Alternative to repeating scans you can check if you got another detected module of the same type. If you do: clone the file of the detected module to the missing module (don’t bother editing the file, the cloned file will only serve for discovery and content will be updated on next restart of velbusintegration)

Hope this helps a bit … while waiting for final solution with project file …

1 Like

No luck trying to get VelServ to work with Velbuslink.

It looks like the server is running. But when I try to connect to the Pi’s IP on port 6000 in VelbusLink, nothing seems to happen. Also no error or whatsoever.

Thank you for your response!

It seems it’s not being so random. Last scans always show same result. The detection with the module on address 11 as last one.

I’ve tried adding the address.json files for all my modules manually by copying and editing the files. Adding them all at once didn’t seem to do the trick. But when I was adding 1 by 1, each time reloading the the integration, I could find 3 that weren’t working. I’ve left them out and could add the rest. However, the controls do show up in home-assistant and it looks like I would be able to use them. But if I try to control a relay I’ve added for example, nothing happens.
One weird thing that came to my attention: Shortly after trying to enable a manually added relay from home assistant, controlling my lights with my velbus switches on the wall suddenly seemed to lag for a a moment. Suddenly the lights went on and the lag was gone.

So still no luck in the attempt to get it all working today…

Does Velbuslink show as connected?

Or does “nothing happen” for a long time, then “a pop up appears to say it’s not connected”

It seems it’s not being so random …
It looks like there is a problem with the module on address 11. When an unexpected error occurs in the scan code, the scan is aborted. With current code the scan is never restarted until all cache files are removed (already fixed in code, but not yet released). What is the type off the module? A log would also be nice once you got velserv fixed :stuck_out_tongue_winking_eye:

Adding them all at once didn’t seem to do the trick. But when I was adding 1 by 1 …
Seems odd, adding them all at once should work fine …

However, the controls do show up in home-assistant and it looks like I would be able to use them. But if I try to control a relay …
If you have no json files for the modules the modules will not be bound. The controls you see in HA are most likely created on a previous scan. HA caches also a lot off things. Check there state.

Shortly after trying to enable a manually added relay from home assistant, controlling my lights with my velbus switches on the wall suddenly seemed to lag …
HA assistant scans can stress the canBus (opposed to velbuslink a HA scan is in fact a scan + synchronise module). I never experienced a lag on velbus actions but it does not seem impossible. That is why I suggest to do the scan in a low activity period.

From your input I am guessing module 11 is your main problem. Did you try to temporary remove module 11 (just disconnect velbus power from the module) and do a clean scan. Module 11 will not be detected but scan should continue. Again … I am just guessing without log …

About velserv … you can start velserv interactive with some logging / debug switches. Might help for diagnostics … but you probably know that.

1 Like

… just thought about it … if module 11 is the last detected module then probably the next module (12 ?) might cause the problem.

I noticed that you are trying to run velserv on HAOS. Are you sure this is possible? Lot of things are blocked in HAOS.
I never managed to get it working but that might be my lack off knowledge on linux. I finally switched to docker (on PI4) … and love it since.

It doesn’t connect.
But I seem to get why. If I run the VelServ command with debug option as requested here, I have some more information:

I’m planning to give it a try using a different Pi to set up the Velserv

Okay

So that’s a step forward.

The million dollar question is

“Is your operating system definitely binding the USB device to ttyACM0?”

If you list your /dev folder, is ttyACM0 in there?

Or… Could it be that your OS have bound the Velbus USB to something else?

For example ttyUSB0

Try this command and see what happens

ls -l /dev/tty*

1 Like