Cannot get KNXD to work

  • Platform information:
    • Hardware: _raspberry pi 4b 4gb ram
    • OS: Openhabian
    • openHAB version: 3
      Hello everybody
      I am a really noob in these things but i cant get KNXD up and running i tried for 2 days and i begin to start that i do something completly wrong. are there any people on here who could possibly help me?

Thx in advance
Jari

I guess there is an outdated information about configuration via /etc/default/knxd, that is no longer true. Instead use /etc/knxd.conf to setup the daemon. This is because systemd is used as init system.

knxd is configured as a minimal service by default, so at least you should set -DTRS to enable Server for Tunnel (T), Router (S), Discovery Service (D) and enabling Routing (R) itself.
Furthermore, you have to add your Interface to link knxd to your knx bus. That is possible via many different devices (usb, rs232, ip tunnel…).
Please also ensure to use only unused individual addresses (-e and -E parameter)
Please be aware that you don’t need knxd if you already have a knx/IP gateway and you must not use -S in combination with ip:, as only one Routing interface is allowed, either knxd client or server side.

hello thanks for the fast reaction and sorry for my late reaction.
i editted the following line in the /etc/knxd.conf file
KNXD_OPTIONS="–eibaddr=0.1.150 --client-addrs=0.1.151:8 -d -DTRS -i --listen-local=/tmp/knx -b usb:"
is this ok or do i need something else. i use a zennio knx usb interface because i dont have a knxnetip router. so how do i add this usb device?
Thx alot

I’m not sure about usb, as I never used them. But according to a quick research :wink: the config should suffice.
I don’t know if --listen-local is useful or not. At least if starting knxd, you should see some info if bus contact succeeded.

In openHAB, create a knx Bridge in ROUTER Mode, no additional configuration needed (please don’t set localSourceAddress at all) localIp should be 127.0.0.1 or the ip of your Raspberry, maybe you can leave it empty.

Create a generic knx Thing and link it to the Bridge. Create a channel within this Thing. set some GA (best practice is to start with a switch as it does only need two GA for set and get)
Both Things (Bridge and generic Thing) should be online.

hello today i tried to get it running again en found out i cant start knxd.service
this is what i get as response

[18:28:46] root@openhabian:/home/openhabian# systemctl start knxd.service
Job for knxd.service failed because the control process exited with error code.
See “systemctl status knxd.service” and “journalctl -xe” for details.
[18:29:11] root@openhabian:/home/openhabian# systemctl status knxd.service
● knxd.service - KNX Daemon
Loaded: loaded (/lib/systemd/system/knxd.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Fri 2021-08-13 18:29:32 CEST; 1s ago
Process: 2336 ExecStart=/usr/bin/knxd $KNXD_OPTS (code=exited, status=2)
Main PID: 2336 (code=exited, status=2)
[18:29:33] root@openhabian:/home/openhabian# journalctl -xe

– A start job for unit knxd.service has begun execution.

– The job identifier is 2706.
Aug 13 18:30:54 openhabian knxd[2423]: Usage: knxd [-l?V] [–list] [–help] [–usage] [–version]
Aug 13 18:30:54 openhabian knxd[2423]: knxd configfile [main_section]
Aug 13 18:30:54 openhabian knxd[2423]: Please consult /usr/share/doc/knxd/inifile.rst
Aug 13 18:30:54 openhabian systemd[1]: knxd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
– Subject: Unit process exited
– Defined-By: systemd
– Support:

– An ExecStart= process belonging to unit knxd.service has exited.

– The process’ exit code is ‘exited’ and its exit status is 2.
Aug 13 18:30:54 openhabian systemd[1]: knxd.service: Failed with result ‘exit-code’.
– Subject: Unit failed
– Defined-By: systemd


– The unit knxd.service has entered the ‘failed’ state with result ‘exit-code’.
Aug 13 18:30:54 openhabian systemd[1]: Failed to start KNX Daemon.
– Subject: A start job for unit knxd.service has failed
– Defined-By: systemd
– Support:

– A start job for unit knxd.service has finished with a failure.

– The job identifier is 2706 and the job result is failed.
lines 4049-4077/4077 (END)

how can i resolve this problem?
i had to remove the links
thx alot

INVALIDARGUMENT

Seems you did set wrong $KNXD_OPTS :slight_smile:
So what is the exact configuration of /etc/knxd.conf?

Maybe try a more generic configuration:

KNXD_OPTS="–e 0.1.150 -E 0.1.151:8 -DTRS -b usb:"

Please be aware that there are some hints in the file not to use -d -i -u as systemd takes care of that part. I’m pretty sure you don’t need the listenlocal part at all.

hello today i tried again and knxd is looking for a file but it doesn’t exist my knxd.conf file looks like this.

# configuration for knxd.service
KNXD_OPTS="-e 0.1.150 -E 0.1.151:8 -DTRS -b usb: 1:3:1:0:0"

# configuration for knxd.service using new configuration format in /etc/knxd.ini
# use only this line if you used knxd_args to convert your old startup options
# KNXD_OPTS=/etc/knxd.ini

# The default options are "-u /tmp/eib -b ip:"
# which tell knxd to route between all of
#  /tmp/eib (legacy socket (-u))
#  multicast client (-b ip:).
# knxd's own bus address is 0.0.1; it will assign 0.0.2…0.0.9 to clients.
# The knxd.socket file also tells knxd to listen to
#  /run/eib (socket activation via systemd)
#  TCP port 6720 (socket activation via systemd)
# You *need* the -e option. Clients cannot connect without "-E".

# You can read knxd's logs with
# $ journalctl -u knxd --since "10 min ago"
# (or whatever). See the manpage for details.
# You need to be a member of the "adm" group.
# Add "-f9 -t1023" to the beginning of the command line for extensive logging.

# *** DO NOT use "-u" / "-u /run/knx" or "-i" / "-i 6720" here.
# Systemd already does that on behalf of knxd, via 'knx.socket'.

# *** DO NOT use both "-RS" and "-b ip:" (unless you specify a
# different multicast address on one of them). You'd create a loop.

# If you have KNX hardware on a serial port or USB, add the appropriate
# "-b TYPE:…" option. In this case, you probably want to set up a multicast
# server, not a client (i.e. use "-D -T -R -S", not "-b ip:").
# DO NOT use both.
#
# If your KNX hardware is a KNX/IP gateway that doesn't do multicast,
# use "-b ipt:192.168.1.2" (or its DNS name) to talk to it.
#
# KNX MUST NOT have more than one path between any two devices. Thus,
# you need to make sure that the KNX/IP gateway does not route multicast
# before you use both "-S" and "-b ipt:".

# The default bus address of knxd is 0.0.1. If that's in use in your KNX
# network (or if you run more than one knxd on your network), set a
# different address, for example "-e 7.0.99".

# You should have a block of free addresses on your KNX bus which knxd can
# assign to clients: "-E 7.0.100:28" will use 7.0.100 through 7.0.127.
# If no such range is given, or if it's full, knxd uses its own address.
# That mostly works, but separate addresses are much better.

# Run `knxd --help` to get a complete list of available options and drivers.
## DO NOT use the following options:
## -i           -- /lib/systemd/system/knxd.socket does this for us
## -u /run/knx  -- likewise
## -d           -- /lib/systemd/system/knxd.service expects knxd to run in the foreground
## -p PIDFILE   -- please use systemctl to control knxd

###############################################################################
# This file is ignored when NOT using systemd: edit /etc/default/knxd instead #
###############################################################################
## DO NOT use the following options:
## -i           -- /lib/systemd/system/knxd.socket does this for us
## -u /run/knx  -- likewise
## -d           -- /lib/systemd/system/knxd.service expects knxd to run in the foreground
## -p PIDFILE   -- please use systemctl to control knxd

###############################################################################
# This file is ignored when NOT using systemd: edit /etc/default/knxd instead #
###############################################################################

this is what i get when i run systemctl status knxd

openhabian@openhabian:~ $ systemctl status knxd
● knxd.service - KNX Daemon
   Loaded: loaded (/etc/systemd/system/knxd.service; enabled; vendor preset: enabled)
   Active: failed (Result: timeout) since Thu 2021-08-19 17:39:29 CEST; 26s ago
  Process: 721 ExecStart=/usr/local/bin/knxd -p /run/knxd/knxd.pid $KNXD_OPTIONS (code=exited, status=0/SUCCESS)

Aug 19 17:37:45 openhabian systemd[1]: Starting KNX Daemon...
Aug 19 17:37:45 openhabian knxd[721]: E00000067: [22:C.tpuarts] Opening /dev/ttyAMA0 failed: Permission denied
Aug 19 17:37:45 openhabian systemd[1]: knxd.service: Can't open PID file /run/knxd/knxd.pid (yet?) after start: No such
Aug 19 17:37:45 openhabian knxd[721]: E00000013: [11:A.tcp] OpenInetSocket 6720: bind: Address already in use
Aug 19 17:37:45 openhabian knxd[721]: F00000105: [19:C.tpuarts] Link down, terminating
Aug 19 17:37:45 openhabian knxd[721]: F00000105: [11:A.tcp] Link down, terminating
Aug 19 17:39:29 openhabian systemd[1]: knxd.service: Start operation timed out. Terminating.
Aug 19 17:39:29 openhabian systemd[1]: knxd.service: Failed with result 'timeout'.
Aug 19 17:39:29 openhabian systemd[1]: Failed to start KNX Daemon.
lines 1-14/14 (END)

i hope you can find my problem
thx again for your help

What’s the OS Version?
What’s the content of /etc/systemd/system/knxd.service?

knxd.service file should be found in /lib/systemd/system/, not in /etc/systemd/system/