Guide to setup KNXD with Busware ROT on Raspberry 3B as KNX IP Gateway

Hi OpenHAB friends,

In this tutorial I wand to give you a step by step guide for installing KNXD in combination with a Raspberry 3 and the Busware One Wire & KNX header called “ROT”

I’m a Linux beginner and the most gides were not easy enough for me.
To avoid, that you need as much time and nerves as me…let’s go

The main goal of this tutorial is building a cheap and less space using KNX IP Gateway. Of course another goal is to connect your KNX System to openhab.

1. Genral conditions:

Hardware:

Software:

  • openHABian image v.2.4.0
  • KNXD master Branch v.0.14

2. Update System

sudo openhabian-config

choose "02 Upgrade System"

3. Install ROT Module

  • Install Hardware
  • Prepare Serial Interface

Disable the Bluetooth Modul of the Pi which is using the Serial interface you will need

sudo nano /boot/config.txt

add this at the end of the file

dtoverlay=pi3-disable-bt

save with ctrl+o and close with ctrl+x


sudo nano /boot/cmdline.txt

delete the following arguments

console=serial0,115200 console=tty1

save with ctrl+o and close with ctrl+x


disconnect the BT modem from the UART

sudo systemctl disable hciuart


Create the specific KNX Serial interface

First collect two parameters of the interface, we query them with:

sudo udevadm info -a /dev/ttyAMA0 | grep KERNELS.*serial

It is supposed to answer something like KERNELS=="3f201000.serial"

sudo udevadm info -a /dev/ttyAMA0 | grep {id}

The answer is most likely ATTRS{id}=="00241011"

Keep these two results in a handy place, you’ll need them in the next step: Edit the udev file for the knx interface:

sudo nano /etc/udev/rules.d/70-knxd.rules

The file contains of just one line. Insert the following line with your(!) results of KERNEL request and ATTRS ID
That line look like

ACTION=="add", SUBSYSTEM=="tty", ATTRS{id}=="00241011", KERNELS=="3f201000.serial", SYMLINK+="ttyKNX1", OWNER="knxd"

Reboot the System

sudo reboot


Test the interface

ls -ahl /dev/ttyKNX1

Answer: lrwxrwxrwx 1 root root 7 Feb 1 14:20 /dev/ttyKNX1 -> ttyAMA0

ls -ahl /dev/ttyAMA0

Answer: crw-rw---- 1 knxd dialout 204, 64 Feb 1 23:42 /dev/ttyAMA0

4. Install KNXD

first, install build tools and dependencies

sudo apt-get install git-core build-essential

now get the source code

git clone https://github.com/knxd/knxd.git

now build+install knxd

cd knxd
git checkout master
dpkg-buildpackage -b -uc

if this step fails (it will probably) because of missing dependencies,

“Unmet build dependencies”: data1 (>123) data2 (>123) data3 (>123) …

cd…
sudo apt-get install data1
sudo apt-get install data2
sudo apt-get install data3

and try that step again


Install KNX Tools

cd …
sudo dpkg -i knxd_.deb knxd-tools_.deb


reboot system

sudo reboot


4.1 Set the KNXD_OPTS

sudo nano /etc/knxd.conf

Add a # to the existing line and add the line below

# configuration for knxd.service
# KNXD_OPTS="-e 0.0.1 -E 0.0.2:8 -u /tmp/eib -b ip:"
KNXD_OPTS="-e 1.1.0 -E 1.1.100:28 -D -T -R -S -b tpuarts:/dev/ttyKNX1"

you can set several more options please look knxd --help and check the github

5. Status & Start Stop of KNXD

Status:

systemctl status knxd.socket && systemctl status knxd.service

Answer should be:
(The Dots before knxd.socket and knxd.service must be green)

[10:33:10] openhabian@openHABianPi:~$ systemctl status knxd.socket && systemctl status knxd.service
● knxd.socket - KNX Daemon (socket)
   Loaded: loaded (/lib/systemd/system/knxd.socket; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2019-02-02 23:25:47 CET; 3 days ago
   Listen: /var/run/knx (Stream)
           [::]:6720 (Stream)

Feb 02 23:25:47 openHABianPi systemd[1]: Listening on KNX Daemon (socket).
● knxd.service - KNX Daemon
   Loaded: loaded (/lib/systemd/system/knxd.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2019-02-04 11:21:29 CET; 1 day 23h ago
 Main PID: 26315 (knxd)
   CGroup: /system.slice/knxd.service
           └─26315 /usr/bin/knxd -e 1.1.0 -E 1.1.100:28 -D -T -R -S -b tpuarts:/dev/ttyKNX1

Feb 04 11:21:29 openHABianPi systemd[1]: Starting KNX Daemon...
Feb 04 11:21:29 openHABianPi systemd[1]: Started KNX Daemon.

Start:

sudo systemctl start knxd.socket && sudo systemctl start knxd.service

Stop:

sudo systemctl stop knxd.service && sudo systemctl stop knxd.socket


6. Try it out

Now you should have a working KNX ETS5 Gateway and you can program your KNX System via your Raspberry


6.1 Test KNXD

Open the KNXD Busmonitor and watch what is happening when you send commands (by hardware) on the Bus

knxtool groupsocketlisten ip:localhost

you can close monitoring with ctrl+c


Now test if you can write something to the Bus

knxtool groupswrite ip:localhost 1/2/4 1

in this case 1/2/4 is the group Adress of ETS Sofware
and the last “1” set’s “on” ; “0” set’s “off”

7. Setup OpenHAB Gateway to KNXD

Install KNX Binding using Paper UI


You have two ways creating Devices and Items

  1. Using Paper UI
  2. Using the Text Editor Configunration

I would recomment 2. because of a better overview and better backup options.
In this Guide I show you only option 2

  1. Create a Items file in the Items folder named for example knx.items
  • Here my path of Windows Samba share: \\OPENHABIANPI\openHAB-conf\items
  1. Insert the Gateway configuration

    Bridge knx:ip:bridge “KNXD Gateway” [
    ipAddress=“192.168.1.101”, // Use LAN IP of your Raspberry Pi
    portNumber=3671,
    localIp=“192.168.1.101”, // Use LAN IP of your Raspberry Pi
    type=“TUNNEL”,
    readingPause=50,
    responseTimeout=10,
    readRetriesLimit=3,
    autoReconnectPeriod=1,
    localSourceAddr=“0.0.0”
    ]

8. Thanks to

Tutorial build together from several guides. Thanks to:

https://www.meintechblog.de/2018/07/tul-stick-als-knx-ip-gateway-auf-dem-raspberry-pi-einrichten-mit-knxd/

https://sarwiki.informatik.hu-berlin.de/KNXD_Tutorial

4 Likes

thank you very much for you tutorial. i had trouble installing knxd with tpuart in the past. starting from scratch with your tutorial works perfectly fine!

Hi, thanks for your feedback, nice to hear that it is helpful. I had also much struggle with installation till it become working.

@mcarco
Hi, Mark, I installed KNXd
on Openhabian version 1.5 on Rsp3. I have downloaded the addon from openhabian-config.
How do I know if the daemon is active?
Before buying a knx sensor, I wanted to make sure the gateway works

Hi Roberto, a final result of your working setup you will get when you are able to program your knx devices. The first indicator that you have a working setup is typing that “status” command described in Point 5 of the tutorial. Installing knxd from openhabian-config in was not working “out of the box” in my case. But you can use my tutorial, too after the automatic installation.

Hi,

Many thanks for tutorial. I have a question. Is it possible to use the new Busware M5 KNX Modul (http://shop.busware.de/product_info.php/cPath/1_34/products_id/127) instead Busware ROT a RTC-OneWire-TPUART (EIB/KNX)?

Kind Regards,
Krzysztof

Hi Krzysztof,
this should be no problem. It is communicating with TPUART (like ROT) and so I think it would work. That time I bought the KNX Rot this module was not developed. An advantage of the ROT is, that you can connect it directly to the Raspberry. For that M5 Stack module you will need an adapter or Cable. Please keep this thread updated, when you have results.

Best regards,
Marco

Hi Marco,

Thanks for your confirmation. I’ll will be back if I do.

Kind Regards,
Krzysztof|

Hi,

I have also also an busware pigator KNX module. This one is connected to the busware CCD2 mainboard which is using ttyAMA0 for the CC1101 transceiver for the homematic bidcos connection. I bought now the in the beginning stated pigator module and connected this one to the CCD2 Pigator expansion slot. The problem, there is no new serial port (for exmaple ttyAMA1) initialized in the /dev/ folder. Do you have an description how to use the Pigator KNX module together with the busware CCD2 instead the ROT? The company busware is not giving a good support and stated to ask the community so I hope to get help from the community.

Thanks René