Control KNX via HomeKit

Almost every smart technology comes with some kind of (mobile) application. Although KNX is already over 30 years old, there is no official app to control your system. Moreover, the KNX association talks about IoT and integration, but I couldn’t find real content, especially about the just-released Matter standard. There are many vendors selling visualizations and mobile apps though. Since I’ve already been using Apple’s HomeKit and Home app for quite some time now, I want to integrate KNX into HomeKit. In this post, I want to show you some possibilities, ranging from 0€ to ~1000€.

Disclaimer

This post is not a tutorial. Since my KNX system ist just a simple test board, all the integration attempts will be nothing but MVP. Therfore, I’m not going to spend any money. Instead, I’ll discuss the products I’d have to buy in theory. Most of the tutorials on the web are outdated anyway. I just want to give a direction which solution is working and how well it went. I neither advertise any product, nor do I guarantee any of the solutions to work in larger scale or your environment. For the paid products, I relied on YouTube videos. If they sound promising to you, check them out and support the vendors! When my house is finished, I’ll (hopefully 😅) update this or write another post with real-world hardware.

homebridge + homebridge-knx (0€)

homebridge-knx promises direct communication between homebridge and KNX. I couldn’t get this plugin working. It asks for knxd and I hoped I could just provide any IP interface. This does not work.

➖ Last commit from Feb. 2021, issues/PRs remain unanswered

➖ not verified by homebridge

homebridge + homebridge-syntex-knx (0€)

homebridge-syntex-knx is another direct KNX integration for homebridge. It looks like this is part of a whole plugin family, but I didn’t dig into it. I added a simple switch to my switching actuator. There is a small delay in switching/updating status, but the plugin works.

➕ direct connection between homebridge and knx

➕ text based configuration (for easy backup/restore)

➖ most commits are just version bumping, so no real activity in the last months

➖ not verified by homebridge

➖ not approved by Apple (shows warning when adding as bridge)

➖ Manual configuration and room association for every device

homebridge + homebridge-mqttthing + knx-mqtt-bridge (0€)

Instead of connecting homebridge directly to KNX, you can use any supported intermediate service. MQTT is one of (if not THE) most used system for inter-device communication. It’s fast, leightweight and really easy to setup. Most of smart home systems (and also commercial products) come with MQTT support. For my test, I used knx-mqtt-bridge, because it comes with a Dockerfile. Homebridge talks to MQTT using homebridge-mqttthing.

The Dockerfile from the repository did not work for me, so I had to fix it (put your config.yaml and knx.xml in the same directory as the cloned repository):

FROM node
ADD ./ /config
WORKDIR /config
RUN npm install
CMD npm run start

And the mqttthing-accessory:

{
    "type": "switch"
    "name": "My fancy switch",
    "url": "mqtt://192.168.1.123:1883",
    "topics": {
        "getOn": "knx/1/2/3$.value",
        "setOn": "knx/1/2/4/write"
    },
    "onValue": "true",
    "offValue": "false",
    "accessory": "mqttthing"
}

Another (working!) solution to control a switch via HomeKit.

➕ MQTT can be accessed from different services instead of keeping up KNX connections from everywhere

➕ text based configuration (for easy backup/restore)

➕ knx-mqtt-bridge debug output can be helpful

➕ verified by homebridge

➕ Using MQTT’s retain feature can „replace“ read requests

➖ not working out-of-the-box

➖ outdated dependencies

➖ understanding mqttthing configuration files is hard 😫

➖ not approved by Apple (shows warning when adding as bridge)

➖ Manual configuration and room association for every device

openHAB + KNX binding + HomeKit Add-On (0€)

openHAB contains an add-on for interaction with HomeKit. It allows lots of configuration, but should work with the default values. There is a limitation in HomeKit, which for some reason only occured via openHAB (compared to the other solutions on this page). Room associations are stored within HomeKit and not privided by any bridges. If the bridge is not initialized correctly, ALL devices will be moved back to your default room… I won’t go into detail on how to (hopefully) avoid this.

This thing configuration:

Thing device KNX-1-1-1 "Some actor (1.1.1)" {
    Type switch : ChannelA "My fancy channel" [ ga="1/2/4+<1/2/3" ]
}

combined with this items configuration:

Switch demoSwitch "My fancy switch" <poweroutlet> { homekit="Outlet, Outlet.OnState", channel="knx:device:bridge:KNX-1-1-1:ChannelA" }

worked for me – my KNX channel was available via HomeKit through openHAB.

➕ works with my already existing openHAB environment

➕ not limited to KNX

➕ very active communtiy and regular releases

➕ text based configuration (for easy backup/restore)

➖ not as trivial as expected (the documentation is very detailled, yet leaving several questions unanswered)

➖ not approved by Apple (shows warning when adding as bridge)

➖ Manual configuration and room association for every device

node-red + node-red-contrib-knx + node-red-contrib-homekit-bridged (0€)

node-red is a rule engine for visual event flows. Until now, I just did a few tests with it. For some reason, there’s also a HomeKit integration. I can’t tell you how you could combine rules between KNX and HomeKit, but it’s possible to just link KNX and HomeKit – at least in theory. Some weeks ago I already tried this, now it’s not working anymore. Probably because I upgrade to Mac OS 13.

➖ Last commit in October 2021

➖ Feels like a big misuse of node-red 😅

➖ not approved by Apple (shows warning when adding as bridge)

➖ Manual configuration and room association for every device

hkknx (299€)

hkknx is a single developer library. It can run on a raspberry pi, so no additional hardware required. It’s self explaining and works like a charm. I did not test the companion app, which allows to auto-configure the room associations of the devices. I started hkknx through Docker with this Dockerfile:

FROM alpine:latest
RUN addgroup -S hkknx
RUN adduser --disabled-password --ingroup hkknx hkknx
RUN apk --no-cache add curl wget jq
RUN wget -O hkknx.tar.gz "$(curl -s https://api.github.com/repos/brutella/hkknx-public/releases/latest | jq -r '.assets[].browser_download_url' | grep linux_arm6>
RUN tar -xf hkknx.tar.gz -C /usr/local/bin/
ENV DB /db
ENV PORT 8080
VOLUME ${DB}
RUN chown -R hkknx:hkknx ${DB}
USER hkknx
ENTRYPOINT hkknx -db ${DB} -port ${PORT}

➕ really easy to understand and works within minutes

➕ Is based on KNX project import

➕ comes with a nice group address monitor

➕ integrated backup/restore feature (although I did not test this)

➖ Manual configuration and room association for every device (in the web GUI)

➖ not approved by Apple (shows warning when adding as bridge)

→ Demo mode (aka no license purchased) allows to control a maximum of 15 devices, all other features works in this version, too.

Easykon (730€)

Easykon is a commercial KNX to HomeKit bridge. My interpretation from the webpage and this YouTube video:

➕ approved by Apple (no warnings when adding as bridge)

➕ easy-to-understand, decent web GUI

➕ Can be used as KNX IP gateway

➕ also supports Amazon Alexa and Google Assistant

➖ lots of lots of clicking and typing (at least in the video, could be different today)

➖ manual configuration and room association for every device

➖ seperate device, requires additional power source

➖ not sure how to backup configuration

→ Easykon offers a lite version (~84€) that you can run on your own device, but it’s limited to 30 devices.

Thinka (850€)

Thinka is another commercial KNX to HomeKit bridge. My interpretation from the webpage and this YouTube video:

➕ Approved by Apple (no warnings when adding as bridge)

➕ (Kind of) auto association between KNX group addresses and devices

➕ No manual configratuon of device-to-room assocation (is written from Thinka to Home)

➕ Can be used as KNX IP gateway

➕ also supports Amazon Alexa and Google Assistant

➖ seperate device, requires additional power source

➖ Not the „coolest“ web GUI

➖ Not sure how to backup configuration

1Home Bridge (950€)

1Home is yet another commercial KNX to HomeKit bridge. My interpretation from the webpage and this YouTube video:

➕ Approved by Apple (no warnings when adding as bridge)

➕ auto association between KNX group addresses and devices

➕ No manual configratuon of device-to-room assocation (is written from 1Home to Home)

➕ Can be used as KNX IP gateway

➕ can be powered via PoE

➕ also supports Amazon Alexa and Google Assistant

➖ seperate device, requires additional power sourcew

➖ Not sure how to backup configuration

Conclusion

Wow! So many possibilities to control your KNX system through HomeKit. As always, you either invest time or money. What I’ve learned/recommend:

„I don’t want to spend additional money and don’t mind writing config files“: homebridge is great software, I’ve already been using it for years without problems. Nevertheless, I can’t really recommend the plugins for direct communication between KNX and homebridge. The „detour“ through MQTT works reliable, can replace read commands and allows other (smart home) systems to read/write KNX data through KNX. You can (and should, this tool is great) use bus monitor from hkknx for debugging purposes.

„I prefer (guided) graphical configuration over text files and don’t want another device in my network“: use hkknx. The configuration process is fair and it can run on almost any hardware (I tried it on Raspberry 3 A). Keep in mind that this is a single person project (thinking about support) and not approved by Apple.

„It should just work – for HomeKit (and other smart stuff)“: All of the mentioned bridges have pros and cons. All should do their job, although I’d prefer the 1Home bridge. It is the priciest of them, but in the video it looks like there is almost zero configuration, plus it can be powered via PoE, so no additional power supply if you have a PoE switch.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert