Raspberry Pi: EIB/KNX IP Gateway and Router with knxd

Hi,

in my previous posts EIB/KNX Router with an USB Interface and KNX/EIB Router with a TPUART module I described how to use a Raspberry PI as EIB/KNX Router with eibd.

eibd is no longer in development so I decided to give knxd, a fork of eibd, a try:-) The script attached at the end of the post is written for raspbian but should also work an all debian system with systemd imit system.


This post is based on my previous posts regarding eibd. The script at the end of the post installs knxd with support for EIB/KNX Router with TPUART and for USB EIB/KNX interfaces. This is the first shot if you got any errors feel free to report it by a comment.

First of all install raspbian in the well known way and update to the latest version of firmware and operating system

pi@raspberry~: $ sudo su -
root@raspberry:~# apt-get update && apt-get upgrade
root@raspberry:~# rpi-update
root@raspberry:~# reboot

Hint for Raspberry Pi 3 User (Comment from Adrian): It is import to enable the serial device within raspi-config. The serial port must be set to ttyS0 not ttyAMA0 on RPI3 at the latest raspbian release.

login as root and configure a static IP Address. To get a root, login as user pi and call sudo

pi@raspberry~: $ sudo su -
root@raspberry:~#

Create new file /etc/systemd/network/eth0.network Name is not importend, just the suffix/extension network.

[Match]
# You can also use wildcards. Maybe you want enable dhcp
# an all eth* NICs
Name=eth0
[Network]
#DHCP=v4
# static IP
# 192.168.100.2 netmask 255.255.255.0
Address=192.168.100.2/24
Gateway=192.168.100.1
DNS=192.168.100.1
# Route for Multicast Address EIB/KNX
[Route]
Destination=224.0.23.12/32

Disable the old way to configure the network, enable systemd based network configuration, enable systemd generated resolve.conf (DNS resolution) and disable dhcpcd.

root@raspberry:~# mv /etc/network/interfaces /etc/network/interfaces.save
root@raspberry:~# systemctl enable systemd-networkd.service
root@raspberry:~# systemctl enable systemd-resolved.service
root@raspberry:~# systemctl start systemd-resolved.service
root@raspberry:~# systemctl disable dhcpcd.service
root@raspberry:~# systemctl enable systemd-networkd-wait-online.service

Set an link from the system wide resolve.conf to systemd

root@raspberry:~# mv /etc/resolv.conf /etc/resolv.conf.save
root@raspberry:~# ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

Reboot to get the config active

root@raspberry:~# reboot

Make sure an internet connection is available

root@raspberry~: $  ping -c 2 www.heise.de
PING www.heise.de (193.99.144.85) 56(84) bytes of data
64 bytes from 193.99.144.85: icmp_req=1 ttl=128 time=8.551 ms
64 bytes from 193.99.144.85: icmp_req=2 ttl=128 time=9.680 ms

--- 193.99.144.85 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 0.551/0.615/0.680/0.069 ms

Time to start installing knxd. The script must be run as root because some files are copied and modified in locations where only root have the appropriate permissions. Access to /dev/ttyAMA0 is just requiered if you want to use TPUART or a FT1.2 (BCU2) backend.

What the script does:

  • Check for root permissions
  • Download and compile pthsem
  • Download knxd sources from github
  • installing knxd binaries to /usr/local/bin
  • create a systemd service knxd
  • Add a user and group knxd with group membership dialout (to access serial device /dev/ttyAMA0)
  • Add user pi to knxd group
  • Disable bootmessages on serial interface /dev/ttyAMA0
  • Disable console on serial interface /dev/ttyAMA0
  • Define udev rules to accessing the KNX USB Device at a low level layer by group knxd. I have added all interfaces for which I found a USB Vendor- and ProductID. Maybe your device is not in the list, then you have to add this manually to file /etc/udev/rules.d/90-knxusb-devices.rules. Determine the ID by lsusb.
  • On Raspberry Pi 3 it disable the bluetooth module because its uses ttyAMA0 by default

For the following devices a udev rule is installed (Source KNX User Forum).

KNX USB Interface Vendor ID Product ID
Siemens KNX/EIB-USB Interface (Flush mounted) 0e77 0111
Siemens KNX/EIB-USB Interface (DIN rail) 0e77 0112
Siemens OCI700 Service Interface 0681 0014
Merlin Gerin KNX-USB Interface (Flush mounted) 0e77 0141
Hensel KNX-USB Interface (Rail mounted) 0e77 0121
Busch-Jaeger KNX-USB Interface (Flush mounted) 145C 1330
Busch-Jaeger KNX-USB Interface (surface mounted) 145C 1490
ABB STOTZ-KONTAKT KNX-USB Interface (MDRC) 147B 5120
Feller KNX-USB Data Interface 135E 0026
JUNG KNX-USB Data Interface 135E 0023
Gira KNX-USB Data Interface 135E 0022
Berker KNX-USB Data Interface 135E 0021
Insta KNX-USB Data Interface 135E 0020
Weinzierl KNX-USB Interface (Flush mounted) 0e77 0102
Weinzierl KNX-USB Interface (RS232) 0e77 0103
Weinzierl KNX-USB Interface (Rail mounted) 0e77 0104
Tapko USB Interface 16D0 0490
Hager KNX-USB Data Interface 135E 0025
Preussen Automation USB2KNX 16D0 0492
Merten KNX-USB Data Interface 135E 0024
b+b EIBWeiche USB 04cc 0301
MDT KNX_USB_Interface 16D0 0491

If there are further more, please let me know and I will integrate them to script.

On a Raspberry Pi 3 it is strongly recommended to update to the latest Kernel to addressing some issues with the serial device ttyAMA0

pi@raspberry~: $ sudo su
root@raspberry~: # rpi-update
root@raspberry~: # reboot

Start a root shell, get the script.

pi@raspberry~: $ sudo su
root@raspberry~: #
root@raspberry~: # wget http://michlstechblog.info/blog/download/electronic/install_knxd_systemd.sh

The highlighted eibd features are enabled. Alter the script if you need additional features.
–enable-ft12 enable FT1.2 backend
–enable-pei16 enable BCU1 kernel driver backend
–enable-pei16s enable BCU1 user driver backend (very experimental)
–enable-tpuarts enable TPUART user driver backend
–enable-eibnetip enable EIBnet/IP routing backend
–enable-eibnetiptunnel enable EIBnet/IP tunneling backend
–enable-usb enable USB backend
–enable-eibnetipserver enable EIBnet/IP server frontend
–enable-groupcache enable Group Cache (default: yes)
–enable-java build java client library

Start the script. This should be run about 20 minutes. Do not execute update-rc.d on debian jessie.

root@raspberry~: # chmod +x ./install_knxd_systemd.sh
root@raspberry~: # ./install_knxd_systemd.sh

After the script has finished. knxd, findknxusb, knxtool, findknxusb and some other tools should be installed at /usr/local/bin, the systemd service script for knxd in /lib/systemd/system/knxd.service and the link to start knxd at boottime /etc/systemd/system/multi-user.target.wants/knxd.service must exists..

root@raspberry~: # ls -l /usr/local/bin
.....
-rwxr-xr-x 1 root staff 839016 Jun 13 22:14 knxd
-rwxr-xr-x 1 root staff   7584 Jun 13 22:14 findknxusb
....
root@raspberry~: # ls -l /etc/systemd/system/multi-user.target.wants/knxd.service
lrwxrwxrwx 1 root root 14 Jun 13 22:15 ...  -> /lib/systemd/system/knxd.service

Reboot your device

If you want to disable the graphic desktop and just want to boot into the text console change the default target

root@raspberry~: # systemctl set-default -f multi-user.target

After installing you have to decide which interfaces you want to use(Default TPUARTS at /dev/ttyAMA0). With this configuration knxd must come up after a reboot because knxd could check if a TPUART module is present.

root@raspberry~: # ps ax|grep knxd
 416 ?        Ss     0:00 /usr/local/bin/knxd -p /run/knxd/knxd.pid --eibaddr=1.1.128 -d -D -T -R -S -i --listen-local=/tmp/knx tpuarts:/dev/ttyAMA0

If you want use a USB Interfacces open /etc/default/knxd and comment the TPUART line and remove the comment # character at the begin of the USB definition.

# Command line parameters for knxd. TPUART Backend
# Serial device Raspberry
# KNXD_OPTIONS="--eibaddr=1.1.128 --client-addrs=1.1.129:8 -d -D -T -R -S -i --listen-local=/tmp/knx -b tpuart:/dev/ttyAMA0"
# Serial device PC
# KNXD_OPTIONS="--eibaddr=1.1.128 --client-addrs=1.1.129:8 -d -D -T -R -S -i --listen-local=/tmp/knx -b tpuart:/dev/ttyS0"
# Tunnel Backend
# KNXD_OPTIONS="--eibaddr=1.1.128 --client-addrs=1.1.129:8 -d -D -T -R -S -i --listen-local=/tmp/knx -b ipt:192.168.56.1"
# USB Backend
KNXD_OPTIONS="--eibaddr=1.1.128 --client-addrs=1.1.129:8 -d -D -T -R -S -i --listen-local=/tmp/knx -b usb:"

Since knxd Version 0.14 it is no longer necessary to specify the USB Device ID. knxd recognize possible devices at startup. Nevertheless when knxd is not running, you can look if a USB devices were found by using findknxusb.

The following knxd options are predefined at /etc/default/knxd

  • EIB Busaddress of the daemon 1.1.128
  • A range of EIB Busaddresses which were assigned to clients(e.q. ETS ..) connected to knxd. 1.1.129:8 means a range of 8 client addresses from 1.1.129 to 1.1.136
  • EIBnet/IP server
  • EIBnet/IP Routing
  • EIBnet/IP Tunneling
  • Answer discovery and description requests
  • Listen on UNIX domain socket /tmp/knx
  • Listen on TCP port, default 6720

Check if you see EIB packets on wire.

pi@raspberry~: # knxtool vbusmonitor1 ip:localhost
LPDU: BC 11 17 00 03 C1 00 81 06 :L_Data low from 1.1.23 to 0/0/3 hops: 04 T_DATA_XXX_REQ A_GroupValue_Write (small) 01 LPDU: CC :ACK
LPDU: BC 11 17 00 03 81 00 81 46 :L_Data low from 1.1.23 to 0/0/3 hops: 00 T_DATA_XXX_REQ A_GroupValue_Write (small) 01 LPDU: CC :ACK

Thats it. Comments are welcome!

Michael

Script to compile and install knxd on debian jessie
Script to compile and install knxd on debian jessie
install_knxd_systemd.sh
Version: 0.7.9
13.4 KiB
4044 Downloads
Details...

Add a comment »233 comments to this article

  1. Works great! Thanks!

    Reply

  2. Hi, Thanks for the info
    I have a problem when I run the scrip “chmod + x ./install_knxd_systemd.sh” and “./install_knxd_systemd.sh”
    nothing appears on the console.
    I am using a RPi2 and raspbian jessie

    Thank you so much!!

    Reply

    • Hi P.,

      which files shows

      ls -l

      Michael

      Reply

      • Hello, Thanks for your help
        This is what he writes
        root@raspberrypi:~# chmod +x ./install_knxd_systemd.sh
        root@raspberrypi:~# ls -l
        total 12
        -rwxr-xr-x 1 root root 9886 Jul 14 06:53 install_knxd_systemd.sh
        root@raspberrypi:~# ./install_knxd_systemd.sh
        root@raspberrypi:~# ls -l
        total 12
        -rwxr-xr-x 1 root root 9886 Jul 14 06:53 install_knxd_systemd.sh
        root@raspberrypi:~#

        Reply

        • Hi P.,

          try again. I disabled the set -e flag in the script

          Michael

          Reply

          • Hi Michael,
            Now if I work, thank you very much !!!

  3. hey thanks for that great script. everything runs fine the knxd deamon is running on my side but when i try to see packets on the bus i cant see anything. i did a clean install on a Raspberry 2 with Jessie. I am an absolute Linux Noob and it took me nearly 2 nights to come to this point.
    I am using an ABB USB/S 1.1 KNX Interface changed the /etc/default/knxd to the USB option. and did everything as described. do i have to set parameters for the USB Interface from ETS Side ? or is something wrong with the route ip [Route]
    Destination=224.0.23.12/32
    i set everthing there like you described for static IP configuration accept for the IP an DNS Gateway. mine is 192.168.1.100 and gateway at 192.168.1.1

    this is what i get with the command you described

    pi@raspberrypi:~ $ ps ax|grep knxd
    414 ? Ss 0:00 /usr/local/bin/knxd -p /run/knxd/knxd.pid –eibaddr=1.1.128 -d -D -T -R -S -i –listen-local=/tmp/knx usb:%DEVICEID%
    473 pts/0 S+ 0:00 grep –color=auto knxd
    pi@raspberrypi:~ $ knxtool vbusmonitor1 ip:localhost

    and then nothing 🙁

    do you have an idea what i can check to confirm service is running in htop it looks like everything is running fine htop is listing the knxd service.

    Reply

    • this is what eth0.network config looks like

      pi@raspberrypi:~ $ ip addr show
      1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
      inet 127.0.0.1/8 scope host lo
      valid_lft forever preferred_lft forever
      inet6 ::1/128 scope host
      valid_lft forever preferred_lft forever
      2: eth0: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
      link/ether b8:27:eb:82:fb:77 brd ff:ff:ff:ff:ff:ff
      inet 192.168.1.100/24 brd 192.168.1.255 scope global eth0
      valid_lft forever preferred_lft forever
      inet6 fe80::ba27:ebff:fe82:fb77/64 scope link
      valid_lft forever preferred_lft forever

      Reply

    • Hi Philipp,

      pi@raspberrypi:~ $ ps ax|grep knxd
      414 ? Ss 0:00 /usr/local/bin/knxd -p /run/knxd/knxd.pid -eibaddr=1.1.128 -d -D -T -R -S -i -listen-local=/tmp/knx usb:%DEVICEID%
      473 pts/0 S+ 0:00 grep -color=auto knxd

      There is something wrong. %DEVICEID% as command line parameter is wrong. /usr/local/bin/knxd-findusb.sh must set the Device ID of your USB device in /etc/default/knxd .

      Can you execute

      /usr/local/bin/knxd-findusb.sh

      to see what’s happend. Whats the content of /etc/default/knxd

      cat /etc/default/knxd

      Michael

      Reply

      • Thanks for your fast reply. Yes this is what i was figuring out within the last few hours. I ran the findusb.sh and found the correct type of usb interface i am using abb. I did nothing just rebooted a few times checked knxd pid status and there it was i checked a groupwrite and the interface was blinking and the lamp turned on. Somehow i still get no response from vbusmonitor1 but some of the other busmonitor tools are working and i can check the traffic of the bus. awesome work dude !!!!

        All this is still blackmagic to me ^^ but now i connected the knxd service to fhem and can toggle the whole knx system through my ipad now. again thanks a lot for all your work realy appreciate this.

        Ah one point just to give some feedback from a linux noob point of view. Somehow your advice

        Create new file /etc/systemd/network/eth0.network. Name is not importend, just the prefix network.

        Confused me a lot and took me a whole night to figure out. I just didnt realize that you realy did a dot at the end of a sentence. I read it like i must call the file eth0.network.config or something else. The second sentence about the prefix network with again a dot at the end just confused everything for me. I think this is no prefix its an extension isnt it ? Maybe you can set this in ” ” to make everythin absolutly noob proof. But it was also the first time i was setting up a static ip on an linux system. I think everything i did the last two days was for the first time. But i learned a lot thx again. Have a nice day.

        Reply

        • Hi Philipp,

          thanks for that hint. I’ve reformulate it. Also prefix was wrong, it must be the suffix or fileextentsion.

          Michael

          Reply

  4. Works fine. No problem at all. Thanks.

    Reply

  5. Hi Michael, thanks a lot for your excelent work. I got yesterday my raspi3 and now knxd is running:-)
    Just a comment (maybe improvement). I have a USB interface, which wasn’t found by /usr/local/bin/knxd-findusb.sh (the grep didn’t work). I did the steps in your script manually and the USBID was found.
    Just change your grep to
    grep -e “^\s*KNXD_OPTIONS\=.*usb\:” /etc/default/knxd
    dont escape ^ like you did \^.

    As the device could change, e.g. when you change the USB connector, than the originally found USB device will be the wrong, but is hardcoded in /etc/defaults/knxd.
    Wouldn’t it be better to export the $USBID and just leave the variable in etc/defaults/knxd. Like this
    export USBID=$(/usr/local/bin/findknxusb | grep device: | cut -d’ ‘ -f2)

    KNXD_OPTIONS=”–eibaddr=0.1.254 -d -D -T -R -S -i –listen-local=/tmp/knx usb:$USBID”

    . /etc/defaults/knxd ; echo $KNXD_OPTIONS

    Than, the USBID can change and despite of the start script get the right ID.

    Unfortunately the knxd.service didn’t work as well. Don’t know why.
    A manually start of
    knxd –eibaddr=0.1.254 -d -D -T -R -S -i –listen-local=/tmp/knx usb:1:5:1:0:0 -p /run/knxd/knxd.pid
    works.

    Reply

    • Hi Michael,

      thank you. I fixed the bug with grep. You’re right. Just $ and ` have to escape by creating files with “cat”.

      “export USBID=$(/usr/local/bin/findknxusb | grep device: | cut -d’ ‘ -f2)

      KNXD_OPTIONS=”–eibaddr=0.1.254 -d -D -T -R -S -i –listen-local=/tmp/knx usb:$USBID”

      . /etc/defaults/knxd ; echo $KNXD_OPTIONS

      Then, the USBID can change and despite of the start script get the right ID.” => This is also a possibility. The USB device id is not hardcoded at /etc/default/knxd. In the knxd systemd service file findknxusb is called at each the service unit starts and should update /etc/default/knxd with the new USB Address.

      The problem on plugging the usb interface is that knxd have to restart each time you do such an action, because the Address is a command line parameter and could not changed for a running daemon. :-). An approach is to add a udevd rule on inserting a device. For example, if you owned a GIRA Interface add this line to /etc/udev/rules.d/90-knxusb-devices.rules

      SUBSYSTEM==”usb”, ATTR{idVendor}==”135e”, ATTR{idProduct}==”0022″, ACTION==”add”, RUN+=”systemctl restart knxd.service”

      But not 100% sure if this will work. I can’t test it because I have no USB device.

      Michael

      Reply

      • Hi Michael,
        >The USB device id is not hardcoded at /etc/default/knxd. In the knxd systemd service file findknxusb is called at each the service unit starts and should update /etc/default/knxd with the new USB Address.

        As far as I understand your script, it runs on every restart, that’s right. But the substitution in /etc/defaults/knxd can just take place once, as than the $USBID variable disapperes after the first start and your substitution wouldn’t find that string. In place of $USBID is now a different string.
        That’s why I made the above mentioned suggestion. The $USBID must be dynamic.

        At the moment I have no chance to look at your script (as I’m at work), so finally I could be wrong.

        Michael

        Reply

        • Hi Michael,

          substitution (should) is also done at every time the script runs:

          sed -e”s/usb:.*\$/usb:$USBID\”/”

          sed looks for the string “usb:Any Characters till end of line” and replaces them with usb:$USBID

          If not you found another bug 😉

          Michael

          Reply

          • No, I think you are right and I was wrong. Everything is fine then 🙂
            Thanks a lot for your excellent work!

  6. Hi Michael. Thanks for all this great work – its really useful.
    Thanks – Colin

    Reply

  7. Hi Michael,
    I wonder if you could help me debug an issue I’m having. I have installed openhab with a KNX binding and your excellent knxd service on Raspberry Pi. I can connect to the knxd router from ETS4 and monitor KNX telegrams on the Pi using vbusmonitor1. However when trying to change a group address setting to turn off a light via Openhab it just doesn’t work. Everything in the logs looks ok, and I believe the configuration is correct for Openhab – I have tried various different combinations.
    Please see log snippet from openhab
    00:06:02.282 [DEBUG] [.KNXBindingDatapointReaderTask:58 ] – Autorefresh: Waiting for new item in reader queue
    00:06:02.289 [DEBUG] [b.k.i.connection.KNXConnection:296 ] – KNXBinding configuration present. Setting up KNX bus connection.
    00:06:02.295 [DEBUG] [b.k.i.connection.KNXConnection:408 ] – Not connected yet. Trying to connect.
    00:06:02.388 [INFO ] [b.k.i.connection.KNXConnection:212 ] – Established connection to KNX bus on 224.0.23.12:6720 in mode ROUTER.
    00:06:02.407 [DEBUG] [b.k.i.connection.KNXConnection:419 ] – Success: connected.
    00:06:17.520 [DEBUG] [.b.knx.internal.bus.KNXBinding:138 ] – Wrote value ‘ON’ to datapoint ‘command DP 2/0/0 light, DPT main 0 id 1.001, low pri ority’
    00:06:17.524 [DEBUG] [.b.knx.internal.bus.KNXBinding:169 ] – Received groupWrite Event.
    00:06:21.876 [DEBUG] [.b.knx.internal.bus.KNXBinding:138 ] – Wrote value ‘OFF’ to datapoint ‘command DP 2/0/0 light, DPT main 0 id 1.001, low pr iority’
    00:06:21.876 [DEBUG] [.b.knx.internal.bus.KNXBinding:169 ] – Received groupWrite Event.
    00:06:23.394 [DEBUG] [.b.knx.internal.bus.KNXBinding:169 ] – Received groupWrite Event.
    00:06:23.395 [DEBUG] [.b.knx.internal.bus.KNXBinding:138 ] – Wrote value ‘ON’ to datapoint ‘command DP 2/0/0 light, DPT main 0 id 1.001, low pri ority’
    00:06:25.157 [DEBUG] [.b.knx.internal.bus.KNXBinding:138 ] – Wrote value ‘OFF’ to datapoint ‘command DP 2/0/0 light, DPT main 0 id 1.001, low pr iority’
    00:06:25.157 [DEBUG] [.b.knx.internal.bus.KNXBinding:169 ] – Received groupWrite Event.
    00:06:26.310 [DEBUG] [.b.knx.internal.bus.KNXBinding:138 ] – Wrote value ‘ON’ to datapoint ‘command DP 2/0/0 light, DPT main 0 id 1.001, low pri ority’

    Very much hope you can help.
    Thanks – Colin

    Reply

    • Hi Michael, I have solved my issue. It appears I was amending the wrong openhab.cfg file. Please dont waste any time on my query.
      thanks – Colin

      Reply

    • Hello Colin,

      Do you want to give a short disription of how you connected this with openHab? I’m working on a simular project!

      Reply

  8. You are great! Thanks!

    Reply

  9. By the way, I’m now working on making it to work on beaglebone black/green. When I get to something maybe I can sahre with you.

    Reply

  10. Hi,

    would this also work with the pigator from busware?

    Best regards
    Daniel

    Reply

    • Hi Daniel,

      yes this device should work. It uses a TPUART Chip to connect to the KNX bus.

      Michael

      Reply

  11. Hi Michael,

    thanks for the great job! It works perfect for me and I learnt a lot.

    However, it looks like that the wireless network adapter on the Pi3 is now being deactivated and I wonder what needs to be done to get the wlan up and running again under systemd. I already spent some hours trying to find a solution but without any success.

    Can you please give some advice to a newbie?

    Best regards
    Joachim

    Reply

  12. I’m running into some issues (two to be precise) as well.

    1) Knxd service is not starting (see: goo.gl/oZmxDt)
    /etc/systemd/system/multi-user.target.wants/knxd.service is there and configured as mentioned in your article. My initial idea is that there’s something wrong with the KNXD_OPTIONS environment variable, as I am able to get the knxd started by specifying the options manually and calling for instance “/usr/local/bin/knxd -p /run/knxd/knxd.pid –eibaddr=1.1.128 -d -D -T -R -S -i –listen-local=/tmp/knx tpuarts:/dev/ttyAMA0” via the console. Also if I do “export KNXD_OPTIONS –eibaddr=1.1.128 -d -D -T -R -S -i –listen-local=/tmp/knx tpuarts:/dev/ttyAMA0” and then call “/usr/local/bin/knxd -p /run/knxd/knxd.pid ${KNXD_OPTIONS}” through console, the knxd is starting so… Any thoughts / troubleshooting tips to pinpoint what’s happening here? “systemctl status knxd” isn’t really providing much more information other than the generic ERROR: 1/FAILED knxd not being able to start.

    2) Using knxd as an interface in ETS5
    Issue 1 aside, starting knxd manually *briefly* shows the knxd interface under discovered interfaces in ETS5 (along with Qualcomm Atheros? I think it’s the wireless network card of my laptop? weird). However selecting knxd as my interface and clicking the “Test” button results in “The interface is not reachable” (see: goo.gl/emKTDd). What is weird to me as well is that when I kill and restart knxd, the device becomes discoverable again but under a different port number (see: goo.gl/F6mDTg). Adding the interface manually under “Configured Interfaces” by providing the same details and default port 6720 doesn’t help.

    The only thing that I recall now is that I’ve set up the static IP on my raspberry pi as described in your initial article (the eibd one):

    auto eth0
    iface eth0 inet static
    address 192.168.1.31
    netmask 255.255.255.0
    gateway 192.168.1.1
    post-up route add -net 224.0.23.12 netmask 255.255.255.255 eth0
    pre-down route del -net 224.0.23.12 netmask 255.255.255.255 eth0

    It has been working flawlessly for connecting remotely to the pi through Putty. I’ll try the approach as described in the knxd article when I get back home and report back. In the meantime if you have any other suggestions / troubleshooting tips, I would be glad to hear them!

    Reply

    • Hi Nick,

      first of all please configure a static ip over systemd. What kind of Raspberry Pi are you using and how much LAN Adapters are configured?

      Can you post the content of /etc/default/knxd please.

      Your PC is in the same network/IP Range? What is the IP Address of your PC?

      What happens you try to start knxd manually

      sudo systemctl start knxd

      sudo journalctl -xn -u knxd

      Michael

      Reply

  13. Thank you a million times, i finally have a working KNX cheap gateway! It only took me ten years 😛

    Reply

  14. Hello Michael,
    I’m getting a little desperate overhere. I was using KNXD for a couple of months on my RPI3 until my USB Bus Coupler Died. I thought the easiest way is to buy the exact same bus coupler. I’m using a Hager TH101. In the beginning I was not using your script to install KNXD and it worked perfectly just compiling KNXD and PTHSEM myself. Tonight I noticed that the only thing that does work with the new buscoupler is the busmonitor. not the vbusmonitor that connects to the routermode. When I noticed this I gave it another shot and installed KNXD the way you describe above. Since my RPI3 started updating and upgrading I was a bit hopeful but after starting al services I have the exact same problem.

    When I perform knxtool busmonitor1 ip:localhost I can see my telegrams.

    When I try knxtool vbusmonitor1 ip:localhost I see nothing ..

    All settings are exactly as you described above. Do you have any clue how I can debug such issue?

    Kind regards,
    Stijn

    Reply

    • Hello Michael,

      I think knxd is running. It seems just a problem with the vbusmonitor1 subcommand. Can you connect with ETS?

      Michael

      Reply

    • Did you solved the Problem i think i ran into the same Situation here.
      Can see Telegrams in Busmonitor but not in vbusmonitor anymore.

      I can connect via ETS. but do not see Telegrams from Lightswitches. only when i do a ETS Groupswrite or KNXD Groupswrite i am able to see those via vbusmonitor.

      Reply

  15. Hi Michael;Thanks for the great job.
    Is there possible to connect with raspberrypi’SPI interface?

    Adrian

    Reply

    • Hi Adrian,

      have you more details? What is your intention?

      Michael

      Reply

      • I have a board that use a NCN5130 chip from ON Semiconductor and i think that work in SPI mode, would this work with the raspberrypi’SPI interface? and how to set up.Thanks a lot.

        Kind regards,
        Adrian

        Reply

        • Hello Adrian,

          a NCN5120 is supported by knxd:
          –enable-eibnetiptunnel enable EIBnet/IP tunneling backend
          –enable-usb enable USB backend
          –enable-ncn5120 enable NCN5120 backend
          –enable-eibnetipserver enable EIBnet/IP server frontend
          –enable-groupcache enable Group Cache (default: yes)

          maybe it works also with a NCN5130. If want to test it you must change my script and add a line to enable the NCN5120 backend. like this:

          –enable-eibnetipserver \
          –enable-groupcache \
          –enable-usb \
          –enable-ncn5120 \
          ….
          to the configure section at line 84.

          I have taken a look at the knxd source code:
          NCN5120SerialLayer2Driver::NCN5120SerialLayer2Driver (const char *dev,
          L2options *opt, Layer3 * l3)
          : Layer2::Layer2(l3, opt)
          {

          I think SPI wouldn’t work but NCN5120 and 5130 also speaks UART so you have to connect it to the serial interface of the raspberry.

          To enable the backend set
          KNXD_OPTIONS=”–eibaddr=1.1.128 -d -D -T -R -S -i –listen-local=/tmp/knx ncn5120:/dev/ttyAMA0″
          in
          /etc/default/knxd

          Michael

          Reply

          • Thank you so much,I’ll give it a try.

            Best regard!
            Adrian

          • Hi Michael:
            Thans for your help,i tested so many times folow your guide,that work with USB interface is well.but one issue is that always got a random port(the default IP Tunneling port 3671)and when I use ETS to select this Raspberrypi IP Router .the Raspberrypi IP Router is gone from the ETS’s “Discovered Interface”list and I only can use the computer’s network adapter with 224.0.23.12 to connect to the bus.

            work with the tpuarts
            I cant got any telegram from the KNX BUS,i have tested when I use a USB to TTL
            cable connect to NCN5120’uart side ,there a lot of date from the NCN5120 to the Serial Port Utility but from the raspberrypi’s side is got nothing. I’m use a raspberrypi 3B with 2016-09-23-raspbian-jessie-lite

            Regards
            Adrian

          • Hi Adrian,

            what do mean exactly with “always got a random port(the default IP Tunneling port 3671)and when I use ETS”. Which port do you mean? The port knxd listens to?

            A NCN5120 is not a tpuart but knxd supports that chip. I have altered the script to Version 0.6.3 and added the support for the ncn5120 backend. So have to recompile the knxd by downloading and executing the script again.

            In /etc/default/knxd you have to set

            KNXD_OPTIONS=”–eibaddr=1.1.128 -d -D -T -R -S -i –listen-local=/tmp/knx ncn5120:/dev/ttyAMA0

            Michael

          • for example:192.168.100.2:3671 for IP tunneling connect with ETS,but it got a random port like;192.168.100.2:36766 or else.

            I have seted
            KNXD_OPTIONS=”–eibaddr=1.1.128 -d -D -T -R -S -i –listen-local=/tmp/knx ncn5120:/dev/ttyAMA0″
            is that format correct? tow —

            Adrian

          • Hi Adrian,

            192.168.100.2 is the ip address where your knxd is running?

            NXD_OPTIONS=”–eibaddr=1.1.128 -d -D -T -R -S -i –listen-local=/tmp/knx ncn5120:/dev/ttyAMA0″ yes IMOO

            Michael

          • Hi Michael:
            actually this my setting:
            [Match]
            # You can also use wildcards. Maybe you want enable dhcp
            # an all eth* NICs
            Name=eth0
            [Network]
            #DHCP=v4
            # static IP
            # 192.168.1.1 netmask 255.255.255.0
            Address=192.168.1.198/24
            Gateway=192.168.1.1
            DNS=192.168.1.1
            # Route for Multicast Address EIB/KNX
            [Route]
            Destination=224.0.23.12/32

            when I run ps ax|grep knxd got this;
            476 pts/0 S+ 0:00 grep –color=auto knxd

            Adrian

          • Hi Adrian,

            192.168.100.2 is the IP Address of the box where ETS is running? Then the random port makes sence. Because outgoing connections usually uses random ports (source port). The import thing is the destination port in your environment 192.168.1.198:3671.

            To check the ports to which knxd is listen to

            root@debdev:~# netstat -pln|grep knxd
            tcp        0      0 0.0.0.0:6720            0.0.0.0:*               LISTEN      1587/knxd
            udp        0      0 0.0.0.0:3671            0.0.0.0:*                           1587/knxd
            

            But it seems your knxd isn’t running:
            ps ax|grep knxd got this;
            476 pts/0 S+ 0:00 grep –color=auto knxd
            because only the grep process is listed.

            What is the output of

            journalctl -xu knxd.service
            

            Michael

          • HI Michael;
            knxd is listen to:
            root@raspberrypi:/home/pi# netstat -pln|grep knxd
            tcp 0 0 0.0.0.0:6720 0.0.0.0:* LISTEN 448/knxd
            udp 0 0 0.0.0.0:41315 0.0.0.0:* 448/knxd
            udp 0 0 0.0.0.0:3671 0.0.0.0:* 448/knxd
            unix 2 [ ACC ] STREAM LISTENING 8857 448/knxd / tmp/knx

            That is the output of:
            root@raspberrypi:/home/pi# journalctl -xu knxd.service
            — Logs begin at Thu TIME UTC, end at Thu TIME UTC
            TIME raspberrypi systemd[1]: Starting KNX Daemon…
            — Subject: Unit knxd.service has begun with start-up
            — Defined-By: systemd
            — Support:

            — Unit knxd.service has begun starting up.
            TIME raspberrypi systemd[1]: Started KNX Daemon.
            — Subject: Unit knxd.service has finished start-up
            — Defined-By: systemd
            — Support:

            — Unit knxd.service has finished starting up.

            — The start-up result is done.
            lines 1-15/15 (END)
            — Logs begin at Thu TIME UTC, end at Thu TIME UTC. —
            TIME raspberrypi systemd[1]: Starting KNX Daemon…
            — Subject: Unit knxd.service has begun with start-up
            — Defined-By: systemd
            — Support: //lists.freedesktop.org/mailman/listinfo/systemd-devel

            — Unit knxd.service has begun starting up.
            TIME raspberrypi systemd[1]: Started KNX Daemon.
            — Subject: Unit knxd.service has finished start-up
            — Defined-By: systemd
            — Support:lists.freedesktop.org/mailman/listinfo/systemd-devel

            — Unit knxd.service has finished starting up.

            — The start-up result is done.

          • Hi Adrian,

            ok, it looks good 🙂 Aleady recompilied with the ncn5120 backend? And whats happend now? Connection possible?

            Michael

          • HI Michael:
            sorry,those rebort above is running in tpuarts mode!

            This is running in ncn5120 mode:

            pi@raspberrypi:~ $ ps ax|grep knxd
            476 pts/0 S+ 0:00 grep –color=auto knxd

            root@raspberrypi:/home/pi# netstat -pln|grep knxd
            root@raspberrypi:/home/pi# (got nothing)

            root@raspberrypi:/home/pi# journalctl -xu knxd.service
            — Logs begin at Thu TIME UTC, end at Thu TIME UTC. —
            Dec TIME raspberrypi systemd[1]: Starting KNX Daemon…
            — Subject: Unit knxd.service has begun with start-up
            — Defined-By: systemd
            — Support:

            — Unit knxd.service has begun starting up.
            Dec TIME raspberrypi knxd[439]: url not supported: No such file or directory
            Dec TIME raspberrypi systemd[1]: knxd.service: control process exited, code=exited status=1
            Dec TIME raspberrypi systemd[1]: Failed to start KNX Daemon.
            — Subject: Unit knxd.service has failed
            — Defined-By: systemd
            — Support:

            — Unit knxd.service has failed.

            — The result is failed.
            Dec TIME raspberrypi systemd[1]: Unit knxd.service entered failed state.

            Adrian

          • Hi Adrian,

            have you specified the correct serial device?

            url not supported: No such file or directory

            it seems knxd could not find the serial device. How your KNXD_OPTIONS option variable looks like?

            Michael

          • Hi Michael”
            this my configuration:
            KNXD_OPTIONS=”–eibaddr=1.1.128 -d -D -T -R -S -i –listen-local=/tmp/knx ncn5120:/dev/ttyAMA0″

            by the way,the raspberrypi’s’serial work in which mode,8bit or 9bit?

          • Hi Adrian,

            you are using an Raspberry Pi 3. Right? There are Raspberry Pi3 Serial devices regarding the serial interface since Pi2. By default the “real” serial device is used by the bluetooth module => install_knxd_systemd.sh changes this. There is also a second serial device, called miniUART, but this cannot be used for knxd. I think the name is also changed to /dev/serial0. Check the name of the device:

            dmesg|grep tty
            dmesg|grep serial

            Michael

          • Hi Michael
            Finally I got this worked,a big step:)for me! more details :
            i have updated image to the 2016-11-25-raspbian-jessie-lite and reinstall the Script 0.63. a little tips for the newbee like me.
            two need to be done before you install the script .
            1.enable the serial in the raspi-config and the serial port must be set to ttyS0 not ttyAMA0 on RPI3 with the latest raspbine.
            2.install rpi-update before use it:(
            a little trouble with my board that only can received date from the BUS can’t send,late I fix it I will give it a completely test.
            thank a lot for your patience to answer me and the great work!

            Best regards

            Adrian

          • Hi Adrian,

            good news 🙂

            Michael

        • HI Michael:
          This is report with :
          root@raspberrypi:/home/pi# dmesg|grep tty
          [ 0.000000] Kernel command line: 8250.nr_uarts=1 dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm 2709.boardrev=0xa02082 bcm2709.serial=0x30944112 smsc95xx.macaddr=B8:27:EB:94:41:12 bcm2708_fb.fbswap=1 bcm2709.uart_clock =48000000 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000 dwc_otg.lpm_enable=0 enable_uart=1 dtoverlay=pi3-disable- bt console=tty1 console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
          [ 0.001357] console [tty1] enabled
          [ 0.282638] console [ttyS0] disabled
          [ 0.285078] 3f215040.uart: ttyS0 at MMIO 0x3f215040 (irq = 59, base_baud = 31250000) is a 16550
          [ 1.024337] console [ttyS0] enabled
          [ 2.941084] 3f201000.uart: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
          [ 4.055001] systemd[1]: Expecting device dev-ttyS0.device…
          [ 4.748102] systemd[1]: Starting system-getty.slice.
          [ 4.755856] systemd[1]: Created slice system-getty.slice.
          [ 4.763641] systemd[1]: Starting system-serial\x2dgetty.slice.
          [ 4.772323] systemd[1]: Created slice system-serial\x2dgetty.slice.

          and :
          root@raspberrypi:/home/pi# dmesg|grep serial
          [ 0.000000] Kernel command line: 8250.nr_uarts=1 dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm 2709.boardrev=0xa02082 bcm2709.serial=0x30944112 smsc95xx.macaddr=B8:27:EB:94:41:12 bcm2708_fb.fbswap=1 bcm2709.uart_clock =48000000 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000 dwc_otg.lpm_enable=0 enable_uart=1 dtoverlay=pi3-disable- bt console=tty1 console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
          [ 4.763641] systemd[1]: Starting system-serial\x2dgetty.slice.
          [ 4.772323] systemd[1]: Created slice system-serial\x2dgetty.slice.

          Reply

          • Hi Adrian

            /dev/ttyAMA0 is the right one. Please check /etc/default/knxd, reboot and check if knxd is starting.

            Michael

  16. Hi Michael,

    great site and want to thank you for your work. Very nice your´re sharing this. Unfortunately I am stuck. I tried a lot the last 10 hours but can´t connect to the knx bus.
    I have a raspi b, the siemens AB12 buscoupler and ADUM1201ARZ. I installed Jessie lite,
    followed exactly your instructions and to be sure, twice (clean install). No error was shown while install. I can see the process but after calling “knxtool vbusmonitor1 ip:localhost” ist happens nothing. I tried to enable logging but the file remains zero byte.

    Sylog says:
    /var/log/syslog:Nov 26 21:04:41 raspberrypi knxd[417]: Layer 0(01A462B0,5839F8E9) Open
    /var/log/syslog:Nov 26 21:04:41 raspberrypi knxd[417]: Layer 0(01A462B0,5839F8E9) Openend
    /var/log/syslog:Nov 26 21:04:41 raspberrypi knxd[417]: Layer 0(01A56C50,5839F8E9) Open
    /var/log/syslog:Nov 26 21:04:41 raspberrypi knxd[417]: Layer 0(01A56C50,5839F8E9) Openend
    /var/log/syslog:Nov 26 21:04:41 raspberrypi knxd[417]: Layer 2(01AA8620,5839F8E9) Open
    /var/log/syslog:Nov 26 21:04:41 raspberrypi knxd[417]: Layer 2(01AA8620,5839F8E9) Openend
    /var/log/syslog:Nov 26 21:04:41 raspberrypi knxd[417]: Layer 2(01AA8620,5839F8E9) open-reset(001): 01

    and repeating.

    I only added the logging parameter in knxd conf.

    PS says:
    425 ? Ss 0:00 /usr/local/bin/knxd -p /run/knxd/knxd.pid –eibaddr=1.1.128 –daemon=/tmp/knxd.log –trace=5 -d -D -T -R -S -i –listen-local=/tmp/knx tpuarts:/dev/ttyAMA0
    466 pts/0 S+ 0:00 grep knxd

    Nothing. Any help would be appreciated. What else can i check for errors.

    Regards
    Vince

    Reply

    • I tested some more. After playing and starting ETS5.5.1 some times, i could see for some seconds a found interface at 1.1.128 an my IP. Test told me to be Ok, choosing the interface the same. But, right after clicking onto Busmonitor oder looking for devices in programing mode, knxd stopped.

      Nov 27 14:57:10 raspberrypi systemd[1]: Started KNX Daemon.
      root@raspberrypi:/home/pi# systemctl status knxd.service
      ● knxd.service – KNX Daemon
      Loaded: loaded (/lib/systemd/system/knxd.service; enabled)
      Active: active (running) since Sun 2016-11-27 14:57:10 UTC; 31s ago
      Process: 517 ExecStart=/usr/local/bin/knxd -p /run/knxd/knxd.pid $KNXD_OPTIONS (code=exited, status=0/SUCCESS)
      Process: 513 ExecStartPre=/usr/local/bin/knxd-findusb.sh (code=exited, status=0/SUCCESS)
      Main PID: 518 (knxd)
      CGroup: /system.slice/knxd.service
      └─518 /usr/local/bin/knxd -p /run/knxd/knxd.pid –eibaddr=1.1.128 -d -D -T -R -S -i –listen-local=/tmp/knx tpuarts:/dev/ttyAMA0

      Nov 27 14:57:10 raspberrypi systemd[1]: Started KNX Daemon.
      root@raspberrypi:/home/pi# systemctl status knxd.service
      ● knxd.service – KNX Daemon
      Loaded: loaded (/lib/systemd/system/knxd.service; enabled)
      Active: failed (Result: signal) since Sun 2016-11-27 14:57:48 UTC; 7s ago
      Process: 517 ExecStart=/usr/local/bin/knxd -p /run/knxd/knxd.pid $KNXD_OPTIONS (code=exited, status=0/SUCCESS)
      Process: 513 ExecStartPre=/usr/local/bin/knxd-findusb.sh (code=exited, status=0/SUCCESS)
      Main PID: 518 (code=killed, signal=ABRT)

      Nov 27 14:57:10 raspberrypi systemd[1]: Started KNX Daemon.
      Nov 27 14:57:48 raspberrypi systemd[1]: knxd.service: main process exited, code=killed, status=6/ABRT
      Nov 27 14:57:48 raspberrypi systemd[1]: Unit knxd.service entered failed state.
      root@raspberrypi:/home/pi#

      Btw. im using ETS on my Mac in a VM, network is in bridged mode.

      Any ideas ?

      Reply

    • Hi Vince

      another post describes also issues with knxtool vbusmonitor1. Habe you also tried

      knxtool busmonitor1 ip:localhost

      ? Your hardware is working correctly?

      Michael

      Reply

    • Hi Michael,

      oder können wir auch auf Deutsch ?
      I tried busmonitor parameter without v. I dunno if hardware works. KNX aktor, power supply and Siemens bus coupler and ADUM1201 are new. I ordered now an scn000.02 IP interface from MDT at voltus. Tomorrow I will try one last time with a backup raspberry pi 2. I don´t unterstand why knxd closes right after confirming the found interface with “choose/auswählen” in ETS5.5 (5.05. is acting same way).
      Thanks for your reply.

      Ciao,
      Vince

      Reply

      • Hi Vince,

        don´t unterstand why knxd closes right after confirming the found interface with “choose/auswählen” => Starte den knxd auf der command line und nicht als daemon um mehr Details zu bekommen:

        # Make root
        sudo su
        # Stop knxd
        systemctl stop knxd.service
        # Kill processes if exist
        killall knxd
        # Switch to User knxd. Start Shell as user
        su knxd -s /bin/sh
        # knxd in foreground
        /usr/local/bin/knxd -p /run/knxd/knxd.pid –eibaddr=1.1.128 -D -T -R -S -i –-trace=5 –error=5 –listen-local=/tmp/knx tpuarts:/dev/ttyAMA0

        und teste anschließend nochmal die Verbindung von ETS aus.

        eibd hatte sich wenn das Interface nicht verfügbar war nicht beendet.

        Michael

        Reply

        • Guten Abend Michael,

          leider nicht möglich. Jessie ist noch frisch und unverändert. Aufruf der URL sagt in der knxd shell invalid url. Wenn ich — statt – vor eibaddr und error=5 setze, bekomme ich “initialisation of the knxd inet protocol failed”. Also so:

          /usr/local/bin/knxd -p /run/knxd/knxd.pid –eibaddr=1.1.128 -D -T -R -S -i –-trace=5 –error=5 –listen-local=/tmp/knx tpuarts:/dev/ttyAMA0

          Danke für Deine Unterstützung bisher.

          Gruß
          Vince

          Reply

        • Sehe gerade dass das die Blogseite aus Doppelstrichen einen langen macht.

          Reply

          • Hallo Vince,

            ist es dann bei dem Fehler “initialisation of the knxd inet protocol failed” geblieben? Also korrekter Aufruf wäre

            /usr/local/bin/knxd -p /run/knxd/knxd.pid --eibaddr=1.1.128 -D -T -R -S -i --trace=5 --error=5 --listen-local=/tmp/knx tpuarts:/dev/ttyAMA0
            

            Michael

  17. Hello Michael,

    I have a question, a raspberry and your script knxd can replace an IP KNX gateway ?

    or is it necessary to buy other things ?

    Thanks for your feed-back

    Laurent Friboulet

    Reply

    • Hi Laurent,

      yes, imoo it replaces an IP KNX gateway.

      You need an BCU/interface to connect to the KNX Bus such as TPUART, FT12 or an KNX USB Interface.

      Michael

      Reply

  18. Hi
    I’m trying to install the daemon on Jessie 8 Light version (to be combined Jeedom) but I can not. There are incompatibilities with this version of the OS?
    thank you

    Reply

    • Hi pete68,

      please read comment from Adrian, maybe you ran into the same problem.

      I never tried it on Jessie Light. Any error messages form the script?

      Michael

      Reply

      • Hmmm … I can not even Jessie Full. With Jessie and Knx was easier!
        just a question!
        since we all have problems, it would not be logical that someone who is able to install knxd share the image?

        Reply

      • I’m back!
        I managed to install knxd du jessie, but I still have a problem, I’m trying to configure Jeedom to interface to knxd just installed. Unfortunately the Jeedom Plugin KNX does not provide the serial interface AMA0 and expects the connection to an external router KNX.
        I think it can “confuse” Jeedom into believing they are connected to an external router, however, giving an ip address of that raspberry it’s running knxd.

        Basically, if you’ve installed knxd with address on raspberry:

        Address = 192 168 200 201/24
        Gateway = 192.168.200.1
        DNS = 192.168.200.1
        [Route]
        Destination = 224.0.23.12 / 32

        which address should I provide Jeedom to link to this fictitious router (which runs on the same Raspberry)?

        thanks for your patience

        Reply

        • Hi pete68,

          you cannot use a serial interface from more then one process.

          We’re right you have to connect via network. If Jeedom runs at the same host you can use 127.0.0.1 (loopback/localhost interface) Port 6720 or the public IP Address 192 168 200 201.

          Michael

          Reply

  19. HI Michael
    Good news is that ncn5120 backed finally got worked,a big step for me(:

    more details:
    I have updated the baspbine to the latest version 2016-11-25-raspbian-jessie-lite
    nad reinstalled the script 0.63

    a little tip for the newbee like me.
    1.before install the script you must have enabled the serial port in the raspi-config and the correct is ttyS0 not the ttyAMA0 on a raspberrypi3

    2.install rpi-update before use it ):

    now I can monitor the group telegram but can’t sent any to the bus.I have checked the pi’s side is worked well, I think this is due to my hardware’s problem. when I solved this issue i will give it a complete test.and I expect it will work in SPI(:

    a lot thanks for your patience to help me and great work.

    Best regard !

    Adrian

    Reply

  20. Hallo Michael,

    ich versuche mittels deines Scripts den KNXD unter Ubuntu (aktuelle Server LTS) ans Laufen zu bekommen; leider bricht er mir die eigentliche KNXD-Installation bzw. Compilierung ab mit
    checking systemd/sd-daemon.h usability… no
    checking systemd/sd-daemon.h presence… no
    checking for systemd/sd-daemon.h… no
    ./configure: line 17574: syntax error near unexpected token `SYSTEMD,’
    ./configure: line 17574: ` PKG_CHECK_MODULES(SYSTEMD, libsystemd-daemon)’
    make: *** No rule to make target ‘clean’. Stop.

    Ich vermute mal, dass “er” es nicht mag, dass es unter Ubuntu keinen Systemd mehr gibt, oder?

    Hast Du mir einen Tipp?

    Danke und Grüße
    Hans

    Reply

    • Grund gefunden – es fehlten Libraries, die ich mit dpkg identifizieren konnte:

      dpkg-checkbuilddeps: error: Unmet build dependencies: libusb-1.0-0-dev (>= 1.0.10) pkg-config dh-systemd | base-files (<= 1.0.10) pkg-config dh-systemd hat das Problem gelöst

      Reply

  21. Hi,

    nice description … I like to setup a raspberry (still connected to a heater) as an KNX forwarding device, because I have WIFI available there only.

    Main KNX Installation KNX IP Router Raspberry secondary KNX Installation

    Is this possible to use a local FT1.2 KNX Interface to forward all telegrams to the secondary bus?

    Grüße,
    Nils

    Any ideas regarding this?

    Cheers,
    Nils

    Reply

  22. Hey,

    your script no longer seems to work since knxd moved to 0.12. Could you please check this? Would be great.

    I came across the issue when using openhabian’s config option “Install KNX” which internally uses your script. This fails due to the above mentioned reason. At least that’s my first guess.

    After adding ‘git checkout tags/v0.10.18 -b install’ after ‘git clone … cd knxd’ in your script, the installation succeeds. However, I guess it’s better to migrate your script to knxd 0.12 (no pthsem dependency).

    Are there any chances that you “fix” this soon? I guess a lot of people are stumbling over this when they want to try out the new openhab 2.0 release via openhabian (+KNX)

    By the way: Thank you for your great work!

    Reply

  23. Hi,

    I have problems with the install. I have tested it with a few fresh installation on Rasp 3. When I execute the script it ends with message:

    configure: error: libev not found
    make: *** No rule to make target ‘clean’. Schluss.

    After that there is no knxd folder and I cannot find it anywhere:

    pi@raspberrypi:~ $ ls -l /usr/local/bin
    insgesamt 8
    -rwxr-xr-x 1 root staff 408 Jan 24 22:12 knxd-findusb.sh
    -rwxr-xr-x 1 root staff 3973 Jan 24 22:09 pthsem-config

    Is there missing a requirement? Hopefully someone can give me hint. Thanks!

    Reply

  24. Hi,

    script always stops with:

    checking for LIBUSB… yes
    EMI because of usb
    checking for ev_run in -lev… no
    configure: error: libev not found
    make: *** No rule to make target ‘clean’. Stop.

    tried: apt-get install libev-dev
    didn’t help

    Thx

    Reply

  25. Hey Michael.

    After spending several hours with knxd I’m here again asking you for help because I don’t get any further.

    My setup:

    – Raspberry 3
    – Busware TUL flashed with “transparent TPUART” firmware plugged into RPI3 and connected to KNX bus (done by my electrician, so should be okay)
    – clean install of openHABian (raspbian + openhab2 + …)
    – nothing else has been done (neither on software nor on hardware side)

    My expectations:

    – install “knxd” by simply executing “./install_knxd_systemd.sh” (nothing else)
    – after successful installation “knxtool vbusmonitor1 ip:localhost” on my pi should list some KNX packages when I turn on/off my lights, shutters, …

    Real world:

    – I need to adjust the install script to successfully install knxd 0.10.18 or 0.11.18 instead of master (fails)
    – Even after successful installation of knxd the command “knxtool vbusmonitor1 ip:localhost” on my pi never brings any output

    Questions?

    – Are my expectations wrong?
    – Is there anything I misundestood?
    – Is the “transparent TPUART” firmware the correct one or do I have to use the “FT1.2 serial port BCU” firmware (IMHO not, but I also tried this without success)
    – “knxtool vbusmonitor1 ip:localhost” SHOULD list something when I switch lights, right?

    Thank you so much.

    Reply

  26. Sorry for spamming you. Just wanted to let you know that it’s working as expected now.

    What I did:
    – new clean install of openHABian
    – build the latest source code of knxd (0.12.x) exactly as detailed on their Github homepage.
    – followed the stuff in section “Adding a TPUART USB interface”
    – modified /etc/knxd.conf
    – reboot

    Done. I can see the packages with knxtool. Perfect. Now I can move on …

    Reply

  27. Hallo,

    ich habe das KNXD ueber die aktuelen OpenHABianPi Release 2.0 installiert (Raspian Pi 2B GNU/Limux 8 )jessie
    Angebunden werden soll Busch Jaeger Powernet ueber USB
    Dort wird die Installation auch ueber das Script michlstechblog.info/blog/download/electronic/install_knxd_systemd.sh
    Installiert, allerdings funktioniert die USB Port Erkennung danach nicht, weiterhin fehlen auch die knxtools , Dort sind nur folgende Programme:

    [19:22:55] root@openHABianPi:/usr/local/bin# ls
    knxd-findusb.sh openhabian-config pthsem-config

    Der Dienst scheint aber vorhanden zu sein:
    [19:22:56] root@openHABianPi:/usr/local/bin# ps -ax | grep knxd
    1549 pts/0 S+ 0:00 grep –color=auto knxd

    Auch ein manuelle Nachinstallieren über das install_knxd_systemd.sh Script brachte nichts

    Die letzten Meldungen des Script:

    checking whether __APPLE__ is declared… no
    checking for gethostbyname_r… yes
    EMI because of ft12
    checking for LIBUSB… yes
    EMI because of usb
    checking for ev_run in -lev… no
    configure: error: libev not found
    make: *** No rule to make target ‘clean’. Stop.

    Irgend jemand eine Idee?

    Im /var/log/messages wird das USB Device wohl erkannt…
    Jan 26 21:29:04 openHABianPi kernel: [ 3.737192] usb 1-1.5: new full-speed USB device number 4 using dwc_otg
    Jan 26 21:29:04 openHABianPi kernel: [ 3.857222] usb 1-1.5: New USB device found, idVendor=145c, idProduct=1330
    Jan 26 21:29:04 openHABianPi kernel: [ 3.859061] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    Jan 26 21:29:04 openHABianPi kernel: [ 3.860873] usb 1-1.5: Product: KNX-USB Interface (Flush mounted)
    Jan 26 21:29:04 openHABianPi kernel: [ 3.862714] usb 1-1.5: Manufacturer: Busch-Jaeger Elektro GmbH
    Jan 26 21:29:04 openHABianPi kernel: [ 3.880048] hid-generic 0003:145C:1330.0001: hiddev0,hidraw0: USB HID v1.01 Device [Busch-Jaeger Elektro GmbH KNX-USB Interface (Flush mounted)] on usb-3f980000.usb-1.5/input0

    Gruß Boris

    Reply

  28. Hi Michael,
    danke für die echt ausführliche Beschreibung!

    Leider beendet sich das Installskript mit folgenden Fehler:
    checking whether SA_SIZE is declared… no
    checking whether __FreeBSD__ is declared… no
    checking whether __APPLE__ is declared… no
    checking for gethostbyname_r… yes
    EMI because of ft12
    checking for LIBUSB… yes
    EMI because of usb
    checking for ev_run in -lev… no
    configure: error: libev not found
    make: *** No rule to make target ‘clean’. Stop.

    Ich habe bereits mehrfach Jessie neu aufgesetzt und nichts weiter als die oben gelisteten Punkte ausgeführt.
    Eine Idee?

    Es ist ein Pi3

    Danke und Grüße
    Marc

    Reply

    • Hi Marc,

      i changed the script. Now it should working with knxd v0.12. Version is 0.7.0.

      I also created a repository at github

      https://github.com/Race666/install-knxd

      Michael

      Reply

      • Hi Michael,
        the installation works, Thanks!!!

        Now i have not traffic with busmonitor.
        I will check the posts in this blog.

        Thanks
        Marc

        Reply

        • Hi Marc,

          have you tried

          knxtool busmonitor1 ip:localhost

          instead of

          knxtool vbusmonitor1 ip:localhost ?

          I think vbusmonitor1 has some problems.

          Michael

          Reply

          • Hi Michael,
            i have flashed my BUSSER and use tpuarts:/dev/ttyACM0 instead of tpuarts:/dev/ttyAMA0.

            Now i see traffic on my bus.

            Thanks
            Marc

  29. Hallo,

    ich habe alles komplett nach der Anleitung von Boerni aufgesetzt und möchte den KNXD einfach auf mein bereits mit dem Homeserver laufendendes Busch Jaeger IP Gateway connecten lassen.

    Leider kommt bei jedem Schaltversuch immer nur folgende Fehlermeldung:

    Feb 2 19:41:31 raspberrypi homebridge[998]: [2017-02-02 19:41:31] [homebridge-knx.KNX] DEBUG got dest=4622
    Feb 2 19:41:31 raspberrypi homebridge[998]: [2017-02-02 19:41:31] [homebridge-knx.KNX] [ERROR] knxwrite:openTGroup: Error: request invalid

    hab schon massig KNX_Opts versucht – aktuell ist diese hier aktiv:

    KNXD_OPTS=”-e 1.7.199 -D -T -R -S”

    Fehlermeldung ist aber immer die gleiche – egal welche Opts ich setze.
    IP Gateway hat die IP 192.168.0.200

    Bin für jede Hilfe sehr dankbar !

    Reply

    • Hi Oliver,

      was heißt Schaltversuch? Welche knxd Installation verwendest Du? KNXD_OPTS deutet nicht auf mein Installscript hin. Weche knxd/knxtool Version ist installiert? Wie ist die komplette knxd Konfig?

      Grüße Michael

      Reply

      • The same error when i run the status of homebridge:
        pi@raspberrypi:~ $ sudo systemctl status homebridge
        ● homebridge.service – Node.js HomeKit Server
        Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
        Active: active (running) since Mon 2017-02-13 14:10:25 MSK; 3min 52s ago
        Main PID: 661 (homebridge)
        CGroup: /system.slice/homebridge.service
        └─661 homebridge

        Feb 13 14:12:27 raspberrypi homebridge[661]: ================================
        Feb 13 14:12:27 raspberrypi homebridge[661]: [2/13/2017, 2:12:27 PM] [homebridge-knx.KNX] DEBUG got dest=4103
        Feb 13 14:12:27 raspberrypi homebridge[661]: [2/13/2017, 2:12:27 PM] [homebridge-knx.KNX] [ERROR] knxwrite:openTGroup: Error: request invalid
        Feb 13 14:12:28 raspberrypi homebridge[661]: —iterating——————–
        Feb 13 14:12:28 raspberrypi homebridge[661]: address: 2/0/7
        Feb 13 14:12:28 raspberrypi homebridge[661]: reversed: false
        Feb 13 14:12:28 raspberrypi homebridge[661]: dptype: DPT1
        Feb 13 14:12:28 raspberrypi homebridge[661]: ================================
        Feb 13 14:12:28 raspberrypi homebridge[661]: [2/13/2017, 2:12:28 PM] [homebridge-knx.KNX] DEBUG got dest=4103
        Feb 13 14:12:28 raspberrypi homebridge[661]: [2/13/2017, 2:12:28 PM] [homebridge-knx.KNX] [ERROR] knxwrite:openTGroup: Error: request invalid

        I have to say that first i installed your new knxd (v0.7.4), got it worked with my ABB USB/S 1.1 and after that i installed homebridge-knx from this page:
        boernyblog dot de/raspberry-pi-3-als-knx-bridge-fuer-ios-homekit/
        and it seems that they do not want to work together.
        Commands from HomeKit dont go to the knxd. Certainly, HomeKit can not get the status of any lamp.
        There is a 4-th day of my battle with the homebridge-knx 🙂

        Reply

        • IMHO, this error because of new knxd version (0.13).
          How to downgrade knxd to v0.12?
          Is it possible?

          Reply

          • Try it 🙂

            Change my script and insert after the git clone line

            git checkout v0.12

            Michael

          • Hi Tim,

            I altered the script. Master branch is currently under heavy development and unstable. The script checks out v0.12 by default.

            Michael

        • Hi Tim,

          I think this issue is not knxd related. Your knxd is running and your config is ok? Can you post the homebridge knxd config the device config of 2/0/7?

          Have you tried to query the group address with knxtool?

          Michael

          Reply

          • Hi Michael!
            Thank your for your replay!
            My config for the lamp:
            {
            “knxd_ip”: “192.168.0.31”,
            “knxd_port”: 6720,
            “AllowKillHomebridge”: true,
            “Devices”: [
            {
            “DeviceName”: “Lamp”,
            “Services”: [
            {
            “ServiceType”: “Lightbulb”,
            “ServiceName”: “WorkTable”,
            “Characteristics”: [
            {
            “Type”: “On”,
            “Set”: [
            “2/0/7”
            ],
            “Listen”: [
            “2/2/6”
            ]
            }
            ]
            }
            ]
            }
            ]
            }
            Yes. i’ve tried to control the lamp with knxtool. It’s ok, only if i stopped the homebridge service. Overwise, it seys folowing:
            pi@raspberrypi:~ $ sudo knxtool groupswrite ip:localhost 2/0/7 0
            Connect failed: Connection reset by peer
            pi@raspberrypi:~ $ sudo systemctl stop homebridge
            pi@raspberrypi:~ $ sudo knxtool groupswrite ip:localhost 2/0/7 0
            Send request
            pi@raspberrypi:~ $ sudo knxtool groupswrite ip:localhost 2/0/7 1
            Send request
            pi@raspberrypi:~ $
            I guess i sow somewhere command “knxtool groupswrite” without “ip:localhost”.
            One more thing. I found that: github dot com/snowdd1/homebridge-knx/issues/80

          • Hi Tim,

            as written in my previous post the homebridge-knx maintainer have something to do 🙂

            Yes. i’ve tried to control the lamp with knxtool. It’s ok, only if i stopped the homebridge service. Overwise, it seys folowing:
            pi@raspberrypi:~ $ sudo knxtool groupswrite ip:localhost 2/0/7 0

            => There is a new option in knxd which assigns an individual KNX Adresse to each connected client. If have set this to just one:

            –client-addrs=1.1.129:1

            may be when you increase it to 2 or more you do not have to stop the homebridge service to use knxtool and homebridge together:

            –client-addrs=1.1.129:4

          • Hello Michael!
            Thank you!
            It works on v.0.13 since i made this:
            –client-addrs=1.1.129:4

  30. Hi

    using: knxtool busmonitor1 ip:localhost
    brings: knxtool: error while loading shared libraries: libeibclient.so.0: cannot open shared object file: No such file or directory

    Why does libeibclient.so.0 not exit ? How to Install it?
    THX
    Roland

    Reply

    • Hi Roland,

      the reason is the switch from static to dynamic linked binaries. Debian is not looking into /usr/local/lib for libraries.

      Copy the following lines into a shell:

      cat > /etc/ld.so.conf.d/knxd.conf <

      Reply

  31. OK, this is a stupid question from the current maintainer of knxd.

    What is wrong with installing knxd via the .deb file it creates? That’d install libeibclient.so.0 to /usr/lib where it’ll be found without playing with ld.so.conf, and register dependencies like libev.

    Also, knxd already comes with a working systemd script.

    Also, “-b usb:” should be sufficient. No need to hard-code the device’s bus ID (which may change).

    Reply

    • Why would you need to create a pid file?
      Don’t add knxd to dialout, fix permissions with udev instead. (my personal opinion)
      You still have a –with-pth option in your configure call.

      I’ll add your USB rules to the udev file that’s shipped with knxd.

      Reply

      • Hi Matthias,

        thanks for your comments:-)

        The script has it origins in compiling and installing eibd at once. May be some things are not up to date what’s currently possible with knxd 🙂

        What is wrong with installing knxd via the .deb file it creates? => Well I’ll give it a try. Currently my time is really rare.

        “-b usb:” should be sufficient. => Ok, I’ll add this to /etc/default/knxd as an option example. I don’t know that the ID is not needed anymore. However the device id isn’t hardcoded. It is determined by findknx-usb and /etc/default/knxd is changed before knxd starts. But the smartest way is when knxd finds the device itself 🙂

        libeibclient.so.0 to /usr/lib => Because I strictly want to isolate the debian system files from self installed binaries. Another possibility is a symink from /usr/local/lib/libeibclient.so.0 to /usr/lib

        Don’t add knxd to dialout, fix permissions with udev instead. (my personal opinion) => My approach is keep it simple and stupid 🙂 The permissions (group dialout) on the serial device(s) are already in place and serial devices are usually very static (like ttyAMA0 of the Raspberry). In my opinion udevd is oversized for that case.

        You still have a –with-pth option in your configure call. => I remove it

        Why would you need to create a pid file? => Because I compiled knxd without direct systemd support. Some earlier version of knxd aborted compiling with builtin systemd support. To control the daemon by systemctl and systemd I need the pid file.

        I really appreciate your work. Thank you!

        I think most guys which want to use knxd have less experience in Linux Systems. They need a “one shot” solution (in case of the raspberry: installing/compiling knxd, modifing /boot/cmdline, …..) to get knxd running. May be this is an option for future releases of knxd to provide some platform specific scripts. This would make my script no longer necessary 😉 If you are intressent I can spend some lines code 🙂

        Michael

        Reply

  32. Thank you for all your work on this! I am using your latest script from github and it fails while building:

    In file included from ncn5120.cpp:23:0:
    ncn5120.h:36:8: error: extra qualification ‘NCN5120SerialLayer2Driver::’ on member ‘setstate’ [-fpermissive]
    void NCN5120SerialLayer2Driver::setstate(enum TSTATE state);
    ^
    In file included from ncn5120.h:24:0,
    from ncn5120.cpp:23:
    tpuartserial.h: In member function ‘virtual void NCN5120SerialLayer2Driver::setstate(TSTATE)’:
    tpuartserial.h:36:8: error: ‘virtual void TPUARTSerialLayer2Driver::setstate(TSTATE)’ is private
    void setstate(enum TSTATE state);
    ^
    ncn5120.cpp:66:47: error: within this context
    TPUARTSerialLayer2Driver::setstate(new_state);
    ^
    ncn5120.cpp:66:48: error: expected ‘}’ at end of input
    TPUARTSerialLayer2Driver::setstate(new_state);
    ^
    Makefile:452: recipe for target ‘ncn5120.o’ failed
    make[3]: *** [ncn5120.o] Error 1
    make[3]: Leaving directory ‘/root/knxdbuild/knxd/src/backend’
    Makefile:385: recipe for target ‘all-recursive’ failed
    make[2]: *** [all-recursive] Error 1
    make[2]: Leaving directory ‘/root/knxdbuild/knxd/src’
    Makefile:434: recipe for target ‘all-recursive’ failed
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory ‘/root/knxdbuild/knxd’
    Makefile:369: recipe for target ‘all’ failed
    make: *** [all] Error 2

    Any advice on what I can do to fix this is appreciated!

    Reply

    • Hi Marius,

      I think you have to wait until tomorrow. Today two commits were checkin regarding the ncn5120 driver. I think this causes the crash of the installscript. Maybe not all changes are commited yet.

      (Update 08/02/2017 05:50)

      Script should working again. The Maintainers of knxd have fixed the issue.

      Michael

      https://github.com/knxd/knxd/commits/master

      Reply

  33. Hello!
    Almost a week i’m trying to set up the homebridge-knx on Raspberry Pi3.
    Found your manual. Thank you so much!
    Unfortunately i got the error:

    Making install in tools
    make[2]: Entering directory ‘/root/knxdbuild/knxd/tools’
    make[3]: Entering directory ‘/root/knxdbuild/knxd/tools’
    make[3]: Nothing to be done for ‘install-exec-am’.
    make[3]: Nothing to be done for ‘install-data-am’.
    make[3]: Leaving directory ‘/root/knxdbuild/knxd/tools’
    make[2]: Leaving directory ‘/root/knxdbuild/knxd/tools’
    make[1]: Leaving directory ‘/root/knxdbuild/knxd’
    chmod: cannot access ‘/usr/local/bin/knxd-findusb.sh’: No such file or directory
    root@raspberrypi:/home/pi#

    on the clean system twice. So, i dont know, if the script finished correctly. And i dont have /usr/local/bin/knxd-findusb.sh
    How can i configure my ABB USB/S 1.1 in this case?
    Thank you in advance!

    Reply

    • Hi Tim,

      knxd-findusb.sh is no longer needed. I have forgotten to remove the chmod on this file. Changed it in Version 0.7.4.

      Michael

      Reply

  34. Dear Michael,

    as a complete noob to the field of KNX/Raspberry, please apologize my silly questions in advance …

    I am trying to setup openHABian (running on a Pi3) to connect to my Hager USB interface. Following your excellent script and instructions, the installation (install_knxd_systemd.sh) script stopped when trying to execute /usr/local/bin/knxd-findusb.sh: actually, there is no such file in the directory. However, since an executable named findknxusb is present, I changed the installation script correspondingly and re-started it. After commenting another line (useradd knxd failed since this user was already known), the installation script completes successfully and findknxusb correctly identifies my Hager interface (device: 1:4:1:0:0 Hager…).

    However, after rebooting, there is no knxd service running. And listening to the bus using knxtool busmonitor1 ip:localhost fails with the error “Connection refused”. All installation steps took place with superuser privileges, though.

    Any idea what I am doing wrong …?

    Thanks & best regards,

    Thorsten

    Reply

    • P.S: When manually starting the knxd (/usr/local/bin/knxd -p /run/knxd/knx.pid –eibaddr=1.1.128 -D -T -R -S -i –trace=5 –error=5 –listen-local=/tmp/knx usb:%DEVICEID%, as described in one of the previous comments), it is successfully tracing EIB activity! That’s my personal glimpse of light for today 🙂

      Reply

      • Hi Thorsten,

        when you start knxd manually, you do this as which user? Command line changed in newer versions of knxd. Try the following cmommands to start as user knxd(like daemon also run)

        sudo su -s/bin/bash knxd
        /usr/local/bin/knxd –eibaddr=1.1.128 –client-addrs=1.1.129:1 -d -D -T -R -S -i –listen-local=/tmp/knx -b usb:

        May be if you start knxd as root you habe to manually remove /tmp/knx otherwise you will have no permissions with user knxd.

        When knxd does not start at boot time. What are the log entries about knxd:

        sudo journalctl -u knxd.service

        Michael

        Reply

        • Hi Michael,

          many thanks for your ultra-fast response!

          Immediately after booting, the log entries (journalctl -u knxd.service) read as follows:
          — Logs begin at Mon 2017-02-13 18:11:18 CET, end at Mon 2017-02-13 18:13:57 CET. —
          Feb 13 18:12:23 openHABianPi systemd[1]: Starting KNX Daemon…
          Feb 13 18:12:24 openHABianPi knxd[388]: initialization of the EIBnet/IP server failed: No such device
          Feb 13 18:12:24 openHABianPi systemd[1]: knxd.service: control process exited, code=exited status=1
          Feb 13 18:12:24 openHABianPi systemd[1]: Failed to start KNX Daemon.
          Feb 13 18:12:24 openHABianPi systemd[1]: Unit knxd.service entered failed state.

          Starting the knxd service as user knxd following your description succeeds, though! Afterwards, knxtool busmonitor1 ip:localhost appears to work and starts tracing the EIB activity.

          So apparently my problem boils down to an issue related to the knxd configuration at boot time? Is the missing bash script knxd-findusb.sh somehow related to this?

          Thanks,
          Thorsten

          P.S.: I immediately checked that the USB is configured in my /etc/bin/knxd:

          # Command line parameters for knxd. TPUART Backend
          # Serial device Raspberry
          # KNXD_OPTIONS=”–eibaddr=1.1.128 –client-addrs=1.1.129:1 -d -D -T -R -S -i –listen-local=/tmp/knx -b tpuarts:/dev/ttyAMA0″
          # Serial device PC
          # KNXD_OPTIONS=”–eibaddr=1.1.128 –client-addrs=1.1.129:1 -d -D -T -R -S -i –listen-local=/tmp/knx -b tpuarts:/dev/ttyS0″
          # Tunnel Backend
          # KNXD_OPTIONS=”–eibaddr=1.1.128 –client-addrs=1.1.129:1 -d -D -T -R -S -i –listen-local=/tmp/knx -b ipt:192.168.56.1″
          # USB Backend
          KNXD_OPTIONS=”–eibaddr=1.1.128 –client-addrs=1.1.129:1 -d -D -T -R -S -i –listen-local=/tmp/knx -b usb:”

          Reply

          • Hi Thorsten,

            it seems the Network isn’t ready when knxd tries to start. Have you set a static IP Address? What happens when you boot your Raspberry and try the systemd method to start knxd manually:

            sudo systemctl start knxd.service

            Michael

          • Hi Michael,

            ah, we are getting closer! Manually starting the knxd service (using exactly the command you suggested) works without problems.

            Here is the point: yes, my Raspberry does have a static IP address. BUT: a) the PI3 connects to my router using Wifi (no LAN connection) and b) it’s the router (a Fritz!Box) which assigns the static IP (thought that would be easiest and safest way). So one could at least imagine that the IP gets assigned only after (!) the system tries to start knxd.

            Looks like I have to figure out how to delay the start of knxd until Wifi is up and connected?

            Thorsten

          • Hi Thorsten,

            static IP Address means NO DHCP. Not the same IP Address at each DHCP Request 🙂 Which method do you use to setup WIFI? Maybe it would be sufficent for you to use this method: http://michlstechblog.info/blog/debian-configure-wireless-lan-by-systemd/ 😉 because knxd depends on systemd network config, means knxd always starts after the systemd network config.

            Michael

          • Hi Michael,

            bad luck: looks like I completely messed up the network configuration when trying to set up a static IP 🙁 – currently, the Raspberry does neither connect to LAN nor to Wifi. Getting this fixed might take a few days: I don’t have a USB keyboard available, so I will probably re-install openHabian from scratch. Regarding the Wifi setup: the openHabian configuration includes a corresponding option, which is what I used.
            I will let you know how this proceeds …

            Thorsten

          • Hi Michael,

            just a brief update: success! After a) setting up my PI3 from scratch (openHABian), including b) customized Wifi setup according to your instructions, c) assigning a static IP following your guide and d) running through your setup instructions (again), knxd starts up successfully when booting the PI, connects to the EIB via the Hager USB interface and readily monitors bus traffic. ETS4 recognizes the knxd interface, and the integrated bus-monitor works. Yes 🙂 🙂 :)!

            openHAB(2) might still require some configuration (it does not show the knx binding in the Inbox after installation of the corresponding addon), but that’s probably a different story … If you know of any links to noob-proof setup instructions, please let me know!

            Thanks again for your great support and excellent blog!

            Thorsten

          • Hi Thorsten,

            first thank you for all the effort you put into this!
            I’ve installed knxd on a fresh debian stretch install on a rpi2. I’ve not setup the static IP (yet, last time I tried something went wrong), but unlike Michael, I cannot even start knxd with the manual command. I get a timeout (see below). FYI, at some point I could see that knxd had correctly recognised my GIRA USB interface. Anything I might try?

            root@raspberrypi:/home/pi# sudo systemctl start knxd.service
            Job for knxd.service failed because a timeout was exceeded.
            See “systemctl status knxd.service” and “journalctl -xe” for details.
            root@raspberrypi:/home/pi# service knxd status
            ● knxd.service – KNX Daemon
            Loaded: loaded (/lib/systemd/system/knxd.service; enabled; vendor preset: enabled)
            Active: failed (Result: timeout) since Fri 2017-08-25 17:00:07 UTC; 36s ago
            Process: 520 ExecStart=/usr/local/bin/knxd -p /run/knxd/knxd.pid $KNXD_OPTIONS (code=exited, status=0/SUCCESS)

            Aug 25 16:58:37 raspberrypi systemd[1]: Starting KNX Daemon…
            Aug 25 17:00:07 raspberrypi systemd[1]: knxd.service: Start operation timed out. Terminating.
            Aug 25 17:00:07 raspberrypi systemd[1]: Failed to start KNX Daemon.
            Aug 25 17:00:07 raspberrypi systemd[1]: knxd.service: Unit entered failed state.
            Aug 25 17:00:07 raspberrypi systemd[1]: knxd.service: Failed with result ‘timeout’.

            Thank you!

          • Hi Thorsten,

            I have now managed to set the static IP:
            I needed to change Name=eth0 to the name of the interface provided by “ifconfig”.

            However my problem persists, also when runing the suggest command:

            knxd@raspberrypi:/home/pi$ /usr/local/bin/knxd –eibaddr=1.1.128 –client-addrs=1.1.129:1 -d -D -T -R -S -i –listen-local=/tmp/knx -b usb:1:4:1:0
            I don’t know of options for –eibaddr=1.1.128
            E00000055: [ 1:main] There is no KNX addr= in section ‘main’.
            F00000000: [ 1:main] Error setting up the KNX router.

            Marc

          • Hi Michael,

            obviously I meant to address you, not Thorsten, sorry!

            Marc

  35. Thank you, this is a grade script! Two things could be improved.
    * Check if the user knxd already exists. So the script can be executed a second time.
    * Checkout the v0.12 branch also when the repository already exists.

    Michael

    Reply

    • Hi Frami,

      Thanks. done.

      Michael

      Reply

  36. Hello
    Thank you so much for the great work
    I have a problem running the script:
    EMI because of ft12
    checking for LIBUSB… yes
    EMI because of usb
    configure: error: libfmt (string formatting library) is not installed.
    root@raspberrypi:~#
    Because it may be failing?
    I’ve searched for the missing library, but I can not find it.
    a greeting

    Reply

    • Hi Pedro,

      I’ve added support for the libfmt lib. But currently (19.2.2017 commit 6f477ea802b7989267cda85a61bb046d1c138dd6)the master branch stops with an error when compiling against libfmt. Must take a closer look at this…

      Michael

      Reply

      • Michael,

        I have the same error as Pedro with libfmt.

        Regards,
        Bert

        Reply

        • Hi Bert,

          you should currently not use the master branch. It’s under heavy development. Use the stable branch, as set in the script, instead.

          Michael

          Reply

          • Hi Michael,

            now i have got it working, thx. vbusmonitor, groupswrite etc is working. I want to use this also with OPENHAB2/KNX2.0 from Karel Goderis and I configured knx.cfg for OPENHAB2 where i have put as serialport /tty/ttyAMA0 but i get the following error:

            17:58:57.367 [INFO ] [tuwien.auto.calimero ] – FT1.2 /dev/ttyAMA0: open rxtx library serial port connection
            17:58:57.368 [ERROR] [nx.handler.KNXBridgeBaseThingHandler] – An exception occurred while connecting to the KNX bus: Serial port ‘/dev/ttyAMA0’ could not be opened. Available ports are:

            Does this have to do with ownership of ttyAMA0? What can i do to rectify this?

            Regards,

            Bert

          • Hi Bert,

            what permissions are set to ttyAMA0?

            ls -l /dev/ttyAMA0

            is the port opened by another program?

            lsof|grep tty

            Michael

          • Hi Michael,

            i just ran the 2 commands and here are the results:

            root@raspberrypi:/home/pi# ls -l /dev/ttyAMA0
            crwxrwxrwx 1 root tty 204, 64 Feb 22 16:13 /dev/ttyAMA0

            root@raspberrypi:/home/pi# lsof |grep tty
            lsof: WARNING: can’t stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
            Output information may be incomplete.
            systemd-l 381 root 6r REG 0,16 4096 2166 /sys/devices/virtual/tty/tty0/active
            systemd-l 381 root 13u CHR 4,6 0t0 1047 /dev/tty6
            vncserver 446 root 8r REG 0,16 4096 2166 /sys/devices/virtual/tty/tty0/active
            vncserver 446 14068 root 8r REG 0,16 4096 2166 /sys/devices/virtual/tty/tty0/active
            login 452 root mem REG 179,2 9520 14919 /lib/arm-linux-gnueabihf/security/pam_securetty.so
            login 452 root 0u CHR 4,1 0t0 1042 /dev/tty1
            login 452 root 1u CHR 4,1 0t0 1042 /dev/tty1
            login 452 root 2u CHR 4,1 0t0 1042 /dev/tty1
            agetty 453 root cwd DIR 179,2 4096 2 /
            agetty 453 root rtd DIR 179,2 4096 2 /
            agetty 453 root txt REG 179,2 30508 11722 /sbin/agetty
            agetty 453 root mem REG 179,2 46820 14154 /lib/arm-linux-gnueabihf/libnss_files-2.19.so
            agetty 453 root mem REG 179,2 38612 14156 /lib/arm-linux-gnueabihf/libnss_nis-2.19.so
            agetty 453 root mem REG 179,2 71628 14151 /lib/arm-linux-gnueabihf/libnsl-2.19.so
            agetty 453 root mem REG 179,2 30592 14152 /lib/arm-linux-gnueabihf/libnss_compat-2.19.so
            agetty 453 root mem REG 179,2 1607760 1945 /usr/lib/locale/locale-archive
            agetty 453 root mem REG 179,2 1242776 13269 /lib/arm-linux-gnueabihf/libc-2.19.so
            agetty 453 root mem REG 179,2 18920 138554 /usr/lib/arm-linux-gnueabihf/libarmmem.so
            agetty 453 root mem REG 179,2 134448 13266 /lib/arm-linux-gnueabihf/ld-2.19.so
            agetty 453 root 0u CHR 204,64 0t0 1026 /dev/ttyAMA0
            agetty 453 root 1u CHR 204,64 0t0 1026 /dev/ttyAMA0
            agetty 453 root 2u CHR 204,64 0t0 1026 /dev/ttyAMA0
            Xorg 568 root 7u CHR 4,7 0t0 1048 /dev/tty7
            llvmpipe- 568 587 root 7u CHR 4,7 0t0 1048 /dev/tty7
            llvmpipe- 568 588 root 7u CHR 4,7 0t0 1048 /dev/tty7
            llvmpipe- 568 589 root 7u CHR 4,7 0t0 1048 /dev/tty7
            llvmpipe- 568 590 root 7u CHR 4,7 0t0 1048 /dev/tty7
            bash 608 pi 0u CHR 4,1 0t0 1042 /dev/tty1
            bash 608 pi 1u CHR 4,1 0t0 1042 /dev/tty1
            bash 608 pi 2u CHR 4,1 0t0 1042 /dev/tty1
            bash 608 pi 255u CHR 4,1 0t0 1042 /dev/tty1

            Regards,

            Bert

          • Hi Bert,

            your serial device is opened by agetty (Console)

            agetty 453 root 0u CHR 204,64 0t0 1026 /dev/ttyAMA0

            Please check /boot/cmdline.txt there should be NO options containing /dev/ttyAMA0.

            Whats the state of the serial getty:

            systemctl status serial-getty@ttyAMA0.service

            Michael

      • Hello
        Thank you very much for the help
        Now works perfectly
        Just a detail, setting a fixed ip address, ETS does not detect any programmer but if I leave the ip dhcp, if it detects raspberry and works perfectly.

        Reply

  37. Hi Michl,

    Can we find your last Script on Github ?
    I will check all changes for the future 😉

    Thanks again for your Script

    Is this your Git Place ?
    https : // github.com / Race666 / install-knxd

    Reply

  38. Dear Michail ;
    First of all many thanks for the clever solutions . But I fortunately I tried may be 100 times it’s not working .
    You are technical person and you are thinking that everybody know the linux or whatever else language commands . If its possible can you explain all issues from the begining step by step . For example how can I do static ip fixing on my rpi . Some part of your explain is not enough for get the any solution .

    Thanks and Regards ….

    Reply

    • Hi Bego,

      the post is already written for less experienced Linux Users but some basics operating system know how like creating/editing a file, executing commands is essential. WhenI should explain that too the post would grow and grow… I think you should start with a linux for beginner tutorial otherwise you will have no fun with your Raspberry at all.

      Michael

      Reply

  39. recently KNX launched there ETS Inside server app. anybody planning on getting this app running on a Raspberry-pi?

    Reply

    • Hi Antony,

      ETS inside would not be run on a Raspberry because it requieres Windows

      https://support.knx.org/hc/en-us/articles/213649465-Requirements-for-ETS-Inside-server

      Windows doesn’t run on ARM CPU Architecture, expect Window 10 IoT but this is not support by ETS inside.

      Michael

      Reply

      • KNX support answered that win10 must be emulated on the PI. Never seen anybody managed to do that. But interesting is that ELKA Elektronik GMBH saying they managed to get ETS Inside running on Win10IoT.

        Reply

  40. Hi Michael,

    if you thinks that the following questions are off-topic, please feel free to ignore this post.

    After the successful setup of knxd on my PI3 (see previous discussion – thanks again!), I am stuck with the corresponding binding in openHAB. Using knxtool, I am able to control my rollershutter on GA 3/2/1. In my .items, the device is configured as

    Rollershutter Rolladen_Test “Rolladen Test” [“Rollershutter”] {knx=”3/2/1″}

    It shows up correctly in the openHAB Basic UI – however, the shutter does not do anything when pushing the “up” or “down” buttons. In knx.cfg, the binding is configured as ROUTER, and openhab2.log confirms the connection (I also tried TUNNEL mode, but this leads to a timeout error):

    2017-03-12 12:12:14.517 [INFO ] [nx.internal.connection.KNXConnection] – Established connection to KNX bus on 224.0.23.12:6720 in mode ROUTER.

    After enabling some traces in the Karaf console, the log file contains additional information when pressing the “up” button (attached below), but no obvious indication of errors.

    Any help or hint would be highly appreciated!

    Thorsten

    2017-03-12 13:36:31.543 [TRACE] [.binding.knx.internal.bus.KNXBinding] – Received update (item=’Rolladen_Test’, state=’UP’)
    2017-03-12 13:36:31.547 [TRACE] [.binding.knx.internal.bus.KNXBinding] – Received command (item=’Rolladen_Test’, command=’UP’)
    2017-03-12 13:36:31.553 [TRACE] [g.knx.internal.dpt.KNXCoreTypeMapper] – toTypeClass looking for dptId = 1.008
    2017-03-12 13:36:31.554 [TRACE] [g.knx.internal.dpt.KNXCoreTypeMapper] – toTypeClass looking for dptId = 1.008
    2017-03-12 13:36:31.555 [TRACE] [.binding.knx.internal.bus.KNXBinding] – found 1 compatible datapoints for item Rolladen_Test (org.openhab.core.library.types.UpDownType)
    2017-03-12 13:36:31.555 [TRACE] [.binding.knx.internal.bus.KNXBinding] – found 1 compatible datapoints for item Rolladen_Test (org.openhab.core.library.types.UpDownType)
    2017-03-12 13:36:31.582 [DEBUG] [tuwien.auto.calimero ] – KNXnet/IP Routing 224.0.23.12:3671: add to multicast loopback frame buffer: L-Data.ind from 0.0.0 to 3/2/1, low priority hop count 6 tpdu 00 80
    2017-03-12 13:36:31.583 [DEBUG] [tuwien.auto.calimero ] – KNXnet/IP Routing 224.0.23.12:3671: add to multicast loopback frame buffer: L-Data.ind from 0.0.0 to 3/2/1, low priority hop count 6 tpdu 00 80
    2017-03-12 13:36:31.589 [DEBUG] [tuwien.auto.calimero ] – KNXnet/IP Routing 224.0.23.12:3671: sending cEMI frame seq 0, non-blocking, attempt 1 (channel 0) 06 10 05 30 00 11 29 00 bc e0 00 00 1a 01 01 00 80
    2017-03-12 13:36:31.590 [DEBUG] [.binding.knx.internal.bus.KNXBinding] – Wrote value ‘UP’ to datapoint ‘command DP 3/2/1 Rolladen_OG_Ankleidezimmer, DPT main 0 id 1.008, low priority’
    2017-03-12 13:36:31.592 [DEBUG] [.binding.knx.internal.bus.KNXBinding] – Wrote value ‘UP’ to datapoint ‘command DP 3/2/1 Rolladen_OG_Ankleidezimmer, DPT main 0 id 1.008, low priority’
    2017-03-12 13:36:31.593 [DEBUG] [tuwien.auto.calimero ] – KNXnet/IP Routing 224.0.23.12:3671: discard multicast loopback cEMI frame: L-Data.ind from 0.0.0 to 3/2/1, low priority hop count 6 tpdu 00 80
    2017-03-12 13:36:31.594 [DEBUG] [tuwien.auto.calimero ] – KNXnet/IP Routing 224.0.23.12:3671: sending cEMI frame seq 0, non-blocking, attempt 1 (channel 0) 06 10 05 30 00 11 29 00 bc e0 00 00 1a 01 01 00 80
    2017-03-12 13:36:31.596 [DEBUG] [tuwien.auto.calimero ] – KNXnet/IP Routing 224.0.23.12:3671: discard multicast loopback cEMI frame: L-Data.ind from 0.0.0 to 3/2/1, low priority hop count 6 tpdu 00 80

    Reply

    • Hi Thorsten,

      have you tried to increase the number of clients?

      /etc/default/knxd

      …. –client-addrs=1.1.129:16 …..

      I think my default value is choosen too small.

      Michael

      Reply

      • Hi Michael,

        my error: knx.cfg was configured to use the KNX gateway port 6720. After changing this to 3671 (and using TUNNEL instead of ROUTER connection type – with port 3671, TUNNELing works), openHAB successfully operates the roller shutter!

        Thanks again for your ultra-fast responses!

        Thorsten

        Reply

  41. Hi Michael,

    thanks for the great work – the installation on a Raspberry Pi3 with busware TUL worked fine and the installation didn´t show an error-message.

    But when I try to see if the knxd runs the ps ax | grep knxd only provides:
    1604 pts/0 S+ 0:00 grep –color=auto knxd
    and
    root@RasPi:/home/pi# systemctl status knxd
    ● knxd.service
    Loaded: masked (/dev/null)
    Active: inactive (dead)

    checking on some logs/status doesn´t tell me much:
    /etc/default/knxd has the active line:
    # Serial device Raspberry
    KNXD_OPTIONS=”–eibaddr=1.0.1 –client-addrs=1.0.2:1 -d -D -T -R -S -i –listen-
    local=/tmp/knx -b tpuarts:/dev/ttyAMA0″

    root@RasPi:/dev# ls -als ttyA*
    0 crw-rw—- 1 root dialout 166, 0 Mär 19 21:17 ttyACM0
    0 crw-rw—- 1 root dialout 166, 1 Mär 19 21:17 ttyACM1
    0 crw-rw—- 1 root dialout 204, 64 Mär 19 21:17 ttyAMA0

    And as expected any connection to the KNX-Bus doesn´t work
    root@RasPi:~# knxtool busmonitor1 ip:localhost
    Open failed: Connection refused

    Any help welcome where to look into to figure out what is going on and what to fix.

    Thanks in advance

    Peter

    Reply

  42. Hi Michael

    did some further test and trial after browsing through the Blog – the best result via manual start I could achieve so far is the follwing start&trace – but a parallel busmonitor call just hangs until ^C:

    pi@RasPi:/dev $ /usr/local/bin/knxd -e 1.0.1 -E 1.0.2:8 -t1023 -c -u /tmp/knx -p /run/knxd/knxd.pid -i -D -T -R -S –trace=5 –error=5 tpuarts:/dev/ttyAMA0
    [1] 1371
    pi@RasPi:/dev $ knxd: Layer 3 [ 2:layer3 0.000] Open
    knxd: Layer 3 [ 2:layer3 0.000] L3 started
    knxd: Layer 4 [ 3:cache 0.000] GroupCacheInit
    knxd: Layer 3 [ 2:layer3 0.001] registerLayer2 3:cache
    knxd: Layer 3 [ 2:layer3 0.001] registerLayer2 3:cache = 1
    knxd: Layer 4 [ 3:cache 0.001] GroupCacheEnable
    knxd: Layer 8 [ 4:/tmp/knx 0.001] OpenLocalSocket /tmp/knx
    knxd: Layer 8 [ 4:/tmp/knx 0.001] LocalSocket opened
    knxd: Layer 3 [ 2:layer3 0.001] registerLayer2 4:/tmp/knx
    knxd: Layer 3 [ 2:layer3 0.001] registerLayer2 4:/tmp/knx = 1
    knxd: Layer 8 [ 5:inet 0.001] OpenInetSocket 6720
    knxd: Layer 8 [ 5:inet 0.001] InetSocket opened
    knxd: Layer 3 [ 2:layer3 0.001] registerLayer2 5:inet
    knxd: Layer 3 [ 2:layer3 0.001] registerLayer2 5:inet = 1
    knxd: Layer 8 [ 6:mcast:knxd 0.001] Open
    knxd: Layer 0 [ 6:mcast:knxd 0.001] Open
    knxd: Layer 0 [ 6:mcast:knxd 0.001] Openend
    knxd: Layer 8 [ 6:mcast:knxd 0.001] OpenD
    knxd: Layer 8 [ 6:mcast:knxd 0.002] OpenedD
    knxd: Layer 8 [ 6:mcast:knxd 0.002] Opened
    knxd: Layer 3 [ 2:layer3 0.002] registerLayer2 6:mcast:knxd
    knxd: Layer 3 [ 2:layer3 0.002] registerLayer2 6:mcast:knxd = 1
    knxd: Layer 2 [ 7:tpuarts:/dev/ttyAMA0 0.002] Open
    knxd: Layer 2 [ 7:tpuarts:/dev/ttyAMA0 0.002] Open
    knxd: Layer 0 [ 7:tpuarts:/dev/ttyAMA0 0.003] Opened /dev/ttyAMA0 with baud 19200
    knxd: Layer 2 [ 7:tpuarts:/dev/ttyAMA0 0.003] Openend
    knxd: Layer 2 [ 7:tpuarts:/dev/ttyAMA0 0.003] Buffer Setup
    knxd: Layer 3 [ 2:layer3 0.003] registerLayer2 7:tpuarts:/dev/ttyAMA0
    knxd: Layer 2 [ 7:tpuarts:/dev/ttyAMA0 0.003] open
    knxd: Layer 0 [ 7:tpuarts:/dev/ttyAMA0 0.003] SendReset 01
    knxd: Layer 3 [ 2:layer3 0.003] registerLayer2 7:tpuarts:/dev/ttyAMA0 = 1
    knxd: Layer 0 [ 1:main 0.003] 0.12.15:776a315: /usr/local/bin/knxd -e 1.0.1 -E 1.0.2:8 -t1023 -c -u /tmp/knx -p /run/knxd/knxd.pid -i -D -T -R -S –trace=5 –error=5 tpuarts:/dev/ttyAMA0
    knxd: I00000000: 0.12.15:776a315: /usr/local/bin/knxd -e 1.0.1 -E 1.0.2:8 -t1023 -c -u /tmp/knx -p /run/knxd/knxd.pid -i -D -T -R -S –trace=5 –error=5 tpuarts:/dev/ttyAMA0
    knxd: Layer 0 [ 7:tpuarts:/dev/ttyAMA0 0.600] SendReset 01
    knxd: Layer 0 [ 7:tpuarts:/dev/ttyAMA0 1.201] SendReset 01
    knxd: Layer 0 [ 7:tpuarts:/dev/ttyAMA0 1.802] SendReset 01


    knxd: Layer 0 [ 7:tpuarts:/dev/ttyAMA0 51.059] SendReset 01
    knxd: Layer 0 [ 7:tpuarts:/dev/ttyAMA0 51.660] SendReset 01
    knxd: Layer 8 [ 5:inet 51.820] New Connection
    knxd: Layer 8 [ 5:inet 51.820] ClientConnection Init
    knxd: Layer 8 [ 2:layer3 51.820] unknown addr 1.0.2
    knxd: Layer 3 [ 8:inet 51.821] Allocate 1.0.2
    knxd: Layer 0 [ 8:inet 51.821] ReadMessage(002): 00 11
    knxd: Layer 7 [ 9:inet:monitor 51.821] Open A_Busmonitor
    knxd: Layer 3 [ 2:layer3 51.821] registerBusmonitor 001774E8
    knxd: Layer 0 [ 7:tpuarts:/dev/ttyAMA0 51.821] Send openBusmonitor 7EE37E6F
    knxd: Layer 3 [ 2:layer3 51.821] registerBusmontitr 001774E8 = 1
    knxd: Layer 0 [ 8:inet 51.821] Send(002): 00 11

    # Start from separate shell
    pi@RasPi:~ $ ps ax | grep knxd
    1371 pts/0 S 0:00 /usr/local/bin/knxd -e 1.0.1 -E 1.0.2:8 -t1023 -c -u /tmp/knx -p /run/knxd/knxd.pid -i -D -T -R -S –trace=5 –error=5 tpuarts:/dev/ttyAMA0
    1395 pts/1 S+ 0:00 grep –color=auto knxd

    pi@RasPi:~ $ knxtool busmonitor1 ip:localhost

    ^C

    knxd: Layer 8 [ 8:inet 101.558] ClientConnection 1.0.2 closing
    knxd: Layer 3 [ 2:layer3 101.558] Release 1.0.2
    knxd: Layer 7 [ 9:inet:monitor 101.558] Close A_Busmonitor
    knxd: Layer 2 [ 7:tpuarts:/dev/ttyAMA0 101.558] leaveBusmonitor
    knxd: Layer 2 [ 7:tpuarts:/dev/ttyAMA0 101.558] open
    knxd: Layer 0 [ 7:tpuarts:/dev/ttyAMA0 101.558] SendReset 01
    knxd: Layer 3 [ 2:layer3 101.558] deregisterBusmonitor 001774E8 = 1
    knxd: Layer 0 [ 7:tpuarts:/dev/ttyAMA0 102.158] SendReset 01

    Hope this helps

    Peter

    Reply

    • Hi Peter,

      is /dev/ttyAMA0 the correct device? Please post the output of

      dmesg|grep tty

      Michael

      Reply

  43. Ciao Michael,

    that was quick – here is the log of dmesg – just can´t read it to understand which device is doing what:

    pi@RasPi:~ $ dmesg | grep tty
    [ 0.000000] Kernel command line: 8250.nr_uarts=1 bcm2708_fb.fbwidth=720 bcm2708_fb.fbheight=480 bcm2708_fb.fbswap=1 dma.dmachans=0x7f35 bcm2709.boardrev=0xa02082 bcm2709.serial=0x60c987c2 bcm2709.uart_clock=48000000 smsc95xx.macaddr=B8:27:EB:C9:87:C2 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000 dwc_otg.lpm_enable=0 enable_uart=1 dtoverlay=pi3-disable-bt console=tty1 root=/dev/sda2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
    [ 0.001350] console [tty1] enabled
    [ 1.007158] 3f201000.uart: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
    [ 5.766001] cdc_acm 1-1.4:1.0: ttyACM0: USB ACM device
    [ 5.767844] cdc_acm 1-1.4:1.2: ttyACM1: USB ACM device

    Thanks for your help

    Peter

    Reply

  44. Ciao Michael

    changed tpuarts to ttyACM0 and it worked with this command directly:
    pi@RasPi:~ $ /usr/local/bin/knxd -e 1.0.1 -E 1.0.2:8 -p /run/knxd/knxd.pid -d -D -T -R -S -i -b tpuarts:/dev/ttyACM0
    pi@RasPi:~ $ knxtool groupsocketlisten ip:localhost
    Write from 1.1.123 to 2/1/34: 00
    Write from 1.1.106 to 1/1/10: 00

    But when I tried to start it as a service is tell me “masked” – Any idea ?

    pi@RasPi:~ $ sudo systemctl enable knxd.service
    Synchronizing state for knxd.service with sysvinit using update-rc.d…
    Executing /usr/sbin/update-rc.d knxd defaults
    Executing /usr/sbin/update-rc.d knxd enable

    pi@RasPi:~ $ sudo systemctl start knxd.service
    Failed to start knxd.service: Unit knxd.service is masked.
    pi@RasPi:~ $ sudo systemctl status knxd.service
    ● knxd.service
    Loaded: masked (/dev/null)
    Active: inactive (dead)

    Mär 20 23:56:21 RasPi systemd[1]: Stopped knxd.service.

    Any help welcome

    Peter

    Reply

    • Hi Peter,

      what says the log:

      sudo journalctl -xu knxd.service

      Try to unmask
      sudo systemctl unmask knxd.service

      and enable again
      sudo systemctl enable knxd.service

      Michael

      Reply

  45. Hi Michael,

    pi@RasPi:~ $ sudo systemctl unmask knxd.service
    Removed symlink /etc/systemd/system/knxd.service.
    pi@RasPi:~ $ sudo systemctl enable knxd.service
    Synchronizing state for knxd.service with sysvinit using update-rc.d…
    Executing /usr/sbin/update-rc.d knxd defaults
    Executing /usr/sbin/update-rc.d knxd enable
    pi@RasPi:~ $ sudo systemctl start knxd.service
    Job for knxd.service failed. See ‘systemctl status knxd.service’ and ‘journalctl -xn’ for details.

    and then:
    Mär 22 08:31:36 RasPi systemd[1]: Starting KNX Daemon…
    — Subject: Unit knxd.service has begun with start-up
    — Defined-By: systemd
    — —
    — Unit knxd.service has begun starting up.
    Mär 22 08:31:36 RasPi systemd[1]: PID 2660 read from file /run/knxd/knxd.pid does not exist or is a zombie.
    Mär 22 08:31:36 RasPi systemd[1]: Failed to start KNX Daemon.
    — Subject: Unit knxd.service has failed
    — Defined-By: systemd

    — Unit knxd.service has failed.

    — The result is failed.
    Mär 22 08:31:36 RasPi systemd[1]: Unit knxd.service entered failed state.

    I know its cumbersome but may this have to do with access rights of users or groups ? –
    Thanks for your help

    Peter

    Reply

    • Hi Peter,

      access rights of users or groups => may be 🙂 have you you started knxd one time as root ?

      does /run/knxd/knxd.pid exists?

      ls -l /run/knxd/knxd.pid

      have you already rebooted your raspberry?

      Michael

      Reply

  46. Hi Michael,

    Rebooted the Raspi, maybe I user root or sudo during installation or testing – that maybe the case – how do I found out if it created a problem?
    The folder /run/knxd exist for owner knxd and group knxd but it is empty and can only be accessed as user ‘su’ not as user ‘pi’ !
    When i try to start the systemctl start knxd.service it still shows the:
    Mär 22 18:15:12 RasPi systemd[1]: PID 2393 read from file /run/knxd/knxd.pid does not exist or is a zombie.
    Mär 22 18:15:12 RasPi systemd[1]: Failed to start KNX Daemon.
    message in the journalctl

    Is some process supposed to write such a pid file ? – does this fail ? –

    Best Regards

    Peter

    Reply

  47. Hi Michael

    added the tracing to the /etc/defaul/knxd with -t1023 and I get a different log/behaviour after reboot and refreshing via “enable, start” of the service afterwards – maybe this gives a hint where the issue may be:

    pi@RasPi:~ $ sudo reboot
    pi@RasPi:~ $ sudo systemctl status knxd.service
    ● knxd.service – KNX Daemon
    Loaded: loaded (/lib/systemd/system/knxd.service; enabled)
    Active: failed (Result: exit-code) since Mit 2017-03-22 22:17:04 CET; 7min ago
    Process: 463 ExecStart=/usr/local/bin/knxd -p /run/knxd/knxd.pid $KNXD_OPTIONS (code=exited, status=1/FAILURE)

    Mär 22 22:17:04 RasPi knxd[463]: knxd: Layer 8 [ 2:mcast:knxd 0.043] Open
    Mär 22 22:17:04 RasPi knxd[463]: knxd: Layer 0 [ 2:mcast:knxd 0.043] Open
    Mär 22 22:17:04 RasPi knxd[463]: knxd: Layer 0 [ 2:mcast:knxd 0.044] Openend
    Mär 22 22:17:04 RasPi knxd[463]: knxd: Layer 8 [ 2:mcast:knxd 0.044] OpenD
    Mär 22 22:17:04 RasPi knxd[463]: knxd: Layer 8 [ 2:mcast:knxd 0.044] CloseD
    Mär 22 22:17:04 RasPi knxd[463]: knxd: Layer 0 [ 2:mcast:knxd 0.044] Close
    Mär 22 22:17:04 RasPi knxd[463]: initialization of the EIBnet/IP server failed: No such device
    Mär 22 22:17:04 RasPi systemd[1]: knxd.service: control process exited, code=exited status=1
    Mär 22 22:17:04 RasPi systemd[1]: Failed to start KNX Daemon.
    Mär 22 22:17:04 RasPi systemd[1]: Unit knxd.service entered failed state.

    The try to restart:

    pi@RasPi:~ $ sudo systemctl stop knxd.service
    pi@RasPi:~ $ sudo systemctl daemon-reload
    pi@RasPi:~ $ sudo systemctl enable knxd.service
    Synchronizing state for knxd.service with sysvinit using update-rc.d…
    Executing /usr/sbin/update-rc.d knxd defaults
    Executing /usr/sbin/update-rc.d knxd enable
    pi@RasPi:~ $ sudo systemctl start knxd.service
    Job for knxd.service failed. See ‘systemctl status knxd.service’ and ‘journalctl -xn’ for details.
    pi@RasPi:~ $ sudo systemctl status knxd.service
    ● knxd.service – KNX Daemon
    Loaded: loaded (/lib/systemd/system/knxd.service; enabled)
    Active: failed (Result: resources) since Mit 2017-03-22 22:29:00 CET; 5s ago
    Process: 1586 ExecStart=/usr/local/bin/knxd -p /run/knxd/knxd.pid $KNXD_OPTIONS (code=exited, status=0/SUCCESS)

    Mär 22 22:29:00 RasPi knxd[1586]: knxd: Layer 0 [ 5:tpuarts:/dev/ttyACM0 0.002] Opening /dev/ttyACM0 failed: Permission denied
    Mär 22 22:29:00 RasPi knxd[1586]: knxd: Layer 3 [ 3:layer3 0.002] registerLayer2 5:tpuarts:/dev/ttyACM0
    Mär 22 22:29:00 RasPi knxd[1586]: knxd: Layer 2 [ 5:tpuarts:/dev/ttyACM0 0.002] open
    Mär 22 22:29:00 RasPi knxd[1586]: knxd: Layer 8 [ 5:tpuarts:/dev/ttyACM0 0.002] ser state 0>12
    Mär 22 22:29:00 RasPi knxd[1586]: knxd: Layer 8 [ 5:tpuarts:/dev/ttyACM0 0.002] ser state 0>5
    Mär 22 22:29:00 RasPi knxd[1586]: knxd: Layer 3 [ 3:layer3 0.003] registerLayer2 5:tpuarts:/dev/ttyACM0 = 1
    Mär 22 22:29:00 RasPi knxd[1586]: knxd: Layer 0 [ 1:main 0.003] 0.12.15:776a315: /usr/local/bin/knxd -p /run/knxd/knxd.pid –eibaddr=1.0….dev/ttyACM0
    Mär 22 22:29:00 RasPi systemd[1]: PID 1588 read from file /run/knxd/knxd.pid does not exist or is a zombie.
    Mär 22 22:29:00 RasPi systemd[1]: Failed to start KNX Daemon.
    Mär 22 22:29:00 RasPi systemd[1]: Unit knxd.service entered failed state.

    It looks like there is either a problem with the availability of the ttyACM01 at reboot time or some access right to the ttyACM0 ??

    I do not know how to get more tracing/logs to really figure out what to try next:-(

    Thanks in advance

    Peter

    Reply

    • Hi Peter,

      Mär 22 22:17:04 RasPi knxd[463]: initialization of the EIBnet/IP server failed: No such device => Is your network properly configured? Have you set a static IP and is the Mulitcast Address 224.0.23.12/32 in place? Post the output of

      route

      Opening /dev/ttyACM0 failed: Permission denied => knxd starts as user knxd. What are the permission on ttyACM0

      ls -l /dev/ttyACM0

      Mär 22 22:29:00 RasPi systemd[1]: PID 1588 read from file /run/knxd/knxd.pid does not exist or is a zombie. => Permissions here?

      ls -l /run/

      Try to start knxd as User knxd in foreground. Start a shell as user knxd

      sudo su knxd -s /bin/sh

      and start knxd without daemonize (without -d) and see whats happend. Adjust the tracelevel…..

      /usr/local/bin/knxd -e 1.0.1 -E 1.0.2:8 -p /run/knxd/knxd.pid -D -T -R -S -i -b tpuarts:/dev/ttyACM0

      Michael

      Reply

  48. Hi Michael,

    I think we are getting close.

    Concerning the Multicast Address I do not get the point why I would need an external internet address 224.0.23.12/32 setup – so the Raspi is currnenty fixed to
    192.168.1.15 and I need this fixed for other services as well.
    pi@RasPi:~ $ route provides:
    Kernel-IP-Routentabelle
    Ziel Router Genmask Flags Metric Ref Use Iface
    default 192.168.1.1 0.0.0.0 UG 202 0 0 eth0
    192.168.1.0 * 255.255.255.0 U 202 0 0 eth0

    ip addr
    2: eth0: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:c9:87:c2 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.15/24 brd 192.168.1.255 scope global eth0
    valid_lft forever preferred_lft forever
    inet6 fe80::6ed8:459c:aee3:be6b/64 scope link
    valid_lft forever preferred_lft forever

    and therefore no file in /etc/systemd/network: ls -als

    4 drwxr-xr-x 2 root root 4096 Jan 24 2016 .
    4 drwxr-xr-x 6 root root 4096 Jan 29 10:35 ..

    Concerning the rights: – The /dev/ttyAMCO is owned by root ?
    root@RasPi:~# ls -l /dev/ttyACM0
    crw-rw—- 1 root dialout 166, 0 Mär 23 21:17 /dev/ttyACM0

    and the knxd is owned by “knxd”
    pi@RasPi:~ $ ls -l /run/
    drwxr–r– 2 knxd knxd 40 Mär 23 22:03 knxd

    The starting of the knxd is failing (as user “root” and “pi” it actually works fine!):

    root@RasPi:~# sudo su knxd -s /bin/sh
    $ /usr/local/bin/knxd -e 1.0.1 -E 1.0.2:8 -p /run/knxd/knxd.pid -t1022 -D -T -R -S -i -b tpuarts:/dev/ttyACM0
    knxd: Layer 8 [ 2:mcast:knxd 0.000] Open
    knxd: Layer 8 [ 2:mcast:knxd 0.000] OpenD
    knxd: Layer 8 [ 2:mcast:knxd 0.001] OpenedD
    knxd: Layer 8 [ 2:mcast:knxd 0.001] Opened
    knxd: Layer 3 [ 3:layer3 0.001] Open
    knxd: Layer 3 [ 3:layer3 0.001] L3 started
    knxd: Layer 3 [ 3:layer3 0.001] registerLayer2 2:mcast:knxd
    knxd: Layer 3 [ 3:layer3 0.001] registerLayer2 2:mcast:knxd = 1
    knxd: Layer 8 [ 4:inet 0.001] OpenInetSocket 6720
    knxd: Layer 8 [ 4:inet 0.002] InetSocket opened
    knxd: Layer 3 [ 3:layer3 0.002] registerLayer2 4:inet
    knxd: Layer 3 [ 3:layer3 0.002] registerLayer2 4:inet = 1
    knxd: Layer 2 [ 5:tpuarts:/dev/ttyACM0 0.002] Open
    knxd: Layer 2 [ 5:tpuarts:/dev/ttyACM0 0.002] Open
    knxd: Layer 8 [ 5:tpuarts:/dev/ttyACM0 0.002] ser state 0>2
    knxd: Layer 3 [ 3:layer3 0.002] registerLayer2 5:tpuarts:/dev/ttyACM0
    knxd: Layer 2 [ 5:tpuarts:/dev/ttyACM0 0.002] open
    knxd: Layer 8 [ 5:tpuarts:/dev/ttyACM0 0.002] ser state 0>12
    knxd: Layer 8 [ 5:tpuarts:/dev/ttyACM0 0.002] ser state 0>5
    knxd: Layer 3 [ 3:layer3 0.002] registerLayer2 5:tpuarts:/dev/ttyACM0 = 1
    Segmentation fault

    Do I need to get ttyACM0 owned by knxd ?? – I do not even know how to do this?
    Whatfor do I need such a strange Multicast address ?

    Warm Regards

    Peter

    Reply

    • Hi Peter,

      224.0.23.12/32 is not an external IP Address. This is a multicast address and only available in your local network. The router will not forward this address to the internet. Simple explaintation: Mulicast addresses are used when multiple computer should talk together means one of them sends and all other should receive the packets. knxd needs this for tunneling.

      Do I need to get ttyACM0 owned by knxd ?? => No, the dialout group has permissions to the serial devices. Add the user knxd to the dialout group (what my script does 🙂 )

      Michael

      Reply

  49. Hi Michael,

    thanks – something new I learned – I´ve setup the network address as described and now route shows:
    pi@RasPi:~ $ route
    Kernel-IP-Routentabelle
    Ziel Router Genmask Flags Metric Ref Use Iface
    default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
    192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
    224.0.23.12 * 255.255.255.255 UH 0 0 0 eth0

    But after reboot the Raspi still showed the:
    knxd: Layer 0 [ 5:tpuarts:/dev/ttyACM0 0.040] Opening /dev/ttyACM0 failed: Permission denied

    I´ve used initially your install_knxd_systemd.sh script for installation and didn´t see an error-message.
    As a try I added user “knxd” again to the group “dialout” – now it works and all is fine

    Thanks for your help and patience

    Warm Regards

    Peter

    Reply

    • Hi Peter,

      You’re welcome 🙂

      Michael

      Reply

  50. Hi Michael,

    all fine with knxd but with the changes in /etc/resolv.conf the raspi doesn´t find any DNS names anymore: but /run/systemd/resolve/resolv.conf shows:
    nameserver 62.202.44.223
    nameserver 62.2.121.84
    which should work – but any ping leads to “unknown host” – any idea why this shoudl be now broken with the setup I used at the beginning of your article?

    Any help welcome

    Peter

    Reply

    • Hi Peter,

      the link from /etc/resolv.conf to /run/systemd/resolve/resolv.conf exists?

      ls -l /etc/resolv.conf

      Nameserver are working? Whats output of (without the leading http:// WordPress add this):

      nslookup http://www.heise.de 62.202.44.223

      Michael

      Reply

      • Hi Michael,

        the links exists as
        pi@RasPi:~ $ ls -l /etc/resolv.conf
        lrwxrwxrwx 1 root root 24 Mär 24 09:20 /etc/resolv.conf -> /run/systemd/resolv.conf

        but nslookup is not installed “-bash: nslookup: Kommando nicht gefunden.”
        and without nameserver I can not update or download packages 🙁
        Is there another way to see if the nameserver is working – it seems that there is the issue.
        Regards
        Peter

        Reply

        • Hi Michael,

          I figured it out – the link was wrong – a /resolve/ was missing – its back working again
          Thx

          Peter

          Reply

  51. upgraded to raspberry2 with latest release, eibd 100% problem. used your guide to set knxd up, worked at the first try. thanks for this great guide and the greater script!!!

    Reply

  52. Hi Michael,

    I am trying to set this up with a RPi, OpenhabianPi as the installed OS, and a Weinzierl module: knx-baos-module-838

    Any idea if this will work with that setup? Will the Weinzierl module work with the TPUART config as indicated in your guide?

    Thanks for all your help!

    Reply

  53. hi Michael,

    many thanks for all your help!

    I’ve been trying this all day with no luck. Here are my outputs:
    [ 0.000000] Kernel command line: 8250.nr_uarts=1 dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2709.boardrev=0xa02082 bcm2709.serial=0xf42202f7 smsc95xx.macaddr=B8:27:EB:22:02:F7 bcm2708_fb.fbswap=1 bcm2709.uart_clock=48000000 vc_mem.mem_base=0x3ea00000 vc_mem.mem_size=0x3f000000 dwc_otg.lpm_enable=0 enable_uart=1 dtoverlay=pi3-disable-bt console=tty1 elevator=deadline net.ifnames=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
    [ 0.001324] console [tty1] enabled
    [ 0.839357] 3f215040.uart: ttyS0 at MMIO 0x3f215040 (irq = 59, base_baud = 31250000) is a 16550
    [ 2.327040] 3f201000.uart: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
    [ 9.391195] systemd[1]: Starting system-getty.slice.
    [ 9.395523] systemd[1]: Created slice system-getty.slice.

    /etc/default/knxd:

    KNXD_OPTIONS=”–eibaddr=1.1.128 –client-addrs=1.1.129:10 -d -D -T -R -S -i –listen-local=/tmp/knx -b ft12cemi:/dev/ttyAMA0″

    (I tried changing this to ft12:/dev/ttyAMA0 and ft12cemi:/dev/ttyS0

    knxtool vbusmonitor1 ip:localhost
    and
    knxtool busmonitor1 ip:localhost

    provide no output or:
    Open Busmonitor failed: Device or resource busy

    I have ETS5 with the following settings:
    individual address:
    1.1.128
    server:
    192.168.178.2 (openhabianpi)
    port:
    6720

    any help would be greatly appreciated

    Reply

    • Hi Michael,

      Any guidance with this? I am still stuck….
      thanks,
      Lukas

      Reply

  54. Thank you for this great tutorial!!

    My Setup:
    – Raspberry Pi Zero W
    – Abelelectronics Serial Pi Zero (Pi RS232 Extension Board)
    – Busch Jäger 6186 (RS232 EIB Interface)

    I’ve tried various config setting but I cant get any connection via knxtool busmonitor.

    I tried the following configurations:
    KNXD_OPTIONS=”–eibaddr=1.1.128 –client-addrs=1.1.129:10 -d -D -T -R -S -i –listen-local=/tmp/knx -b ft12cemi:/dev/ttyAMA0″

    KNXD_OPTIONS=”–eibaddr=1.1.128 –client-addrs=1.1.129:10 -d -D -T -R -S -i –listen-local=/tmp/knx -b ft12:/dev/ttyAMA0″

    KNXD_OPTIONS=”–eibaddr=1.1.128 –client-addrs=1.1.129:10 -d -D -T -R -S -i –listen-local=/tmp/knx -b tpuarts:/dev/ttyAMA0″

    but nothing seems to work

    What am I doing wrong? 🙁

    Thanks in advance,
    Jan

    Reply

    • Hi Jan,

      in my opinion you cannot couple a Busch Jäger 6186 (http://archiv.busch-jaeger-katalog.de/files/files_ONLINE/b_6186_20.pdf) interface with the Raspberry Pi. I think this interface is just speaking PEI 16 protocol not FT1.2 nor tpuart which are the minimum requierments to couple with an Raspberry because these two interfaces types are needing only the RxD and the TxD lines of the serial interface. As descripted in the Datasheet for 6186 an addional RTS Pin (may be for Handshake), which a raspberry does not provide, is requiered.

      Michael

      Reply

  55. Hi Michael

    Wrote you a few month ago. But now i am in trouble again. I managed to set up the Connection for a few month now.
    Accidently after a restart now i am not able to read the Bus anymore. I can see telegrams in busmonitor1 but not in vbusmonitor1 anymore. The same for ETS and FHEM. It is still possible to write to the bus via ETS FHEM or Groupswrite but i dont recieve Telegrams from Light Switches not in vbusmonitor nor in ETS. Funny thing is that it was working yesterday. i tried to stop and start the service manualy without success.
    You mentioned that %DEVICEID is not correct here is the result of

    ps ax|grep knxd
    438 ? Ss 0:00 /usr/local/bin/knxd -p /run/knxd/knxd.pid –eibaddr=1.1.128 -d -D -T -R -S -i –listen-local=/tmp/knx usb:%DEVICEID%
    914 pts/0 S+ 0:00 grep –color=auto knxd

    do you have any idea what i did wrong. i unplugged the system few days ago but it was working after that. I think i just switched off the System today to make some Installations and after that vbusmonitor was gone. Could it have something to do with the Problem the other Michael described. With the Substitution of USBID i am a total noob when it comes to debugging stuff like that.

    Reply

  56. tried a little bit

    /usr/local/bin/knxd-findusb.sh

    the result is

    cat /etc/default/knxd
    # Command line parameters for knxd. TPUART Backend
    # Serial device Raspberry
    # KNXD_OPTIONS=”–eibaddr=1.1.128 -d -D -T -R -S -i –listen-local=/tmp/knx tpuarts:/dev/ttyAMA0″
    # Serial device PC
    # KNXD_OPTIONS=”–eibaddr=1.1.128 -d -D -T -R -S -i –listen-local=/tmp/knx tpuarts:/dev/ttyS0″
    # Tunnel Backend
    # KNXD_OPTIONS=”–eibaddr=1.1.128 -d -D -T -R -S -i –listen-local=/tmp/knx ipt:192.168.56.1″
    # USB Backend
    KNXD_OPTIONS=”–eibaddr=1.1.128 -d -D -T -R -S -i –listen-local=/tmp/knx usb:%DEVICEID%”

    route
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    default fritz.box 0.0.0.0 UG 0 0 0 eth0
    192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
    224.0.23.12 * 255.255.255.255 UH 0 0 0 eth0

    dmesg | grep tty
    [ 0.000000] Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708.boardrev=0xe bcm2708.serial=0xed82fb77 smsc95xx.macaddr=B8:27:EB:82:FB:77 bcm2708_fb.fbswap=1 bcm2708.uart_clock=3000000 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000 dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait fbcon=map:10 consoleblank=0
    [ 0.001388] console [tty1] enabled
    [ 0.204581] 20201000.uart: ttyAMA0 at MMIO 0x20201000 (irq = 81, base_baud = 0) is a PL011 rev2

    Reply

  57. Sorry for spamming the last Info i could achieve was that. But i have no idea how to interpret that.

    sudo ls -l /dev/ttyAMA0
    crw-rw—- 1 root dialout 204, 64 May 2 23:38 /dev/ttyAMA0

    Reply

  58. Okay Problem solved with ABB KNX USB Interface. I did a clean install of KNXD with your Script again and set the Option string in
    /etc/default/knxd manualy

    KNXD_OPTIONS=”–eibaddr=1.1.128 –client-addrs=1.1.129:10 -d -D -T -R -S -i –listen-local=/tmp/knx -b usb:1:4:1:0:0″

    somehow this changed at some point cause at first i got %DEVICEID% behind the usb. So seems you already updated your Script to new circumstances in KNXD.
    I read out the Device ID by

    pi@raspberrypi:/usr/local/bin $ findknxusb

    In Github smurfix already got this problem with another guy on Github. Same Interface ABB and only vbusmonitor not working for switches.

    USB only as root working #204
    was the thread

    Somehow this problem got realy close to mine and seems not have been solved at this point in time i think. So in the end after 2 month your Script runs flawless. Thanks a lot for keeping this stuff up to date its a great for noobs like me.
    sorry for just posting my thoughts here feel free to erase that stuff Michael.

    Keep up that great work.

    Reply

    • Hi Philipp,

      newer Versions (the version the script installs, stable 0.12) of knxd does not need to specify the USB Address. knxd finds the device himself at startup:

      KNXD_OPTIONS=”–eibaddr=$EIB_ADDRESS_KNXD –client-addrs=$EIB_START_ADDRESS_CLIENTS_KNXD:1 -d -D -T -R -S -i –listen-local=/tmp/knx -b usb:”

      so simply leave the KNXD_OPTIONS line as it is 🙂

      Michael

      Reply

  59. Hi Michael

    I have a Pi 3 running the latest openhabian and a TPUART GIRA Busankoppier 3. I cannot get the busmonitor to show any output so am doing something wrong.

    The only doubt I have is the wiring to the BTM. The BTM PIN numbers in your schematic diagram in the previous post don’t seem to match with the standard TP-UART spec published by siemens, PCBA_UP117-12_datasheet.pdf.

    Please can you explain the mapping of the BTM PINs in your schematic.

    many thanks
    Rich

    Reply

    • Hi Rich,

      as described in a previous comment:
      I used a standard pin header in the schematic and this has an different pin layout/couterwise then the TPUART Module:

      http://www.hqs.sbt.siemens.com/cps_product_data/gamma-b2b/PCBA_UP117-12_datasheet.pdf

      TPUART layout is

      10 9 8 7 6
      1 2 3 4 5
      | | | |

      while PIN Header is

      2 4 6 8 10
      1 3 5 7 9

      And therefore you have to translate
      Pin 1 TPUART is Pin 2 Pin Header
      Pin 2 TPUART is Pin 4 Pin Header
      Pin 4 TPUART is Pin 8 Pin Header
      Pin 5 TPUART is Pin 10 Pin Header

      Which interface do you use? A Siemens TPUART module or an Gria Busankoppler? In my opinion this is not the same.

      Michael

      Reply

      • Hi Michael.

        Thanks for the reply and posting the pin translation (again). My interpretation of the PIN translation was correct ….

        … but I was using the Gira Busankoppler. I swapped it for the Siemens TPUART and huzzah! All working now. Simple user error.

        I now know the Busankoppler and TPUART are not interchangeable!

        Reply

  60. Hi Michael,
    Thanks for this post. It works great.
    I have a question: I am using an knx/ip interface which is configured with dhcp address. so when i am using the ipt=”x.x.x.x” it works fine as long as i know the IP address of the interface. Is there a way to instruct knxd to search for the knx/IP and automatically use it in the ipt param (e.g. ipt=auto)
    Thank you again for the great post
    David Anidjar

    Reply

    • Hi David,

      I think not because a Tunnel always ends in an unicast address and you need to know this address.

      Why not assiging a static IP Address?

      Michael

      Reply

      • Hi Michael,
        Thank you for your answer.
        I do not have ETS program nor I am familiar with it. I thought it would be a nice feature to have.
        By the way, the /tmp/knx Unix domain socket uses Knx/IP protocol?
        Thanks again

        Reply

  61. Hi Micheal,
    I’m trying to use openhab2 on my knx home installation. I followed all your steps.
    My first Problem is, that I’m completey new to Linux and the second is when i type
    ps ax|grep knxd all i get is 1616 pts/0 S+ 0:00 grep knxd.
    I try to use the knxd on a raspberry pi 3 with raspbian and a Merten USB interface.

    Thanks in advance,
    Carsten

    Reply

    • Hi Carsten,

      it seems your knxd isn’t running. ps ax lists all running processes and it only founds the grep process with parameter knxd.

      Post the systemd log of the knxd.service:
      sudo journalctl -xu knxd

      Which interface do you use?

      Michael

      Reply

      • Hey Michael,
        thanks for the help.
        I’m using a Merten USB interface.
        This is what the log says:

        Logs begin at So 2017-07-30 20:56:01 CEST, end at Mo 2017-07-31 20:56:00 CEST
        Jul 30 20:56:04 raspberrypi systemd[1]: Starting KNX Daemon…
        — Subject: Unit knxd.service has begun with start-up
        — Defined-By: systemd


        — Unit knxd.service has begun starting up.
        Jul 30 20:56:05 raspberrypi knxd[506]: initialization of the EIBnet/IP server fa
        Jul 30 20:56:05 raspberrypi systemd[1]: knxd.service: control process exited, co
        Jul 30 20:56:05 raspberrypi systemd[1]: Failed to start KNX Daemon.
        — Subject: Unit knxd.service has failed
        — Defined-By: systemd


        — Unit knxd.service has failed.

        — The result is failed.

        ~
        — Logs begin at So 2017-07-30 20:56:01 CEST, end at Mo 2017-07-31 20:56:00 CEST
        Jul 30 20:56:04 raspberrypi systemd[1]: Starting KNX Daemon…
        — Subject: Unit knxd.service has begun with start-up
        — Defined-By: systemd


        — Unit knxd.service has begun starting up.
        Jul 30 20:56:05 raspberrypi knxd[506]: initialization of the EIBnet/IP server fa
        Jul 30 20:56:05 raspberrypi systemd[1]: knxd.service: control process exited, co
        Jul 30 20:56:05 raspberrypi systemd[1]: Failed to start KNX Daemon.
        — Subject: Unit knxd.service has failed
        — Defined-By: systemd


        — Unit knxd.service has failed.

        — The result is failed.
        Jul 30 20:56:05 raspberrypi systemd[1]: Unit knxd.service entered failed state.

        Reply

        • Hi Carsten,

          have you set a static IP Address?

          Jul 30 20:56:05 raspberrypi knxd[506]: initialization of the EIBnet/IP server fa => Means no Network interface (Multicast Address) is available.

          Have you tried to start knxd manually:

          sudo systemctl start knxd.service

          Michael

          Reply

          • Hey Michael,
            that was the fault, I set a static IP on the Pixel interface, doesn’t seem to work.
            Now I set the IP in the config and it works, great, thank you!

  62. hi! what im need change? i will use ip gateway, not usb…

    Reply

    • Hi maxx,

      I assume want to establish a tunnel connection to an IP Gateway, right?

      Edit /etc/default/knxd

      Comment the tpuarts config line
      # KNXD_OPTIONS=”–eibaddr=….. -b tpuarts:/dev/ttyAMA0″

      and remove the comment character from the ipt line
      KNXD_OPTIONS=”–eibaddr= ….. -b ipt:192.168.56.1″

      replace the IP Address with the address your gateway.

      Michael

      Reply

  63. Hi Michael,

    Installation works partly.

    What works: communication between homeserver and KNX

    Does not work:
    root@Raspberrypi:~# knxtool busmonitor1 ip:localhost
    Open Busmonitor failed: Connection reset by peer

    ETS5 it finds ip Tunneling, but no Connection possible.

    More Information:
    root@Raspberrypi:~# findknxusb
    Possible addresses for KNX USB devices:
    device: 1:4:1:0:0 (Gira Giersiepen GmbH & Co. KG:KNX-USB Data Interface)

    Reply

    • Solved, neet to use multicast adress in ETS5

      Reply

  64. Hi! Trying to set this up, but starting to wondering if it is possible to set it up on an older Raspberry Pi Model B or not?

    If it is I am wondering about the “destination IP” that one needs to setup when assigning static IP. Where is this IP supposed to point to?

    Reply

  65. Hi. I have problem with start knxd.service for KNX Usb interface. I get failed to start KNX Daemon. Content error:
    Aug 16 12:29:33 Hunter1 knxd[1053]: initialisation of backend ‘usb:1:4:1:0:0’ failed: Resource temporarily unavailable
    Aug 16 12:29:33 pi systemd[1]: knxd.service: control process exited, code=exited status=1
    Aug 16 12:29:33 pi systemd[1]: Failed to start KNX Daemon.
    Aug 16 12:29:33 pi systemd[1]: Unit knxd.service entered failed state.

    I try in Raspberry Pi 3 and don’t working…
    I setting inside file /etc/default/knxd:
    KNXD_OPTIONS=”–eibaddr=1.1.128 -d -D -T -R -S -i –listen-local=/tmp/knx usb:%DEVICEID%”

    And add file /usr/local/bin/knxd-findusb.sh to get serial address usb which join interface KNX/USB

    Reply

    • Hi bmcor,

      which Version of the script did you use? In 0.76 findusb.sh is no longer necessary, knxd finds an available KNX device. The config line for USB in the latest version of the script in /etc/default/knxd is like:

      # KNXD_OPTIONS=”–eibaddr=$EIB_ADDRESS_KNXD –client-addrs=$EIB_START_ADDRESS_CLIENTS_KNXD:1 -d -D -T -R -S -i –listen-local=/tmp/knx -b usb:”

      Please retry it with the current version of the script.

      Michael

      Reply

  66. Hi Michael,
    I used script with link in your post.
    # Michael Albert
    # 09.06.2016
    # Changes
    # Version: 0.1
    # This is the first release of the try to install knxd
    # Currently state is experimental

    Reply

    • sorry, wrong reply..

      Reply

    • Hi bmcor,

      use the link at the end of the post:

      https://michlstechblog.info/blog/download/electronic/install_knxd_systemd.sh

      Which link did you use? Have you deleted previous versions of the script? Otherwise wget creates files with a suffix .1 and so on and you always call the old version.

      Michael

      Reply

      • Yes, I used this link.
        Now, I installed knxd and started daemon knxd.service:
        1590 ? Ss 0:00 /usr/local/bin/knxd -p /run/knxd/knxd.pid –eibaddr=1.1.128 –client-addrs=1.1.129:1 -d -D -T -R -S -i –listen-local=/tmp/knx -b usb:
        1593 pts/0 S+ 0:00 grep knxd

        Daemon:
        Active: active (running) since Wed 2017-08-16 15:20:11 CEST; 6s ago
        Process: 1588 ExecStart=/usr/local/bin/knxd -p /run/knxd/knxd.pid $KNXD_OPTIONS (code=exited, status=0/SUCCESS)
        Main PID: 1590 (knxd)
        CGroup: /system.slice/knxd.service
        └─1590 /usr/local/bin/knxd -p /run/knxd/knxd.pid –eibaddr=1.1.128 –client-addrs=1.1.129:1 -d -D -T -R -S -i –listen-local=/tmp/knx -b usb:

        But, when i want use knxtool busmonitor1 ip:localhost get fail:
        Open Busmonitor failed: Connection reset by peer

        Reply

        • Hi Michael,
          I installed new image for rapsberry pi 3 and used your script to configuration.
          Now, when I want to run knxd.service I getting error and I can’t to start knxd.service.
          And I don’t now where is problem…
          Content:
          Loaded: loaded (/lib/systemd/system/knxd.service; enabled)
          Active: failed (Result: exit-code) since Thu 2017-08-17 09:53:47 UTC; 10s ago
          Process: 576 ExecStart=/usr/local/bin/knxd -p /run/knxd/knxd.pid $KNXD_OPTIONS (code=exited, status=1/FAILURE)
          Main PID: 441 (code=exited, status=0/SUCCESS)
          Aug 17 09:53:47 raspberrypi knxd[576]: initialisation of backend ‘usb:’ failed: Resource temporarily unavailable
          Aug 17 09:53:47 raspberrypi systemd[1]: knxd.service: control process exited, code=exited status=1
          Aug 17 09:53:47 raspberrypi systemd[1]: Failed to start KNX Daemon.
          Aug 17 09:53:47 raspberrypi systemd[1]: Unit knxd.service entered failed state.

          Reply

          • Hi bmcor,

            is your USB device recognized? Whats the output of command

            sudo lsusb

            respectivily

            dmesg | grep -i usb

            Michael

          • root@raspberrypi:~# sudo lsusb
            Bus 001 Device 006: ID 135e:0024
            Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
            Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
            Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

            root@raspberrypi:~# dmesg | grep -i usb
            [ 0.152192] usbcore: registered new interface driver usbfs
            [ 0.152292] usbcore: registered new interface driver hub
            [ 0.152407] usbcore: registered new device driver usb
            [ 0.314939] usbcore: registered new interface driver smsc95xx
            [ 0.787697] dwc_otg 3f980000.usb: DWC OTG Controller
            [ 0.790014] dwc_otg 3f980000.usb: new USB bus registered, assigned bus number 1
            [ 0.792399] dwc_otg 3f980000.usb: irq 62, io mem 0x00000000
            [ 0.799371] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
            [ 0.801704] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
            [ 0.804012] usb usb1: Product: DWC OTG Controller
            [ 0.806262] usb usb1: Manufacturer: Linux 4.9.43-v7+ dwc_otg_hcd
            [ 0.808532] usb usb1: SerialNumber: 3f980000.usb
            [ 0.811617] hub 1-0:1.0: USB hub found
            [ 0.816796] usbcore: registered new interface driver usb-storage
            [ 0.844876] usbcore: registered new interface driver usbhid
            [ 0.847308] usbhid: USB HID core driver
            [ 1.231209] usb 1-1: new high-speed USB device number 2 using dwc_otg
            [ 1.460745] usb 1-1: New USB device found, idVendor=0424, idProduct=9514
            [ 1.463247] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
            [ 1.466505] hub 1-1:1.0: USB hub found
            [ 1.790510] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
            [ 1.930791] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
            [ 1.933363] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
            [ 2.044219] smsc95xx 1-1.1:1.0 eth0: register ‘smsc95xx’ at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:b2:44:22
            [ 2.140464] usb 1-1.2: new full-speed USB device number 4 using dwc_otg
            [ 2.680510] usb 1-1.2: device not accepting address 4, error -32
            [ 3.020596] usb 1-1.2: new full-speed USB device number 6 using dwc_otg
            [ 3.171293] usb 1-1.2: New USB device found, idVendor=135e, idProduct=0024
            [ 3.171311] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
            [ 3.171319] usb 1-1.2: Product: KNX-USB Data Interface
            [ 3.171326] usb 1-1.2: Manufacturer: Merten GmbH & Co. KG
            [ 3.184121] hid-generic 0003:135E:0024.0001: hiddev0,hidraw0: USB HID v1.01 Device [Merten GmbH & Co. KG KNX-USB Data Interface] on usb-3f980000.usb-1.2/input0

          • I see joined knx-usb interface. When use findknxusb i getted:
            root@raspberrypi:~# findknxusb
            Possible addresses for KNX USB devices:
            device: 1:6:1:0:0 (Merten GmbH & Co. KG:KNX-USB Data Interface)

          • Hi bmcor,

            whats happend when you try to start knxd manually:

            systemctl start knxd.service
            journalctl -xu knxd.service
            knxd –version

            Michael

  67. Hi Michael you made an amazing work !

    When I want to see if packet on the bus it’s said connection refused. I tried manually to launch the usb but doesn’t work too.

    I tried this command systemctl start knxd.service and this is the answer.
    Aug 18 06:50:55 raspberrypi knxd[514]: initialization of the EIBnet/IP server failed: No such device
    Aug 18 06:50:55 raspberrypi systemd[1]: knxd.service: control process exited, code=exited status=1
    Aug 18 06:50:55 raspberrypi systemd[1]: Failed to start KNX Daemon.
    — Subject: Unit knxd.service has failed
    — Defined-By: systemd


    — Unit knxd.service has failed.

    — The result is failed.
    Aug 18 06:50:55 raspberrypi systemd[1]: Unit knxd.service entered failed state.
    Aug 18 06:58:30 raspberrypi systemd[1]: Starting KNX Daemon…
    — Subject: Unit knxd.service has begun with start-up
    — Defined-By: systemd

    I don’t understand the problem. I read the other comments with people who had the same problem and maybe my problem comes to my static IP?

    I wrote this in my dhcpcd.conf :
    nterface eth0
    static ip_address=10.108.146.55/24
    static routers=10.108.146.1
    static domain_name_servers=8.8.8.8 8.8.4.4
    # Route for Multicast Address EIB/KNX
    [Route]
    Destination=224.0.23.12/32

    I follow an other tutorial because when i follow yours after the reboot i lost all the connection ethernet and wifi on my rpi 3.

    Do you have some idea on my issue?
    Regards

    Reply

    • Oh i just re-installed and it’s semi works I have :
      root@raspberrypi:/home/pi# knxtool busmonitor1 ip:localhost
      LPDU: 03 :Unknown LPDU: 03

      But I thinks is my data on the bus which are false and not knxd, right?

      Reply

    • Hi Marc,

      initialization of the EIBnet/IP server failed: No such device => Means no device with a route to the mulicast Address 224.0.23.12 is found. Check with

      route -n

      This is usually a problem if some network interfaces uses dhcp instead of a static ip address. knxd starts before the interface is ready.

      Michael

      Reply

      • Thanks for the fast reply !

        I follow your tutorial to set a static address and now the deamon is running but I lost my internet connection and I don’t know if it’s normal like dhcpcd is disable?

        Reply

        • Now I can see the data on the bus thanks knxtool busmonitor1 ip:localhost. It’s work !
          However I would like to switch on/off the light thanks to the rpi but when i used this commands :
          knxtool on ip:localhost 0/0/1 it’s reply connect failed : connection reset by peer.

          and if I use knxtool groupswrite ip:localhost 0/0/1 1
          Nothing happening in real

          Some idea on the problem?

          Reply

  68. Hi Michael
    Now everything is working, i can manage the bus from OpenHAB but just for a few second. I don’t know why but the knxd connection stop itself after 10/15s and if i reboot it’s working again for few seconds (i can send 2/3 commands and after it’s stop). Some ideas ?

    Regards

    Reply

  69. Hello Michael,
    and Thanks for your work!
    I Use you tutorial and everything work correctly… for 1 min and 30 sec.

    I restart knxd with:
    sudo systemctl restart knxd.service
    and I can work for another 1 minute and 30 seconds then I get the error:

    Job for knxd.service failed. See ‘systemctl status knxd.service’ and ‘journalctl -xn’ for details.

    sudo systemctl status knxd.service
    * knxd.service – KNX Daemon
    Loaded: loaded (/lib/systemd/system/knxd.service; enabled)
    Active: failed (Result: timeout) since lun 2017-08-28 16:14:14 CEST; 3min 26s ago
    Process: 1221 ExecStart=/usr/local/bin/knxd -p /run/knxd/knxd.pid $KNXD_OPTIONS (code=exited, status=0/SUCCESS)

    ago 28 16:14:13 raspberrypi systemd[1]: knxd.service start operation timed out. Terminating.
    ago 28 16:14:14 raspberrypi systemd[1]: Failed to start KNX Daemon.
    ago 28 16:14:14 raspberrypi systemd[1]: Unit knxd.service entered failed state.

    Many thanks if you can help me.

    Bye,
    marco

    Reply

    • Hello Michael,
      I have downloaded the last RASPBIAN STRETCH LITE, and executed the steps of your post to use systemd, then executed the script V0.7.7 on a raspberry zero W.
      I have the same problem of my previous post: when I restart the knxd service, it work for 1 min and 30 sec, then it stop.
      I tryed with an ABB USB/S1.1 interface and with an GWA9705 IP Interface, but in both case, I have the timeout of 1 min and 30 sec.
      Can you give me some ideas to try to solve?
      Many Thanks.

      Reply

      • Hi Marco,

        which options are set in /etc/default/knxd?

        Michael

        Reply

        • Hello Michael,

          When I use the ABB USB/S1.1 interface, I use the option:
          # USB Backend
          KNXD_OPTIONS=”–eibaddr=1.1.128 –client-addrs=1.1.129:1 -d -D -T -R -S -i –listen-local=/tmp/knx -b usb:”

          if I manually execute the i ./usr/local/bin/findknxusb i receive:
          device: 1:2:1:0:0 (ABB STOTZ-KONTAKT GmbH:KNX-USB Interface (MDRC)

          When I use the Gewiss GWA9705 IP Interface, I use the option:
          KNXD_OPTIONS=”–eibaddr=1.1.128 –client-addrs=1.1.129:1 -d -D -T -R -S -i –listen-local=/tmp/knx -b ipt:192.168.1.145″

          Thanks,
          Marco

          Reply

          • Hi Marco,

            try to start knxd with logging at command line. Change to user knxd

            su knxd -s /bin/bash

            and start knxd with logging/tracing

            knxd -t 1023 –eibaddr=1.1.128 –client-addrs=1.1.129:1 -D -T -R -S -i –listen-local=/tmp/knx -t -1023 -b usb:

            Do you see some hints why knxd terminates?
            Michael

          • Hi Marco,

            I’ve investigated and there are some changes since 0.14 regarding process start of knxd. The systemd startup forking does not working anymore. I’ve updated the script to Version 0.7.8.

            Please let me know if this works for you.

            Michael

          • Hello Michael,
            1)
            when I try:
            su knxd -s /bin/bash
            a password for knxd is required: I try with knxd, raspberry, empty, ma no one is correct (whitch is the correct one?)

            2)
            I executed the script V0.7.8, and:
            after the reboot, the service is stopped, but if I execute:
            sudo systemctl restart knxd.service, everything work correctly.

            This is the sudo systemctl status knxd.service immediatly after reboot:

            pi@raspberrypi:~ $ sudo systemctl status knxd.service
            ● knxd.service – KNX Daemon
            Loaded: loaded (/lib/systemd/system/knxd.service; enabled; vendor preset: enabled)
            Active: failed (Result: signal) since Mon 2017-09-18 21:36:04 UTC; 2min 55s ago
            Process: 313 ExecStart=/usr/local/bin/knxd -p /run/knxd/knxd.pid $KNXD_OPTIONS (code=killed, signal=ABRT)
            Main PID: 313 (code=killed, signal=ABRT)

            Sep 18 21:36:03 raspberrypi systemd[1]: Started KNX Daemon.
            Sep 18 21:36:04 raspberrypi knxd[313]: E00000032: [20:router] router: setup router: failed
            Sep 18 21:36:04 raspberrypi knxd[313]: F00000000: [ 4:server] Link down, terminating
            Sep 18 21:36:04 raspberrypi systemd[1]: knxd.service: Main process exited, code=killed, status=6/ABRT
            Sep 18 21:36:04 raspberrypi systemd[1]: knxd.service: Unit entered failed state.
            Sep 18 21:36:04 raspberrypi systemd[1]: knxd.service: Failed with result ‘signal’.
            pi@raspberrypi:~ $

            Thank
            Marco

          • Hi Marco,

            “router: setup router: failed” => As describted in the post. Have you set a static IP Address in particulally the route for the multicast address in your network config?


            [Route]
            Destination=224.0.23.12/32

            When you try to run knxd as router the route for the multicast address is essential.

            “Link down” Or your network interface isn’t ready yet. Back to “Have you set a static IP Address”…. 🙂

            Michael

          • Sossy Michael, but after some minutes of correct working, I get the error:

            pi@raspberrypi:~ $ knxtool off ip:localhost 1/5/201
            Open failed: Connection refused

            And this is the sudo systemctl status knxd.service:

            pi@raspberrypi:~ $ sudo systemctl status knxd.service
            ● knxd.service – KNX Daemon
            Loaded: loaded (/lib/systemd/system/knxd.service; enabled; vendor preset: enabled)
            Active: failed (Result: exit-code) since Mon 2017-09-18 21:52:52 UTC; 21s ago
            Process: 509 ExecStart=/usr/local/bin/knxd -p /run/knxd/knxd.pid $KNXD_OPTIONS (code=exited, status=1/FAILURE)
            Main PID: 509 (code=exited, status=1/FAILURE)

            Sep 18 21:44:13 raspberrypi systemd[1]: Started KNX Daemon.
            Sep 18 21:52:52 raspberrypi knxd[509]: F00000035: [18:C.usb] Send while buffer not empty
            Sep 18 21:52:52 raspberrypi knxd[509]: F00000000: [15:C.usb] Link down, terminating
            Sep 18 21:52:52 raspberrypi knxd[509]: E00000035: [18:C.usb] SendError 20013f0 status 3
            Sep 18 21:52:52 raspberrypi systemd[1]: knxd.service: Main process exited, code=exited, status=1/FAILURE
            Sep 18 21:52:52 raspberrypi systemd[1]: knxd.service: Unit entered failed state.
            Sep 18 21:52:52 raspberrypi systemd[1]: knxd.service: Failed with result ‘exit-code’.
            pi@raspberrypi:~ $

            Bye,
            Marco

          • Hi Marco,

            ” [15:C.usb] Link down” seems to be a problem with your USB Interface. You have written you also have a IP Router. Runs knxd stable when you connect to the ipt: backend instead of the USB device?

            Do see you a USB disconnect message in kernel log/messages at the same time knxd terminates? Type command:

            dmesg

            This is only working if knxd is running:
            pi@raspberrypi:~ $ knxtool off ip:localhost 1/5/201
            Open failed: Connection refused

            On the same host you can also connect to the SOCKET
            knxtool vbusmonitor1 local:/tmp/knx

            Michael

          • Hi Michael,
            with IP interface, I have only problem after reboot.
            After Reboot the knxd is stopped.
            Is I restart with
            sudo systemctl restart knxd.service
            everything work properly (I have tested for 5 or 6 hours without any problems).

            This is the error immediatly after reboot (with KNXD_OPTIONS=”–eibaddr=1.1.128 –client-addrs=1.1.129:8 -d -D -T -R -S -i –listen-local=/tmp/knx -b ipt:192.168.1.145″):

            pi@raspberrypi:~ $ sudo systemctl status knxd.service
            ● knxd.service – KNX Daemon
            Loaded: loaded (/lib/systemd/system/knxd.service; enabled; vendor preset: enabled)
            Active: failed (Result: exit-code) since Tue 2017-09-19 19:42:32 UTC; 2min 30s ago
            Process: 312 ExecStart=/usr/local/bin/knxd -p /run/knxd/knxd.pid $KNXD_OPTIONS (code=exited, status=1/FAILURE)
            Main PID: 312 (code=exited, status=1/FAILURE)

            Sep 19 19:42:31 raspberrypi systemd[1]: Started KNX Daemon.
            Sep 19 19:42:32 raspberrypi knxd[312]: E00000032: [19:router] router: setup router: failed
            Sep 19 19:42:32 raspberrypi systemd[1]: knxd.service: Main process exited, code=exited, status=1/FAILURE
            Sep 19 19:42:32 raspberrypi systemd[1]: knxd.service: Unit entered failed state.
            Sep 19 19:42:32 raspberrypi systemd[1]: knxd.service: Failed with result ‘exit-code’.
            pi@raspberrypi:~ $

            Of couse I have in the /etc/systemd/network/wlan0.network the:
            [Route]
            Destination=224.0.23.12/32

            Bye,
            Marco

          • Hi Marco,

            knxd terminates because the wlan interface isn’t ready. Please edit /lib/systemd/system/knxd.service and change the Unit section:
            [Unit]
            Description=KNX Daemon
            Requires=network-online.target
            After=network.target

            Then reload daemon config

            sudo systemctl daemon-reload

            Michael

          • Hi Michael,
            I add the
            Requires=network-online.target
            in the file /lib/systemd/system/knxd.service, and reloaded the demon,
            but after reboot I alway get the error:

            pi@raspberrypi:~ $ sudo systemctl status knxd.service
            ● knxd.service – KNX Daemon
            Loaded: loaded (/lib/systemd/system/knxd.service; enabled; vendor preset: enabled)
            Active: failed (Result: exit-code) since Wed 2017-09-20 13:13:25 UTC; 49s ago
            Process: 311 ExecStart=/usr/local/bin/knxd -p /run/knxd/knxd.pid $KNXD_OPTIONS (code=exited, status=1/FAILURE)
            Main PID: 311 (code=exited, status=1/FAILURE)

            Sep 20 13:13:24 raspberrypi systemd[1]: Started KNX Daemon.
            Sep 20 13:13:25 raspberrypi knxd[311]: E00000032: [19:router] router: setup router: failed
            Sep 20 13:13:25 raspberrypi systemd[1]: knxd.service: Main process exited, code=exited, status=1/FAILURE
            Sep 20 13:13:25 raspberrypi systemd[1]: knxd.service: Unit entered failed state.
            Sep 20 13:13:25 raspberrypi systemd[1]: knxd.service: Failed with result ‘exit-code’.
            pi@raspberrypi:~ $

            The system work correctly if I start the knxd manually with
            sudo systemctl start knxd.service

            Bye,
            Marco

          • Hi Marco,

            ok, it seems wlan0 is still not ready. Make the following changes:

            Enable the systemd network wait online service
            systemctl enable systemd-networkd-wait-online.service

            Then edit the file /lib/systemd/system/knxd.service
            Insert the ExecStartPre right before ExecStart line, replace wlan0 with your interface name. Something like this:

            [Unit]
            Description=KNX Daemon
            Requires=network-online.target
            After=network.target

            [Service]
            EnvironmentFile=/etc/default/knxd
            ExecStartPre=/lib/systemd/systemd-networkd-wait-online --interface=wlan0 --timeout=60
            ExecStart=/usr/local/bin/knxd -p /run/knxd/knxd.pid $KNXD_OPTIONS
            Type=simple
            PIDFile=/run/knxd/knxd.pid
            User=knxd
            Group=knxd

            [Install]
            WantedBy=multi-user.target

            and reload config
            systemctl daemon-reload
            Michael

          • Hi Michael,
            many tanks for you exemplary support.
            Now everything work!

            Instead of
            ExecStartPre=/lib/systemd/systemd-networkd-wait-online –interface=wlan0 –timeout=60
            I used
            ExecStartPre=/bin/sleep 10
            because the systemd-networkd-wait-online give me some errors…

            Thanks a lot.
            Bye
            Marco

  70. Hello Michael,

    thanks a lot for that great script.

    I tried to run your script (Version 0.7.6 19.02.2017) on a Raspberry 3 running Raspbian Stretch with Desktop (Release date: 2017-09-07, Kernel version: 4.9) and it terminated with following error:

    Paket libsystemd-daemon-dev ist nicht verfügbar, wird aber von einem anderen Paket
    referenziert. Das kann heißen, dass das Paket fehlt, dass es abgelöst
    wurde oder nur aus einer anderen Quelle verfügbar ist.
    Doch die folgenden Pakete ersetzen es:
    libsystemd-dev

    E: Für Paket »libsystemd-daemon-dev« existiert kein Installationskandidat.
    E: Paket libsystemd-daemon0 kann nicht gefunden werden.

    What am I doing wrong?

    Thanks in advance,
    Andre

    Reply

    • Hi Andre,

      may be there are some changes in Debian 9 which makes changes to the script necessary. I will have a look at Stretch this week.

      Michael

      Reply

  71. Hi Michael,

    thanks for your extremely quick first feedback!

    A year ago I used your ‘old’ script for EIBD on my RPI B+ and this installation works absolute fine up to now.
    Now I have to upgrade to RPI 3 and spent hours to get KNXD running but without success – hope you will find what’s wrong.

    Thanks for your efforts,
    Andre

    Reply

    • Hi Andre,

      I’ve already updated the script with the adjustments for Stretch in July, but forgotten to upload 🙁

      Version is 0.7.7 now.

      Let me know if it works.

      Michael

      Reply

      • Hi Michael,

        YES, V0.7.7 of your script now executes without errors – excellent!

        Thank You very much for your great support,
        Andre

        Reply

  72. Hi Michael,

    Many Thanks for your effort.
    I really don’t want to bother you. But I’m struggling with the set up for my USB knxd for days.

    Using:
    KNXD_OPTIONS=”–eibaddr=1.1.128 -d -D -T -R -S -i –listen-local=/tmp/knx -b usb:1:4:1:0:0″
    I’m always getting:

    pi@raspberrypi:/usr/local/bin $ sudo systemctl status knxd.service
    ● knxd.service – KNX Daemon
    Loaded: loaded (/lib/systemd/system/knxd.service; enabled)
    Active: failed (Result: exit-code) since Di 2017-09-19 08:43:17 CEST; 7s ago
    Process: 5035 ExecStart=/usr/local/bin/knxd -p /run/knxd/knxd.pid $KNXD_OPTIONS (code=exited, status=2)

    Sep 19 08:43:17 raspberrypi knxd[5035]: Too many arguments for usb!
    Sep 19 08:43:17 raspberrypi knxd[5035]: E00000055: [ 1:main] There is no KNX addr= in section ‘main’.
    Sep 19 08:43:17 raspberrypi knxd[5035]: F00000000: [ 1:main] Error setting up the KNX router.
    Sep 19 08:43:17 raspberrypi systemd[1]: knxd.service: control process exited, code=exited status=2
    Sep 19 08:43:17 raspberrypi systemd[1]: Failed to start KNX Daemon.
    Sep 19 08:43:17 raspberrypi systemd[1]: Unit knxd.service entered failed state.

    I tried different combinations for KNXD options. But I don’t understand what “Too many arguments for usb” is about.

    Any help will be appreciated.

    Best regards
    Dirk

    Reply

    • Hi Dirk,

      which version of knxd have you running? Check with

      knxd –version

      Newer Versions, imo >0.12, does not need a device address as argument of usb:

      Simply define

      KNXD_OPTIONS=”–eibaddr=1.1.128 -d -D -T -R -S -i –listen-local=/tmp/knx -b usb:″

      and knxd is looking for a appropriated device.

      Michael

      Reply

      • Thanks Michael,

        I’m using
        pi@raspberrypi:/usr/local/bin $ knxd –version
        knxd 0.14.18:ef3c496
        Usage: knxd configfile [main_section]

        But when I leave the usb address empty I’m getting a timed out error:
        pi@raspberrypi:/usr/local/bin $ sudo systemctl status knxd.service
        ● knxd.service – KNX Daemon
        Loaded: loaded (/lib/systemd/system/knxd.service; enabled)
        Active: failed (Result: timeout) since Di 2017-09-19 09:35:17 CEST; 10s ago
        Process: 5394 ExecStart=/usr/local/bin/knxd -p /run/knxd/knxd.pid $KNXD_OPTIONS (code=exited, status=0/SUCCESS)

        Sep 19 09:35:17 raspberrypi systemd[1]: knxd.service start operation timed out. Terminating.
        Sep 19 09:35:17 raspberrypi systemd[1]: Failed to start KNX Daemon.
        Sep 19 09:35:17 raspberrypi systemd[1]: Unit knxd.service entered failed state.

        But findknxusb is working fine:
        pi@raspberrypi:/usr/local/bin $ findknxusb
        Possible addresses for KNX USB devices:
        device: 1:4:1:0:0 (Gira Giersiepen GmbH & Co. KG:KNX-USB Data Interface)

        Dirk

        Reply

        • Hi Dirk,

          “knxd.service start operation timed out. Terminating.” Due to a change in process start since Version 0.14 the systemd type in /lib/systemd/system/knxd.service has to altered:

          from
          Type=forking

          to
          Type=simple

          then reload config

          systemctl daemon-reload
          systemctl start knxd

          Also your option line in /etc/default/knxd must have –client-addrs parameter:
          KNXD_OPTIONS=”–eibaddr=1.1.128 –client-addrs=1.1.129:8 -d -D -T -R -S -i –listen-local=/tmp/knx -b tpuarts:/dev/ttyAMA0″

          Michael

          Reply

          • Hi Michael,
            Yes, changing the Type from forking to simple was doing it.
            Awesome. Thank you so much.

            Dirk

  73. Hi,
    So i tried your Script again, this time like you recommended the knxd instead of the eibd, and this time I managed to kill my Network connection somehow. I was initially connected to my Raspberry Pi using VNC before. After a lot of mesing around I managed to get a Static I.P. set up and VNC running.
    SO since I was worried about losing this connection I decided to follow all your steps that came after the Network Setup, and decided to do the network setup at the end, once i have everything installed. Everything worked out fine it seems, only when I did do the Network setup, something seemed to go wrong.
    I created a file exactly like you said, only using my I.P. Settings::

    [Match]
    # You can also use wildcards. Maybe you want enable dhcp
    # an all eth* NICs
    Name=eth0
    [Network]
    #DHCP=v4
    # static IP
    # 192.168.100.2 netmask 255.255.255.0
    Address=192.168.0.222/24
    Gateway=192.168.0.1
    DNS=192.168.0.1
    # Route for Multicast Address EIB/KNX
    [Route]
    Destination=224.0.23.12/32

    Then I followed the steps::

    1root@raspberry:~# mv /etc/network/interfaces /etc/network/interfaces.save
    2root@raspberry:~# systemctl enable systemd-networkd.service
    3root@raspberry:~# systemctl enable systemd-resolved.service
    4root@raspberry:~# systemctl start systemd-resolved.service
    5root@raspberry:~# systemctl disable dhcpcd.service

    Set an link from the system wide resolve.conf to systemd
    1root@raspberry:~# mv /etc/resolv.conf /etc/resolv.conf.save
    2root@raspberry:~# ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

    Reboot to get the config active
    1root@raspberry:~# reboot

    Now I cant connect over VNC anymore, so I hooked up a Monitor and Keyboard/Mouse.
    At the top of the screen, when I MouseOver the Network symbol it says::
    “dhcpcd lost” which it should say since we want a static I.P. but I have no Internet Connection at all. When I right-click and click “Wireless&Wired Network Settings” nothing happens at all. When I left-click on the Network Symbol it says::
    “No wireless interfaces found”
    I assume he is trying to connect over wireless even though I dont have Wireless, but I cant get into the Settings anymore to make any changes either, and since I have very little knowledge regarding Raspberry Pi I wouldnt know what to edit or do to fix the problem.
    Any ideas on what went wrong or how to fix the problem?
    Thanks for your help and time!

    Reply

    • Hi Holo,

      you should use a terminal 🙂 to determine your IP Address. Open a terminal

      ifconfig

      shows your IP Address. Then test the connection from your PC

      ping IPAddressDeterminedFromRaspberry

      Whats the IP Address of your PC?

      Michael

      Reply

      • Thanks for th help!
        I used the terminal and the command “ifconfig” and I got::
        lo: flags =73 mtu 65536
        inet 127.0.0.1 netmask 255.0.0.0
        inet6 ::1 prefixlen 128 scopeid 0x10
        loop txqueuelen 1 (Local Loopback)
        RX packets 13 bytes 772 (772.0 B)
        RX errors 0 dropped 0 overruns 0 frame 0
        TX packets 13 bytes 772 (772.0 B)
        TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

        Thats why the Ethernet connection isnt working i presume, if my I.P adress is:: 127.0.0.1
        and subnet: 255.0.0.0
        then im in the wrong address area, but in the File I had created I have::
        [Match]
        name=eth0
        [Network]
        #DHCP=v4
        # static IP
        # 192.168.100.2 netmask 255.255.255.0
        Address=192.168.0.222/24
        Gateway=192.168.0.1
        DNS=192.168.0.1
        # Route for Multicast Address EIB/KNX
        [Route]
        Destination=224.0.23.12/32

        With this IP it should work fine

        On my Laptop I got:: 192.168.0.162
        Setting up VNC shouldn’t be a problem, once the Network Connection on the Pi is working again properly.

        Reply

        • Hi Holo,

          your IP Address isn’t set properly. 127.0.0.1 is the loopback address which is available on all systems.

          Is the network interface recognized by the kernel:

          dmesg|grep eth

          Is the networking.service started?

          sudo systemctl status networking.service

          Try to bring up the interface manually
          sudo ifconfig eth0 up
          sudo ifconfig eth0 192.168.0.222 netmask 255.255.255.0

          and check from your PC if it is available
          ping 192.168.0.222

          Michael

          Reply

          • Hi,
            So i am moving along slowly, but surely. Well I clearly had F*!$ed something up with my Network settings and kept getting errors. I just did a complete clean swipe of everything and started from step 1: Installing Raspbian fresh and updating everything.
            I completed all your steps now, and in my task bar it shows me that I am not connected to the Internet, but I clearly am, and I managed to Ping my I.P. successfully from my Laptop. So I don’t really care what it shows me since I clearly have a connection, and a fixed I.P. or I wouldnt be writing you now.
            I commented out the TPUART line and commented in the USB line. and I can find my USB Device using “findknxusb”
            I just haven’t figured out how to connect to it or send anything over it yet via USB. I didn’t figure out how to activate the busmonitor, since the command “knxtool busmonitor1” expects “local:” or “ip:” and I dont know what to write. If you could maybe help me along that would be great! I’m already happy to have gotten this far finally, since it seems like everything is working fine, other than me being to dumb to use it properly 🙂
            Thanks a lot for your help so far.

          • Hi Holo,

            I do not use a Desktop Environment, imo the task bar in any GUI needs the NetworkManager running in background, but we have configured the network manually. So do not trust the GUI in this case 🙂 ping is always your friend to check network connectivity 🙂

            To connect via knxtool you can use the socket

            knxtool vbusmonitor1 local:/tmp/knx

            or the localhost (127.0.0.1)

            knxtool vbusmonitor1 ip:localhost

            Michael

          • Hi,
            I tried that now, but when I run ” knxtool vbusmonitor1 local:/tmp/knx”, then I get :”Open failed: No such file or directory”. When I run “knxtool vbusmonitor1 ip:localhost”/”knxtool vbusmonitor1 ip:127.0.0.1” then I get : “Open failed: Connection refused”
            When using “busmonitor1” instead of “vbusmonitor1” i get the same result.
            I tried running “sudo systemctl start knxd” to make sure its running but I dont get feedback.
            when I run “findknxusb”, I get : “device: 1:7:1:0:0 (Siemens:N 148/12 KNX Interface)”.
            Dont have a I.P. Interface, only a USB Interface.
            At one part you wrote:
            After installing you have to decide which interfaces you want to use(Default TPUARTS at /dev/ttyAMA0). With this configuration knxd must come up after a reboot because knxd could check if a TPUART module is present.
            When I run “ps ax|grep knxd” I get: “3001 pts/0 S+ 0:00 grep knxd”

            I am using a Pi 2 Model B v1.1 is that a problem?
            Feeling kind of lost now.

          • Hi Holo

            ”Open failed: No such file or directory”. When I run “knxtool vbusmonitor1 ip:localhost”/”knxtool vbusmonitor1 ip:127.0.0.1” then I get : “Open failed: Connection refused” => Your knxd isn’t running.

            Check systemd and its journal about the knxd state:

            sudo systemctl status knxd.service
            sudo journalctl -xu knxd.service

            What’s the content of your config file:

            cat /etc/default/knxd

            Michael

Time limit is exhausted. Please reload CAPTCHA.

Original Theme by Schiy · Powered by WordPress