KNX Cookbook

I’m getting a house with a new KNX instalation in a couple months.

The KNX system will control the basic functions like blinds and lights, but I’m looking forward to connecting it to home assistant for more advanced features.

If it’s not the best place to ask this I apologize, but if you were on my shows, what advice would you give to your past self regarding integrating KNX in home assistant?
The only one I know so far is that while my KNX/IP router supports KNX secure, I shouldn’t use it.

Just be sure to get the .knxproj file from your integrator if you don’t create it yourself.

I will.

Also, I had t find a compromise between the extreme reliability of KNX stuff and the higher price. The TLDR is that most of my actuators (lights, blinds and electrovalves) are wired and KNX, but not every sensor is. I have one KNX sensor temperature on each floor because it’s part of a small screen and two wired presence+luminance sensors.

I’ll buy a bunch of wireless zigbee/zwave door and water leackage sensors. If I wanted to add those HA entities as if they were KNX devices with their own address, is there anything I must ask the installer about leaving reserved KNX addresses for those or not really?

No this will be fine. The addresses don’t matter.

My second advice would have been: absolutely put a presence detector in EVERY room. I didn’t and regret it. At least put a cable in the ceiling so you can do it later.

Most knx wall switches have temperature sensors integrated. But they sure cost more than conventional switches (from 50 to 500 €… have a look at Lingg&Janke or MDT for cheap ones)

All the electric equipment in the new home is from Schneider Electric because my aunt worked there for 25 years and I get almost 50% off on everything. Some of their switches have temperature sensors indeed, but I don’t need too many. I’ll have heated floors with a heatpump. That kind of heating has so much inertia that there’s no point even on having zones, you have the heating 24/7.

I have only two KNX presence+luminance detectors, but I might expand it with cheaper zigbee presence detectors and use HA to integrate them. It’s just a cost saving measure, but one has to decide when to stop spending more money. Also I’m not sure I want presence detectors on bedrooms.
Wireless presence detectors have come a long way, they are dirty cheap and batteries last for years.

That’s my plan at least.

Thank you for all this information. My KNX and HA are working pretty well together.

There is just one thing I’ve spend already a lot of hours at without getting the result I want.

I do have a couple of MDT-push buttons with leds. And in the near future I want to get myself also some MDT Led-indicators like this one: https://www.mdt.de/EN_LED_Indicator.html. Just cause they will fit next to the doors and it’s easy to see if everything is fine when leaving the house (doors/windows/…).

While it’s pretty simple to get the leds coloured by the state in KNX itself, it seems impossible to get it done with my states from Home Assistant.

As an example:

When the Alarm Panel card has different states I want to see those in my knx-leds.

Like: armed/pending/disarmed = red/blue/green

Or, like my sensor that tells me when to put my garbage outside:
Tomorrow/Today: Yellow/Red

I did try this by “send”, also did try this with “notify”, but nothing seems to work.

If I knew in front how easy everything is setup with zigbee and stuff like that together with HA, I probably would have gotten a lot more of the cheap stuff instead of KNX. I have about 15 KNX-presence detectors in and around my house and I still am buying extra from time to time (have 2 extra now, and probably will get like 2-3 more in the next months…). Not cause the KNX-stuff is not good, but cause it’s almost impossible to think about all possibilities once you start wiring your house with EIB-cables.

I have a lot of Glastasters and other buttons. Most (some exceptions of course) gets hardly used, cause my phone is mostly more close and has more possibilities… I’m not using Google Home cause my accent makes her crazy :slight_smile:

A cheap Xiaomi sensor gives me temperature and humidity. My expensive Glastasters lacks the second. So in the end I could buy expensive humidity-sensors (I do have double places at some spots like the bathroom to place one under the button-switch), or buy like 10 zigbee devices for the price of one humidity sensor… Same with the presence-detection, except for places where you almost don’t move. There I have 3361MWW from Jung and they are incredible in my opinion.

Also, don’t try to put too much logic in knx. Just the basics. I spend a lot of time with stuff like scening, and it’s almost all replaced by HA now. And get (like someone stated before) the project file. From time to time you can get ETS for an ok price, or maybe find a friend who can help you change some things.

I’m living at my place for about 9 months now, and still am changing stuff every now and then like button-rearrangements.

Create an automation that uses knx.send accordingly to the expected data format of your Led-Display. Notify is just for strings.

I’m going the opposite direction. Everything in KNX and HA works just as a gateway to non-knx devices. Whatever you feel comfortable, I guess.

2 Likes

My rule of thumb when designing system house was: If something needs a wire any way to be convenient (blind motors, lights, electrovalves), it’s KNX. Mostly actuators and switches, things that need proper power.

If something can work work wirelessly changing batteries every few years, I go zigbee and rely on HA to avoid breaking the bank.

The only exception is a fire alarm (because its critical nature) and two presence/light sensors in the most critical areas of the house.

I already have a some zigbee stuff I’ll be moving to the new place.

Thank your both for your input.

Thank you for your help already! Still without any succes. But at least I know I have to use the knx.send command now…

- alias: testledkleur
  trigger:
  - platform: state
    entity_id: input_boolean.testboolean
    from: "on"
    to: "off"
  action:
    - service: knx.send
      data:
        address: '31/0/4'
        payload:
          - 'off'
          - '00'
          - '0'
          - '$00'
          - '$0'

This is what I’m trying now, none of those work. Probably I’m not looking at the correct place for the expected data format I think. But if I look in ETS at “1.001 switch” it says $00 or $01…

The best is not to guess but check what is the DPT type that your KNX device expects on the group address. You should be able to see it in your ETS project. Once you have it I found more reliable the use of the expose: of an entity from HA to KNX bus. E.g.:

tunneling:
  host: 10.144.1.140
  port: 3671
  local_ip: 10.144.1.163
expose:
  - type: '1byte_unsigned'
    entity_id: 'sensor.ac_fan_speed_set_sypialnia'
    address: '1/4/9'
  - type: 'temperature'
    entity_id: 'sensor.aeotec_limited_zwa021_thermostatic_valve_temperature'
    address: '1/4/29'

this gives you full control of what is the data type you are sending, in above example the 1byte_unsigned is for int value (DPT_5.010) and the second for temperature (DPT_9.001).
Alternatively you can also set the type in the knx.send service. In either case check the proper type in the following table:

1 Like

DPT 1 means binary. You are trying to send a list of strings.
'0' is the character 0, not the number. Number is without quotation marks.
- at the beginning converts the payload to a list, but you don’t want a list in this case.
ETS displays hexadecimal numbers with a $ prefix, I think.

Try

(...)
data:
  payload: 0

An expose won’t get you what you want since you need to translate non-binary state (alarm status) to multiple binary GAs as far as I understood.

2 Likes

And by checking some other places the proper “type” for binary data should be:
type: "binary" either in knx.send or in expose:
And actually it seems that you can directly expose the entity e.g.:

# Example configuration.yaml entry
knx:
  expose:
    - type: "binary"
      entity_id: "binary_sensor.kitchen_window"
      address: "0/6/5"

More examples here:

1 Like

No, knx.send doesn’t accept type: binary
Exposing the entity directly to a binary address requires a binary state. Alarm seems to be non-binary.

So, a small heads up.

I didn’t knew the device I’m going to buy (the led-indicator) only has 3 led-colours. Meaning you can get green or red assigned and otherwise, if the state “isn’t correct”, it’s showing blue. A bit sad, but in the end…

It makes things pretty easy after all to do like @farmio told with the “payload: 0”. Cause now I just have 2 states to worry about, and when the alarm is pending it will turn blue on my new devices anyway.

At my buttons I use now (except the glastasters) you only get green and red anyway. (So alarm off or on). It does the trick for me at this point. Thank you all again for the help!

Hope it’s fine to post my question in here? If not, then I’d create my own thread…

Ever since updating to the latest HA version, I have problems with my KNX integration.
In the logs I see things like:

2021-02-19 11:22:47 WARNING (MainThread) [xknx.log] Could not sync group address '6/1/6' (humidity.knx.wc_ug - Value)
2021-02-19 11:22:47 WARNING (MainThread) [xknx.log] Sending telegram failed. No active communication channel.
2021-02-19 11:22:49 WARNING (MainThread) [xknx.log] Error: KNX bus did not respond in time (2.0 secs) to GroupValueRead request for: 6/0/8
2021-02-19 11:22:49 WARNING (MainThread) [xknx.log] Could not sync group address '6/0/8' (temperature.knx.flur_og_stiege - Value)
2021-02-19 11:22:49 WARNING (MainThread) [xknx.log] Error: KNX bus did not respond in time (2.0 secs) to GroupValueRead request for: 6/1/8
2021-02-19 11:22:49 WARNING (MainThread) [xknx.log] Could not sync group address '6/1/8' (humidity.knx.flur_og_stiege - Value)
2021-02-19 11:22:51 WARNING (MainThread) [xknx.log] Sending telegram failed. No active communication channel.
2021-02-19 11:22:51 WARNING (MainThread) [xknx.log] Sending telegram failed. No active communication channel.

I read in the release notes that

Some knx_event s changed the name of event_data fields:

  • address renamed to destination
  • Added source
  • Added direction
  • Added telegramtype

Additionally:

  • fire_event in the knx configuration is deprecated.
  • fire_event_filter in the knx configuration is renamed to event_filter .

but I am not sure if that is the problem? In my config I use the property address, but not in the evnt_data field?!? Not sure. I mainly only have my integration done via xknx.yaml

It looks like the following:

general:
  own_address: "15.15.249"

connection:
  tunneling:
    gateway_ip: "192.168.1.113"
    gateway_port: 3671
    local_ip: "192.168.1.15"

groups:
  light:
    light.knx.group_unterer_stock:
      { group_address_switch: "0/0/1", group_address_switch_state: "0/0/1" }
   .....

And also it works for a short period of time when I restart my HA, but will then stop working after a couple of hours.

Is there any known issue about that, that I am missing?

This is a couple of issues combined:

  • your Tunnelling Server disconnects HA for any reason
  • config_file: xknx.yaml configurations have a bug with reconnecting lost connections

Apart from waiting for the next version where this is fixed you can move to HA configuration.yaml configuration style.

config_file: xknx.yaml will be deprecated soon anyway. There is a config converter website (online since couple of hours :wink:) that will help you move over to the HA Schema.
https://xknx.io/config-converter/

1 Like

Thanks for your help @farmio! But it would be a bit strange if my IP-Gateway starts disconnecting me only since I updated HA?!? Do you have any idea how to debug that?

Thanks for the xknx info! So I need to convert to regular HA-yaml then… Also thanks for the converter-link. That would have taken me hours otherwise :slight_smile:

No I guess it has disconnected ever since, but pre xknx 0.16 it would have just reconnected at some point.
You could have a look if your tunneling server has logs, capture knx traffic with ETS or HA (xknx.knx logger to debug) if you like to find out what’s going on. I’d be interested too, so please let me know (eg GitHub issue).

Took me couple of hours to build it. Hope it works. :smiley:

1 Like

Hm… I am not sure if I can find logs on my devices? I have an MDT IP Interface (SCN-IP000.03). I just tried if it really has a Web-UI but by typing in its IP-Address, nothing shows up…
Anyway… I just tried out your converter and it looks very good! Everything seems to still work as expected :slight_smile:

1 Like