Tutorial for fastest possible knx integration into home assistant

Hi
I figured out a way to transfer knx addresses into home assistant relatively quickly. It’s not exactly pretty, but it works. I made a tutorial which also servers as a quick and dirty beginners guide for HA.

Just to get all you KNX folks into home assistant! :slight_smile:

2 Likes

Hi there - very cool tutorial, well done!

I have a different question - I would like to organize the YAML files around an object in KNX, kind of in a similiar way or manner like I organize the group addresses in KNX around certain subjects.

For instance, let’s say I have a water pump that I can switch on/off and via the KNX actuator I also measure the power consumption and maybe the temperature of the water.

in KNX I would do the group addresses like this:

1/0/0 - SWITCH Pump Cold Water (switch)
1/0/1 - STATUS Pump Cold Water (state)
1/0/2 - POWER Pump Cold Water (power)
1/0/3 - TEMPERATURE Cold Water (temperature)

And then maybe I have a simple Light Switch with an integrated presence sensor:

2/0/0 - SWITCH Lights Office (switch)
2/0/1 - STATUS Lights Office (state)
2/0/2 - PRESENCE Office (state)

As you can see from above, in the KNX Group Address environment I can “mix” various types of objects such as switch, state, power, temperature in adjacent group addresses.

When I create the YAML file in Home Assistant, I would like to do the same thing:

KNX:

#START EVERYTHING AROUND PUMPS
  switch:
    -name: "Switch Pump Cold Water"
     address: "1/0/0"
     state_address: "1/0/1"

  sensor:
    -name: "Power Consumption Pump Cold Water"
     state_address: "1/0/2"
     type power
    -name: "Temperature Cold Water"
     state_address: "1/0/3"
     type: temperature
#END EVERYTHING AROUND PUMPS  


#START EVERYTHING AROUND OFFICE
  switch:
    -name: "Switch Office Lights"
     address: "2/0/0"
     state_address: "2/0/1"

  binary_sensor:
     -name: "Presence Office"
     state_address: "2/0/2"

#END EVERYTHING AROUND LIGHTS

The issue is that Home Assistant accepts the YAML files when checking it under Developer tools/Check configuration, but somehow the KNX objects are not created correctly within the Devices/Entities.

I checked the Debug File and found the following errors (ignore the file name that are not corresponding to the above sample which is for illustration purpose only):

2023-06-02 18:00:17.111 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/inc_knx.yaml contains duplicate key "switch". Check lines 4 and 40
2023-06-02 18:00:17.111 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/inc_knx.yaml contains duplicate key "switch". Check lines 40 and 50
2023-06-02 18:00:17.111 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/inc_knx.yaml contains duplicate key "sensor". Check lines 17 and 59
2023-06-02 18:00:17.111 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/inc_knx.yaml contains duplicate key "switch". Check lines 50 and 115
2023-06-02 18:00:17.111 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/inc_knx.yaml contains duplicate key "switch". Check lines 115 and 121
2023-06-02 18:00:17.111 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/inc_knx.yaml contains duplicate key "sensor". Check lines 59 and 133
2023-06-02 18:00:17.111 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/inc_knx.yaml contains duplicate key "binary_sensor". Check lines 129 and 145

In a nutshell, home assistant KNX integration does not like to have switches, sensors, binary sensors etc defined more than once.

My question is if that is correct which means I must just re-organize my YAML file(s).

A bit annoying, as it is logically so much nicer to organize objects around its purpose, and not around its technical abilities.

Has anyone had a similiar problem, and maybe found a work-around?

Thanks
Martin

I suppose I could have figure this out myself - but the PACKAGES concept helped a lot…

Hello.
this is a great tutorial, However i need your help with knx to home assistant. is there a n option to contact you directly ?

Hi Martin,

Were you able to find a solution for this ?

Karthik