KNX Sensor and Automation

Hi Everyone,

I am pretty new to HA and with the help of the documentation and a few videos I could integrate my KNX Bus and also some other Devices.

Now I wanted to integrate a KNX Sensor with Type: 17001 Szene.
In the config file I added:

  sensor:
    - name: "Colors"
      state_address: "0/0/11"
      type: scene_number

In the KNX Group- Monitor I see this when pressing the button:
Adress 0/0/1 with Value 30

So far so good:

Now I wanted to do a automation: Very simple but I did not get it to work after several tries.

I wanted to catch this event and start a Playlist on Sonos.
The Sonos Action works, the problem is the trigger

This is what I tried but it does not recognize the event:

- id: '1700563786456'
  alias: Test KNX
  description: ''
  trigger:
  - platform: state
    entity_id:
    - sensor.Colors
    from:
    to: '30'
  condition: []
  action:
  - service: script.turn_on
    entity_id: media_player.move
  - service: media_player.select_source
    data:
      source: Playlist
    target:
      entity_id: media_player.move
  mode: single

Any idea?

Thanks Alex

A sensor only triggers a state change when the value changes. Also the to: 30 condition requires the entity to have had a different value before.

Use a Knx Interface “Telegram” Device trigger instead.

Hi,

thank you very much. I forgot to mention I did that before with:

alias: Test Move
description: ""
trigger:
  - platform: device
    domain: knx
    device_id: 14ccec8f0f9241c39872a87905171403
    type: telegram
    destination:
      - 0/0/11
condition: []
action: []
mode: single

This did work but in any case the Address was sent. However I nit it with the specific value of 30. Or is there any parameter to specify that?

Thanks

You can use a template condition for that {{ trigger.value == 30 }} (or .payload) mind that for scenes, value = raw payload +1
See also https://youtu.be/O3p3dISvTtI

Hi,

thank you very much for your time and instructions. Something here does not work and I do not find the reason.

  1. I setup the KNX Telegram Condition and Group Address.
  2. Pressing the button on the Basalte Switch and i receive the trigger
    2023-11-22 10_47_13

As you can see the payload is 29 (or - 29) I tried both options.
3) The action itself does work (Tested it separately) however the condition with the payload is not accepted.

Sorry to ask again…but any idea?

Here’s the code in the automation file

- id: '1700563786456'
  alias: Test KNX
  description: ''
  trigger:
  - platform: device
    domain: knx
    device_id: 14ccec8f0f9241c39872a87905171403
    type: telegram
    destination:
    - 0/0/11
  condition: []
  action:
  - if:
    - condition: template
      value_template: '{{ trigger.payload == 29 }}'
    then:
    - service: light.turn_on
      data: {}
      target:
        entity_id: light.licht_dusche
  mode: single

Thanks

Alex

This is yaml style for a “list with 1 item: 29” ([29]).
Just use trigger.value == 30 since you have project data.

1 Like

Thank you very much :slight_smile:

Hi again,

I setup a few KNX automations which do work in general. However I have one automation which stopped working (already 3 times in 2 weeks) and I am not sure if that has something to do with the sequence/delay. Please find the code attached. As you can see there are two triggers. Only if the payload is 1…the action starts. So far so good.

Is it possible that if the triggers starts too often the service stops working?
I can solve the problem by saving the file again.

Maybe some protection for the service/sequence that kills it after a certain time?

Thanks for your help

Alex

Have a look what the different automation modes do. Automation modes - Home Assistant
Other than that, have a look at the automation debugger to see if it was triggered.