knx

Control Home Assistant devices with KNX group addresses

· 2 min read

Had to look up some posts before I got it working, so this is a note to myself.

First you need to allow the KNX Group Addresses you want to trigger on to hit Home Assistants event bus, in this example 0/0/1.

knx:
  fire_event: true
  fire_event_filter: ["0/0/1"]

Correction: 'fire_event' is deprecated.

This is the correct syntax:

  knx:
    event_filter: ["0/0/1", "1/0/13"]

After a restart you can check if the GA is visible on the bus when triggered, open HA's developer menu, events, and type 'knx_event' as event and 'listen', then generated the GA transmit, press key or whatever is generating it.

You see it contains 'data.data' with value 0 (off in this case), so we create an automation for that.

  - alias: "Alles Uit"
    trigger:
      platform: event
      event_type: knx_event
    condition:
      condition: template
      value_template: >
        {{ trigger.event.data.destination == '0/0/1' and trigger.event.data.data == 0 }}
    action:
      - service: light.turn_off
        data:
          entity_id: light.hobbykamer_ledstrip

If you want to react on more Group Addresses, you can use choose in your automation's, like so:

  - alias: "Trigger on KNX events"
    trigger:
      platform: event
      event_type: knx_event
    condition: []
    action:
      - choose:
          - conditions:
              - condition: template
                value_template: >-
                  {{ trigger.event.data.destination == '0/0/1' and trigger.event.data.data == 0 }}
            sequence:
              - service: light.turn_off
                data: {}
                entity_id: light.hobbykamer_ledstrip
          - conditions:
              - condition: template
                value_template: >-
                  {{ trigger.event.data.destination == '1/0/13' and trigger.event.data.data == 1 }}
            sequence:
              - service: light.turn_on
                data: {}
                entity_id: light.hobbykamer_ledstrip
          - conditions:
              - condition: template
                value_template: >-
                  {{ trigger.event.data.destination == '1/0/13' and trigger.event.data.data == 0 }}
            sequence:
              - service: light.turn_off
                data: {}
                entity_id: light.hobbykamer_ledstrip

It will switch off the non-KNX light 'hobbykamer_ledstrip' when it sees a 'All Off' event on the bus, and you can toggle it on and off with another button. (using GA '1/0/13', in this case sent from a Gira RF taster)