Howto control your KNX installation using open source software

I'm using the following setup:

eibd daemon

First install the eibd daemon. This daemon let you communicate with the actuators (lamps, dimmers, plugs, etc) on the KNX network from your IP network. If you are using a debian based distribution you may install it with:

sudo apt-get install eibd-server eibd-clients

(See here how to build from source on raspberry pi) Or you can get the code from: http://www.auto.tuwien.ac.at/~mkoegler/index.php/eibd

The actuators are sending multicast messages on the registered multicast address 224.0.23.12, therefore you need to do:

sudo route add 224.0.23.12 dev eth0 (Assuming you are using the eth0 interface for your home network)

Next start the eibd daemon. In my case the KNX/IP router have IP number 192.168.10.10:

sudo eibd -D -S -T -i --eibaddr=0.0.1 --daemon=/var/log/eibd.log --no-tunnel-client-queuing ipt:192.168.10.10

You can omit the (--eibaddr=0.0.1) that argument will only set the origin address to 0.0.1, if you skip the argument, the origin address will be 0.0.0 (Only interesting for logging purposes)

If you want more (maximum?) debug in your log-file, then add the argument -t1023

The eibd daemon will listen on port 6720 (all ip-numbers, 0.0.0.0:6720)

If you have installed the eibd-clients packade (or from source code) you have the command groupsocketlisten. This command can be used to snoop the knx network, try for example:

groupsocketlisten ip:127.0.0.1

This will give output of the form:

Write from 1.1.24 to 0/3/8: 00
Write from 1.1.20 to 0/3/4: 00
Write from 1.1.22 to 0/3/6: 00
Write from 1.1.23 to 0/3/7: 00
Write from 1.1.2 to 0/1/0: 01 3E 
Write from 1.1.24 to 0/3/8: 00
Write from 1.1.21 to 0/3/5: 00
Write from 1.1.17 to 0/3/1: 00
Write from 1.1.14 to 0/1/1: 60 29 00 
Write from 0.0.1 to 0/1/5: 00
Write from 1.1.12 to 0/1/7: 00
Write from 0.0.1 to 0/1/6: 09
Write from 0.0.1 to 0/1/6: 00
Write from 1.1.12 to 0/1/7: 01
If you record all light switches for a few days you can replay that data later on (if you are away from your house) with the following shellscript (You have to have a actor sending out the time on regular basis in order for this to work)

groupsocketlisten might also be used to find out which group address for example a light have. Just press the light switch and check the log. Group addresses are of the form x/y/z.

linknx

linknx cashes the states of all configured group addresses, it also provides an xml-api to read/write to the group addresses. The project is found here:

http://linknx.sourceforge.net/

The download page for the projects (knxweb is also downloaded here):

http://sourceforge.net/projects/linknx/files/

Latest source code (CVS):

http://sourceforge.net/scm/?type=cvs&group_id=207555

When you start linknx it reads a configuration file (XML). A description of this configuration file is found here: https://sourceforge.net/apps/mediawiki/linknx/index.php?title=Configuration

Here you define the group addresses for your entire knx installation, it's done in the <objects>-section of the configuration file This is how my linknx configuration file looks like.

Note that dimmers use three group addresses one of type "1.001" (1 bit), that's the on/off switch. One of type "3.007" (4 bits) for setting the dimming value (up/down/stop). and one of type "5.xxx" (1 byte) for indication if the light is on or off. (try to set the ind to 1.001 instead)

In my setup I have a object called "master_switch" that I have assigned the group address "0/1/170" in linknx.xml when that object is turned off I have made a rule ("lights_master_off") that turns off the light in the entire building. In order to use this rule from an ordinary light switch (wall mounted) I had to do the following in the ETS3 program:

Other rules defined in the linknx configuration file above:

Start linknx with:

/path/to/linknx --config=/path/to/linknx.xml

knxweb

I'm using the first version of knxweb (not knxweb2, but I'm currently switching to knxweb2), available at sourceforge in the linknx project. You just unzip the knxweb source in your document root (or in a subfolder) of your web server, in my case apache.

If the files are owned by the right user (www-data) you can just drag'n'drop light switches, dimmers, etc and connect them with the corresponding group id's (referenced by the names given in linknx.xml) When you are ready, just save the model.

The model is saved in the file: /design/default/design.xml A snapshot of the my file looks like this.

Summary

Fun!

Please contact me if you have any questions/suggestions

regards: Johan Ekblad <jka@ekblad.org>