XKNX

A KNX library written in Python

Introduction

Changelog

XKNX Object

Lights / Dimmer

Cover

Switches

Time

Sensors

Binary Sensors

HVAC

Configuration

Home Assistant Plugin

Home Assistant Component

XKNX ships with Home Assistant, the great platform for home automation!

For development and debugging reasons - or to catch up with the newest features - you may still use the custom component version of the plugin.

Manual Installation:

Checkout xknx ideally into your home folder:

cd ~
git clone https://github.com/XKNX/xknx.git

Create a symbolic link to your custom components directory:

mkdir -p ~/.homeassistant
ln -s ~/xknx/home-assistant-plugin/custom_components ~/.homeassistant/custom_components

Run HASS as usual either via service or by directly typing in hass.

Running HASS with local XKNX library

Even when running hass with the XKNX component, hass will automatically install a xknx library within .homeassistant/deps/lib/python3.5/site-packages via pip. This very often causes the problem, that the checked out xknx library is not in sync with the xknx library hass uses. But getting both in sync is easy:

Delete automatically installed version:

rm .homeassistant/deps/lib/python3.5/site-packages/xknx*

Comment out dependency from xknx.py, otherwise hass would reinstall the xknx library when startup:

julius@xxx ~/xknx:$ git diff -U0 home-assistant-plugin/custom_components/xknx.py 
diff --git a/home-assistant-plugin/custom_components/xknx.py b/home-assistant-plugin/custom_components/xknx.py
index 7f26c43..0b1e046 100644
--- a/home-assistant-plugin/custom_components/xknx.py
+++ b/home-assistant-plugin/custom_components/xknx.py
@@ -39 +39 @@ _LOGGER = logging.getLogger(__name__)
-REQUIREMENTS = ['xknx==0.7.18']
+# REQUIREMENTS = ['xknx==0.7.18']

Ideally start hass from command line. Export the environment variable PYTHONPATH to your local xknx checkout:

export PYTHONPATH=$HOME/xknx
hass

Starting via service is also possible, but you have to change the configuration to make sure PYTHONPATH is set correctly.

Configuration:

The configuration works as described within Home Assistant documentation with the difference that the component is called xknx instead of knx.

Platform:

xknx:
  tunneling:
    host: '192.168.2.23'
    port: 3671
    local_ip: '192.168.2.109'

light:
  - platform: xknx
    name: Kitchen-Light-1
    address: '1/0/9'
    brightness_address: '1/0/11'

switch:
  - platform: xknx
    name: Kitchen.Coffee
    address: '1/1/6'

Help

If you have problems, join the XKNX chat on Discord. We are happy to help :-)