KNXD add-on: convert your KNX-USB interface into an IP interface that can be used by HA

if you are running HA OS, why not simply add my repo to the supervisor and install this add-on via the add-on store? You might have a hard time to install anything on the basically readonly system partition of HA OS. HAOS is an appliance system and does NOT give you any access to the underlaying system - that’s why you need docker add-ons for basically everything.

Oh I wish I knew what you are talking when you say “add my repo to the supervisor”
You mean install KNX-USB addon or KNXd?
I need step by step instructions…I am an HW person…not much experience in SW

@Goahead see section “Installation”

Thank you da-anda

I was able to install add-on.
But I dont have the option for ttyACM0 in config menu…only ttyAMA0
Using a Raspberry PI 4 with nothing connected into ports yet.

The idea is to connect a bus coupler to 2x ports of RPI4 just like:

Is this possible using GPIO14 and GPIO15?

Is this ttyAMA0 the serial port in GPIO14 and GPIO15?

I only wrote /dev/ttyACM0 because you used it in your code. And I have no idea if you can use GPIO-pins for a serial interface via HAOS or what serial interface ttyAMA0 is in your case. Why don’t you just give it a try, fire up the add-on and check in the log tab of the add-on if KNXD was able to use this device as KNX interface or not. But honestly, this is way outside the scope of this add-on or thread.
I bought the DIY Busware USB stick because I didn’t want to buy an expensive KNX IP interface at that time. But if I calculate the time I spent on getting this crap running via knxd and building the add-on, I could have bought dozens of those IP interfaces. Also, since IP interfaces got a lot cheaper these days (at least before COVID hit us), I would probably just go for a MDT IP interface and be done. HW/SW tinkering is all fun for a short period of time, but it really is getting annoying over time - at least to me.

A totally agree with you.
Been there done that, lost tons of air, and in the end, buying a commercial solution would be more reliable.
Just like Home Assistant…a never ending project. :grin:

I may try to buy some IP interface, cheap on ebay, but till then I have to use what i have at home.
I have RS232 interface connected to KNX (thats what I use for ETS using an old laptop with serial port) and have some spare bus couplers for DIY testing.

I will try this step by step.

First I will try to make GPIO14 and 15 work as serial:

  • connect USB->TTL module to those pins (thats what I use to program firmware into ESP8266 modules)
  • Use Terminal to check If I can send and receive anything from RPI4 to GPIOs
    (need to understand how can I send messages in some type of console from HA to GPIOs)
  • Then, maybe I can build a max232 circuit to connect RPI4 directly to RS232 KNX Port, or I can use TTL from RPI4 directly to Bus coupler (just using a galvanic isolator) .

I will create a new topic for this, since those testing’s are out of this topic thread.

Thx once again

I just checked the add-on developer documentation (Add-On Configuration | Home Assistant Developer Docs), and there is a config option that add-ons can set in order to get direct access to the GPIO pins from within the docker container. But I doubt adding this would instantly make your interface work.

Have you tried if the serial interface listed in the device tree is by any chance your knx interface?

Lost my head and bought a IP interface.
Waiting for delivery.

Hoping for a smooth integration.

@da-anda Thank you for the help so far.

with an IP interface you obviously won’t need this add-on anymore.
Once my setup starts to bitch around again, or this add-on causes to much trouble to keep it working, I will very likely also simply grab an off-the-shelf IP interface and actually enjoy my won sparetime :slight_smile:

Hello First of all thanks for the plugin. I have a Merten USB interface, with Hassbian in virtualbox.
I capture the usbe interface in the VM.
In the configuration of the plugin it appears as
/dev/bus/usb/001/002
And in the registry it says

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 2-init-config: executing... 
[21:26:18] INFO: Interface:      usb
[21:26:18] INFO: Device:         /dev/bus/usb/001/002
[21:26:18] INFO: Address:        0.0.1
[21:26:18] INFO: Client Address: 0.0.2:8
[21:26:18] INFO: Filters:        single
[21:26:19] INFO: Log-Level:      debug
[21:26:19] INFO: USB-Device ID:  2
[21:26:19] INFO: USB-Bus ID:     1
[cont-init.d] 2-init-config: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
I00000131: [ 1:main] 0.14.39: knxd /etc/knxd.ini
I00000129: [ 1:main] Connected: cfg:interface-usb.
I00000129: [ 1:main] Connected: cfg:server.
I00000129: [ 1:main] Connected: cfg:A.tcp.
W00000126: [ 1:main] knxd should not run as root
N00000127: [23:router.pace_] The 'pace' filter without a queue acts globally.

The entities are activated and I can activate them but there is no response on the KNX bus.
I have another USB interface connected to the bus and there is no telegram traffic.

Could you help me?

Thanks

Hello
I answer myself.
On the Hassbian console, I have typed the command

hardware info

After a lot of lines running, when I stopped I observed the line

dev_patch:/ /dev/bus/usb/001/008

Belonging to the Merten interface

So I have put it in device and it has worked for me.
The funny thing is that I had already noticed that and on a previous occasion it put 001/003 but it did not appear on the list, or at least that was what it seemed to me.
I put it in case it is useful to someone else.

Thank you very much for the plugin.

a greeting

Hello

The problem now is that when I start the VM with the interface connected and the automatic USB capture configuration, KNXd does not start since the dev / patch has changed.
So for it to work again I have to list another one, see the hardware information, see the current patch dev, reconfigure it in the plugin, reload the KNX configuration and then it works again.
naturally this cannot be every time you want to use it.
is there any way to force Home asistant to assign the same dev patch to usb?
I seem to have read some automatic detection of the USB interface, how can I do that?

Thank you

Greetings

autodetection of the USB device is working by simply keeping it empty, so not selecting any device. And no, I have no idea if you can force HAOS to always map a device to the same USB bus number. But shouldn’t there also be a by-id kind of hw path to that intreface? For my serial interface there at least is one, same with HDDs and what not, so I would be surprised if the same didn’t apply for USB as well (not a linux crack myself, so no idea).

Goodmorning gents,

I have the same problem as several others in here - lauriKo among others - however mine is still unsolveable.

I conntect an ABB USB interface to USB cable to RaspberryPi wtih HA running on it. Initially, HA detects my ABB interface - and it is added as
BUSNUM: '001' DEVNAME: /dev/bus/usb/001/003 DEVNUM: '003' DEVPATH: >- /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1 DEVTYPE: usb_device DRIVER: usb ID_BUS: usb ID_FOR_SEAT: usb-platform-fd500000_pcie-pci-0000_01_00_0-usb-0_1_1 ID_MODEL: KNX-USB_Interface ID_MODEL_ENC: KNX-USB\x20Interface ID_MODEL_ID: '5120' ID_PATH: platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.1 ID_PATH_TAG: platform-fd500000_pcie-pci-0000_01_00_0-usb-0_1_1 ID_REVISION: '0404' ID_SERIAL: ABB_STOTZ-KONTA_KNX-USB_Interface_000292EBBB74 ID_SERIAL_SHORT: 000292EBBB74

When i start the KNXd, it runs for a few seconds - then fails. i can see in supervisor that this happens:

21-11-12 11:28:37 WARNING (MainThread) [supervisor.hardware.monitor] Ignore device /sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1:1.0/usbmisc/hiddev0 / failes to initialize by udev
21-11-12 11:28:37 WARNING (MainThread) [supervisor.hardware.monitor] Ignore device /sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1:1.0/0003:147B:5120.0004/hidraw/hidraw0 / failes to initialize by udev

And at the same time, i get an F00000000105 error, that interface is down. I am connected via ETS to the interface, and 2 times i managed to get 1 single GA telegram via the interface - but mostly it crashed before that point.

I think i did all on this thread - please help me. it is highly annoying this. i also did “hard reset” of both USB interface and HA raspberry PI - still with same result. it seems that the interface is just crashing in the supervisor - and then also ofcourse in KNXd.

KNXd version 0.4.2 - and it was / is really hard to install. i click install, and it just hangs, so tried MANY times to get it in there - and finally it installed. Other AddOns just installs easy and normal…

anybody has any great ideas?

This is happening now:

21-11-12 11:49:36 WARNING (MainThread) [supervisor.hardware.monitor] Ignore device /sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1:1.0/usbmisc/hiddev0 / failes to initialize by udev
21-11-12 11:49:36 WARNING (MainThread) [supervisor.hardware.monitor] Ignore device /sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1:1.0/0003:147B:5120.0006/hidraw/hidraw0 / failes to initialize by udev

and in KNXd logging in debug mode:

[s6-init] making user provided files available at /var/run/s6/etc…exited 0.
[s6-init] ensuring user provided files have correct perms…exited 0.
[fix-attrs.d] applying ownership & permissions fixes…
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts…
[cont-init.d] 2-init-config: executing…
[11:49:21] INFO: Interface: usb
[11:49:22] INFO: Device: /dev/bus/usb/001/003
[11:49:22] INFO: Address: 0.0.1
[11:49:22] INFO: Client Address: 0.0.2:8
[11:49:22] INFO: Filters: single
[11:49:23] INFO: Log-Level: debug
[11:49:23] INFO: USB-Device ID: 3
[11:49:23] INFO: USB-Bus ID: 1
[cont-init.d] 2-init-config: exited 0.
[cont-init.d] done.
[services.d] starting services
I00000131: [ 1:main] 0.14.39: knxd /etc/knxd.ini
I00000129: [ 1:main] Connected: cfg:interface-usb.
I00000129: [ 1:main] Connected: cfg:server.
I00000129: [ 1:main] Connected: cfg:A.tcp.
W00000126: [ 1:main] knxd should not run as root
N00000127: [23:router.pace_] The ‘pace’ filter without a queue acts globally.
[services.d] done.
F00000105: [15:interface-usb] Link down, terminating
N00000128: [ 1:main] Shutting down.
I00000131: [ 1:main] 0.14.39: knxd /etc/knxd.ini
I00000129: [ 1:main] Connected: cfg:interface-usb.
I00000129: [ 1:main] Connected: cfg:server.
I00000129: [ 1:main] Connected: cfg:A.tcp.
W00000126: [ 1:main] knxd should not run as root
N00000127: [23:router.pace_] The ‘pace’ filter without a queue acts globally.

Well, i have done some more troubleshooting on this.

IF i remove my ETS software (Shuts down the wifi connection to rasparryPI - and i comment out all lines in my ETS configuration in HA - THEN i experience that the interface on the supervisor crashes as mentioned before 5 times. then it is up, and stays up.

Then i re-enable my ETS computers wifi connection - and i try to read just 1 singe group adress status - and immidiately the interface crashes in Supervisor and the USB interface looses connection in the KNXd docker / addon.

I think it is related to traffic to the knx bus. every time a single pack is on the ets bus and the addon is running - it crashes.

What can cause this?

Dennis

UPDATE:

Still having the issue and trying desperately to find out what is wrong since the USB connection the the ABB KNX interface crashes every single time something is send to it.

I am looking into applying a filter

so i apply pace - but how do i apply the options to is. standard is 20 msec - if i want to apply 50 msec?

i tried to put in the option of 50 in all the ways i can think of - i read the documentation but it only refers to the ini file. i cannot find the ini file in the docker, so i wanted to use the interface via the addon in HA.

So, how do i, via the KNXd addon in HA, add a filter “pace” and give it the option of 50 msec?

Dennis

looks like you can’t since this would require an additional ini config section (that’s at least what I gathered from a quick look at the doc)

Yes, ok. i see.

But i cant get this USB interface to work - like others can. it is a standard ABB S2.1 interface - and works on laptops etc.

Any good ideas why the USB connections fails every time data is send to KNXd and send to the USB interface (crasches nomatter if connected to KNX bus or not).

Dennis

I’m sorry, my guess is as good as yours. Have you tried searching the web for knxd troubleshooting along with your USB interface?

At some point I might add a way to write a custom bash startup command for knxd, so that you could apply any custom config (since the “custom config” config option of the add-on got broken in some HA update that removes new lines from input fields) - but this won’t happen any time soon since I don’t really have time for this right now.