KNX Cookbook

Hi there,

Happy to see you are already getting some answers to your question.

May I ask you to tell me how you connected the velux interface to the MDT actor, please?
I am going to face that same challenge next week.
In order to not hijack the thread, I think it’s best if you send me a PM, if you have a spare moment :wink:

Many thanks in advance :slight_smile:

Hello guys and thank you for all your answers. I absolutely awesome how fast you are and how good you help! Thanks again!

@Jörg: you are completely right. First I had to think about the correct KNX installation. This was already done from my electrician and this is working so fare. I mean I can open and close the Velux blinds or the Velux window.
The hint with the script was the right one. Thank you! Additional I was now able to connect directly to my KLF200 via IP address.I’m very happy that it’s working now!

Hi. actually I was not the on how connected this. This was my electrician. I just know I bought a KLF200 and maybe a KUX100 as well. Not sure anymore. There is a video on YT which maybe help. Just search for Velux KLF200 KNX.

Thanks!
Merci, André! :slight_smile:

Hey together, I hope you can figure out what I am doing wrong :wink: Thank you in advance.
My setup is an KNX switch, which I want to use to turn on / off a shelly switch. With this setup it works like a charm, when I just push the KNX switch:
The GA 10/0/22 is connected to my KNX switch, an in my knx.yaml, I use it as a binary_sensor:

  binary_sensor:
    - name: "Garberobe Lichtband"
      state_address: "10/0/22"
      sync_state: false
      ignore_internal_state: true

I then use an automation to turn on the shelly switch:

- id: garderobe_licht_ein
  alias: Garderobe Licht einschalten
  trigger:
  - platform: state
    entity_id: binary_sensor.garberobe_lichtband
    from: 'off'
    to: 'on'
  condition: []
  action:
  - service: switch.turn_on
    entity_id: switch.shelly_garderobe
  initial_state: true
  mode: single

To have the correct status for the switch in my KNX system, i expose the switch.shelly_garderobe state to the state_adress GA 10/0/23.

  expose:
    - type: "binary"
      entity_id: "switch.shelly_garderobe"
      address: "10/0/23"

All this works fine, when I just use the KNX switch to turn on the shelly switch.
However, I also use some scenes and automations, which turn off and on the shelly switch, like an “turn everything off”. This is triggered by another KNX switch, and another automation is used to turn off the shelly switch. This is done in the following automation (excerpt):

- id: light_everything_off
  alias: Everything_off
  initial_state: true
  trigger:
  - platform: state
    entity_id: binary_sensor.gebaeude_zentral_aus_switch
  condition:
  - condition: template
    value_template: '{{ (trigger.to_state.state == "off") }}'
  action:
  - service: switch.turn_off
    entity_id: switch.shelly_garderobe

The shelly switch turns off, the state in the KNX system updates and is correct.
But now I have to press 3 times to get the Shelly switch back on using the KNX switch for that. And this behaviour occurs not just for turning it on again, there are other scenes and automations, which turn the shelly switch off and there I also have to push the KNX switch exactly 3 times before anything happens at the Shelly switch.
I dont think that it can be a Shelly problem, because I have a similar setup with a Tuya switch and I experience the same behaviour there.
I hope, anybody can give me a hint about what I do wrong.
Thank you very much!
Stefan

I think this is because 10/0/23 isn’t updating your binary_sensor. So it received a second ON which does not match your automations from: "off".

I’d use a knx_event instead.
(Or add the address to your binary_sensor or adjust the automation)

How would I get 10/0/23 to do the update? I thought this would be done by the expose?
And: How could I add an address to the binary_sensor? In the docs I dont find address as a variable for binary_sensor?

expose sends the state of your shelly thing to 10/0/23. Not more, not less.
Your binary_sensor is listening to 10/0/22 so unless you have some KNX native logic that repeats 10/0/23 to 10/0/22 the binary sensor will not know about your central functions, scenes etc.

I guess you have your KNX switches connected with both GAs - sending to 10/0/22. Thats fine - it will send the right payload. With an knx_event you can match for incoming payloads and don’t have to manage states of HA binary sensors.

If you need the binary_sensor for something else you can use passive addresses in your yaml config.

I have plenty of binary sensors that I use as light switches for Hue lights.

For some (odd?) reason my HA instance has started to crash once a day, and that for some reasons triggers all automations in boot. Which in my case for some odd reason means that HA tries to “click” all binary sensor buttons so I have a massive light show in my house every time HA reboots now.

Can someone point a mistake in my setup to prevent this? Other than finding the culprit which causes the HA frontend to crash.

Reloading KNX in HA also triggers the lightshow.

Example config:

knx_binary_sensor.yaml

- name: light_switch_wc1_valo
  state_address: '10/0/1'

automations.yaml

- id: KNX WC1 turn on
  alias: KNX WC1 turn on
  trigger:
    platform: state
    entity_id: binary_sensor.light_switch_wc1_valo
    to: 'on'
  action:
  - service: homeassistant.turn_on
    data:
      entity_id: light.wc1
      color_temp: 447
      brightness: 240
- id: KNX WC1 turn off
  alias: KNX WC1 turn off
  trigger:
    platform: state
    entity_id: binary_sensor.light_switch_wc1_valo
    to: 'off'
  action:
  - service: homeassistant.turn_off
    data:
      entity_id:
      - light.wc1

In ETS that is configured as simple toggle/on-off switch, clicking the button turns on the light, clicking it again turns off the light.

The frontend isn’t the problem. Automations run in core, so do all other entities.

Try to add from: 'off'
Knx entities are now marked unavailable when there is no connection. This reflects in a state “unavailable” which may trigger the automation when turning to “on”.

Your problem may come from your network equipment assigning new IPs or alike once a day.

Id suggest to work with events rather than binary_sensors here. Events are stateless and will eliminate the need to keep the sensor entity state in sync with your knx buttons.
Or look for the blueprint I created specifically for controlling HA lights from knx.

2 Likes

After the new KNX has been updated all KNX sensors appear in the integration page under KNX except for the weather station’s rain sensor. If I put in manually under binary_sensor, the sensor is not being created.
Any idea?
BTW, all other sensors of the same weather station exists (temp, light etc.).

The weather station does not expose any sensor values as sensors (anymore). You need to create those sensors for yourself.

If you share the relevant part of your config we might be able to help you.

Thanks.
It is only the rain sensor which is a binary_sensor that is not being detected automatically. The rest are detected automatically (including roof temp, wind etc.).
I have re-added the weather group of sensors to the KNX integration in the configuration.yaml and now it is all working.

ATTENTION users of KNX integration:
Please don’t upgrade to HA 2021.12.4 at this time.
There could be an issue with the KNX integration in that version.

2 Likes

HA 2021.12.5 has been released and solves the problem. Enjoy! And have a Merry Xmas.
:christmas_tree: :heart:

2 Likes

Can’t confirm. Seems broken to me.

  1. Rolled back to working backup 2021.12.2 (my external backup of the HAOS image)
  2. Updated to 2021.12.5
  3. Entities are existing, but nothing works (no switches, no covers)
  4. Changing from automatic to tunneling or routing will cause HAOS to stop discovering the gateway.

Interesting. My whole installation works flawlessly with 2021.12.5. This is a whole house based on KNX with anything from heating to covers, lights, switches. everything.
Is there any error or warning related to KNX in your logs?

@Jpsy: I havent seen any errors. Will test again tonight when the wife and child are asleep :smiley:

This has happened to me as well with 2021.12.4. It was supposed to be fixedin 2021.12.5. Now it works only if you must keep the sensors, lights etc. yaml files, otherwise they will exist but fail to connect.

Hi all - I’m fighting now 3 problems a while (+now l have a problem with my wife complaining now too)

  1. I think since 2021.11 my date/time is only updated to the KNX-bus when I restart the core. No refresh after the usual 1 hour. Nothing changed in the config and it was working fine.

  2. I’m struggling around since I renamed some of my bus addresses but somehow there seems to be a history.
    i.e.:
    2/4/1 was a switch names child1.Christmas.light and should now be child.desk.lamp
    2/4/2 is a new address and should now be child1.Christmas.light

It’s not possible that I can use the new name probably after a restart.

  1. Somehow there’s a ghost in my house (and there comes the wife complaining is the loudest). Shutters are used without anything pressed (up / down) - and that in the middle of the night:

History says:
“00:22:53 will be opened by supervisor”
“00:22:53 will be closed by supervisor”
“00:22:54 was opened by supervisor”
“00:22:55 was closed by supervisor”

Any ideas?