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

Hello, this add-on sounds good :slight_smile: but sorry for my question … but I’m newbie.

How to install you add-on ? I use Hassio

well, in HassIO go to the “add-on store” tab and add my repository under “Repositories” using this URL https://github.com/da-anda/hass-io-addons
After that, my add-on will show up for installation.

@Pengouin there is a new version available now. Got a PR from palhaland which should improve USB interface support. No idea though what to add in the filter section he added.

Yes it’s working now. Thank you so much. That will be really usefull.

Thank you :slight_smile:

The add-on is installed.

The /dev/ttyAMA0 is already used by a zwave dungle.

I tried to find the port for the knx usb stick but I don’t see it.

I use the ssh command “hassio hardware info” but the knx stick doesn’t appear.

Is it possible to have the list of the usb id connected with hassio ? (I know how to do this with a debian but not with the hassos …)

sorry, no idea. I’m still runing the old ResinOS based HassIO supervisor on my RPI2. But you should be able to SSH into the supervisor and then access the bash of the knxd add-on docker container and check the device list there

So happy to see the thread is still open :slight_smile:
I have been struggling with HassIO for the last few days and I am now in the state in which

  • HassIO is correctly running on my raspberry pi 3
  • the KNXD daemon (version 0.3.2) is correctly installed
  • my KNX USB interface is connected to my pi

I am now trying to configure things, but I am missing some steps. Hope you guys can provide some inputs :crossed_fingers:
I am running now with the following add-on configuration:

{
  "address": "0.0.1",
  "client_address": "0.0.1:10",
  "interface": "usb",
  "device": "",
  "usb_filters": "",
  "custom_config": ""
}

And I have no clue on how to setup the configuration file configuration.yaml. I guess I should be using the tunneling option, but how do I find out the local and host ips?

Thanks

The usb_filters is to be able to use the “single” and “queue” (for my interface to act nice). My device had issues when sending multiple packets on the bus, so adding those fixed that issue, tried to make it generic so that others could use different filters…

You need to set up the knx integration https://www.home-assistant.io/integrations/knx and configure the lights and/or other things that you are trying to add.

You need to configure it with tunneling, host should be the IP of the device with the knxd addon (presumable the local device)

Thanks for your response. I managed to make it run but, unfortunately, the add-on periodically crashes and I have not figured out yet the cause.

The configuration worked with the auto discovery

# in my configuration.yaml in simply included 
knx:

I configured only covers for the time being but this happens every now and then:

2020-02-03 18:55:16 WARNING (MainThread) [xknx.log] Error: KNX bus did not respond in time to request of type 'Tunnelling'
2020-02-03 18:55:16 WARNING (MainThread) [xknx.log] Sending of telegram failed. Retrying a second time.
2020-02-03 18:55:17 WARNING (MainThread) [xknx.log] Error: KNX bus did not respond in time to request of type 'Tunnelling'
2020-02-03 18:55:17 WARNING (MainThread) [xknx.log] Resending telegram failed. Reconnecting to tunnel.
2020-02-03 18:55:18 WARNING (MainThread) [xknx.log] Error: KNX bus did not respond in time to request of type 'Disconnect'
2020-02-03 18:55:18 INFO (MainThread) [xknx.log] closing transport None
2020-02-03 18:55:18 WARNING (MainThread) [xknx.log] Error: KNX bus did not respond in time to request of type 'ConnectionState'
2020-02-03 18:55:19 WARNING (MainThread) [xknx.log] Error: KNX bus did not respond in time to request of type 'Connect'
2020-02-03 18:55:19 ERROR (MainThread) [xknx.log] Error while processing telegram Could not establish connection

I have to manually restart the add-on every time.

what does your add-on log look like? (at the bottom of the page where you configure the add-on). You should see an error there as well.

If anybody is more familiar with Linux, it would be nice if we could add a watchdog and restart knxd when it exits.

Here the logs provided within the add-on


F00000108: [15:interface] Send while buffer not empty
F00000105: [12:interface] Link down, terminating
E00000035: [15:interface] SendError 21a4540 status 3

What do you think?

I’m no knxd expert, but AFAIK “link down” indicates that the connection to your bus got killed or the bus was unresponsive for a certain amount of time. I only see this in my log when I basically unplug the bus cables from my adapter or the adapter itself. What would help in your case would be a watchdog that automatically tries to restart knxd once it is down, but I lack the Linux skills to do so.

@illalla if you try to add “usb_filters”: “single,queue”, and see if that resolves your issue. The knxd has also received an update related to timeout on the bus when using USB devices that might also resolve the issue, have not been able to try it myself, but you can try to rebuild the addon.

My config that works at the moment

address: 0.0.1
client_address: '0.0.2:10'
interface: usb
device: ''
usb_filters: 'single,queue'
custom_config: |-
  [main]
  addr = 0.0.1
  client-addrs = 0.0.2:10
  connections = server,A.tcp,interface
  logfile = /dev/stdout

  [A.tcp]
  server = knxd_tcp

  [server]
  server = ets_router
  tunnel = tunnel
  router = router
  discover = true
  name = knxd

  [interface]
  driver = usb
  device = 
  send-timeout = 3000
  filters = single,queue

I will check my raspberry setup, but I hope all cables are well-connected :crossed_fingers: The watchdog would be for sure a great help!

I just updated my configuration, let’s see what happens. Thanks!
I will also check your configuration and try to apply it (or something similar) to my case.
Hope to find some time to better understand how the platform works and to maybe rebuild the addon.

I will keep you updated!

HI,
I wanted to install the addon today as I also have the TPUART stick which currently running on a separate RPI, which I want to get rid of. Anyway, when installing the addon it says an error occured. From the logs I can see this:

20-04-10 05:36:53 ERROR (SyncWorker_8) [supervisor.docker.addon] Can't build ecaeb50e/amd64-addon-knxd:0.3.3: The command '/bin/ash -o pipefail -c set -xe     && apk update     && apk add --no-cache --virtual .build-dependencies                 jq                 build-base                 gcc                 git                 abuild                 binutils                 automake                 autoconf                 libtool                 argp-standalone                 linux-headers                 libev-dev                 libusb-dev                 cmake                 dev86      && apk add --no-cache                 udev                 libusb                 libev      && git clone -b stable https://github.com/knxd/knxd.git      && cd knxd      && ./bootstrap.sh      && ./configure --disable-systemd --enable-tpuart --enable-usb --enable-eibnetipserver --enable-eibnetip --enable-eibnetserver --enable-eibnetiptunnel      && mkdir -p src/include/sys && ln -s /usr/lib/bcc/include/sys/cdefs.h src/include/sys      && make      && make install      && apk del --purge .build-dependencies' returned a non-zero code: 2

Anyone experienced such error before or is it related to the new knxd version?

UPDATE: I was trying to build it locally and I think it’s related to the recent change of knxd build branches. When checking out deb branch instead of stable the add-on compiles.

@da-anda: Can you check if your Dockerfile might be updated in line 28 to:

&& git clone https://github.com/knxd/knxd.git --single-branch --branch deb \

I’m using the latest supervisor from HASS.IO and latest HA.

Regards,
Michel

Just to chime in, the page https://github.com/knxd/knxd have a rather large “STOP” heading that says one should use deb when building for debian and its cousines as also @michelde has confirmed. I did create a PR https://github.com/da-anda/hass-io-addons/pull/7 Could you @da-anda please take a look at it? Thanks!

isn’t the deb branch only for debian based builds while others still would need the stable branch? I still run Resin/Alpine on my RPI2, so at least I likely will run into issues, but I can give it a try. Need to update to the recent debian based HASS.io distro at some point anyways though - just tried to postpone it until I have more time again.

I have very limited knowledge of Linux, Docker, Hass.io and Hass addons so I might be completely wrong on this :slight_smile: My understanding and assumption is that the hass addon is a docker container and that container is based on a base image. If that base images is in turn based on a “Debian-version” of linux then knxd should be built from deb branch. But I could of course be completly wrong!

HI da-anda,
After finishing installation, I press start but nothing, Do we need to do right configure before press start? I usd USB KNX ABB , in rasbperrian , I success connecting to KNX via knxd but in hass, I don’t know where to initiate usb port. Could you give me some advice. Thanks!