Use Scenes in KNX and Homeassistant

Hi there,

I have no realy solution for my problem.

I have a Scene GA (0/2/0) on my KNX Bus and want to trigger this one, if I activate a Scene in HASS.

Also in the other Direction. If I activate a Scene with one of my KNX Actors, I want to get this to Hass, and trigger some Devices, who I have configure in the scene Section of Hass.

I have no really good solution for that.

If I add the scenes in my knx.yaml, than I can not configure these in the Scene Config UI of Hass.

Yeah, the scenes from HA aren’t 100% compatible to the ones from knx.

Use a knx_event to listen to the GA and scene numbers to trigger your HA scene from an automation.

But then I have to create for each scene a automation? If I have 50 Scenes, I need 50 Automations only to listen for Scenes on the KNX Bus? Is there not a simple Solution?

You can create one automation listening for all these scenes if you prefer 🤷

Do you have maybe an example? I am new in Hass. This would be great. :heart_eyes:

No, I don’t. Just try to do a state trigger on a scene number sensor and choose an associated action between the different scene numbers.

1 Like

Thank you for that.

Here is my solution for everyone :slight_smile:

alias: "Event: Szene vom KNX Bus"
description: ""
trigger:
  - platform: event
    event_type: knx_event
action:
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ trigger.event.data.value == 1 }}"
        sequence:
          - service: scene.turn_on
            target:
              entity_id: scene.fernsehen
            metadata: {}
      - conditions:
          - condition: template
            value_template: "{{ trigger.event.data.value == 2 }}"
        sequence:
          - service: scene.turn_on
            target:
              entity_id: scene.entspannen
            metadata: {}
      - conditions:
          - condition: template
            value_template: "{{ trigger.event.data.value == 3 }}"
        sequence:
          - service: scene.turn_on
            target:
              entity_id: scene.nacht
            metadata: {}
      - conditions:
          - condition: template
            value_template: "{{ trigger.event.data.value == 4 }}"
        sequence:
          - service: scene.turn_on
            target:
              entity_id: scene.zentral_aus
            metadata: {}
      - conditions:
          - condition: template
            value_template: "{{ trigger.event.data.value == 5 }}"
        sequence:
          - service: scene.turn_on
            target:
              entity_id: scene.weihnachten_ein
            metadata: {}
      - conditions:
          - condition: template
            value_template: "{{ trigger.event.data.value == 6 }}"
        sequence:
          - service: scene.turn_on
            target:
              entity_id: scene.weihnachten_aus
            metadata: {}
    default:
      - service: notify.notify
        data:
          title: Automation für Szene brachte Fehler
          message: >-
            Die Szene mit der Nummer {{ trigger.event.data.value }} konnte nicht
            in Home Assistant gefunden werden. Bitte Automation ergänzen
mode: restart

I have also added a default condition, to notify me, if there is no Scene in Hass, that I have added in my ETS.

3 Likes

:+1: looks great!

Thx for this good overview. I tried to set this up on my end. But does this work in a regular automation or do I need to set this up in my config yaml or do I need to add it at least add the KNX address x/x/x to the configuration YAML?
Thx! I am just getting started.

Hi :wave:!
knx_event needs setup in configuration.yaml. Have a look at device trigger actions for a way that doesn’t need that

Hi guys,
Thanks for this interesting discussion. I tried to do the same: fire a HA automation triggered bij a KNX wall switch… and I finally succeeded.
Might be helpfull to others to note that the telegram for invoking KNX scene nr 1 has 0 as payload, scene nr 2 has 1, etc…at least with my MDT binäreingang. Took me half a day to realize that.

On the other hand, I don’t see the GA numbers appear in the ‘destination’ input field in the automation, as shown in the video.
I had put this in my configuration.yaml (1/0/15 is the GA of the scene)

knx:
  event:
    - address: 
        - "1/0/15"
      type: "scene_number"
  light:
    - name: "Living staanlampen"
      address: "1/0/3"
      state_address: "1/0/5"
      brightness_address: "1/0/12"

etc.....

Any idea?
Thanks

Head to the Knx panel and upload your project file to get that.

Scene numbers are always payload + 1. So it will have payload: 0 and value: 1

The config you did in yaml is for knx_event - this is actually something different from the device trigger. You can just type a GA in the device triggers text field - even if you don’t have values in the dropdown.