The author of the following post encountered the same challenge. The solution was to use a condition because it provides more control for accessing the list item in data.
@farmio thank you for pointing out the solution. I have over 20 automations based on KNX telegrams and I was really panicking for a bit
@balloob This change should be announced at the same level as the security vulnerabilities were announced (what was also the reason why I upgraded my production Home Assistant without looking further inside the release notes). Even my outdoor alarm was firering once because of this change
I couldn’t get it to work at first.
The ‘event_filter’ in the KNX yaml gave me more issues than solutions.
What does that do exactly? I’m unable to find clear documentation on that.
What did work for me was filtering on the ‘destination’ and ‘value’ attributes of the knx_event.
I noticed that filter on the ‘value’ attribute was better then the ‘data’ attribute, because some actors will start counting the scene numbers from 0, while others start from 1, so the ‘data’ attribute will not always match the scene number while the 'value always matched for me.
It’s just event: now - no more “_filter”. See KNX - Home Assistant
If you configured this with type: scene_number you’ll get a value of payload +1 where payload is the first item of the data field (data is a list for DPT 5 / 17).
May I just add another question regarding knx event data and conditions. I succeeded receiving the event, but I cannot access the data in a condition. The sent data is a simple on/off switch data type (1.001, DTP_Switch, 0 = Off, 1 = On) and received correctly, at least from what I saw in the event listener. My goal was having one automation for each address and implementing different conditional actions, eg. 0 to turn the light off, 1 to turn it on. As a workaround I implemented an automation for each address and data:
alias: "KNX event: Living room - ceiling light Off (2/0/120)"
description: KNX event listener for the living room ceiling light
trigger:
- platform: event
event_type: knx_event
event_data:
address: 2/0/120
data: 0
condition: []
action:
- service: light.turn_off
data: {}
target:
entity_id: light.hue_fair_pendant_1
mode: single
This is working but makes the code hard to maintain since I have quite a lot of automations listening to the same address. Is there an approach having a single event listener for one address with conditions and different actions?
It’s destination:, not address:.
Also you may have a look at my blueprint which handles exactly what you want to achieve without the need to set event-addresses in yaml: KNX - relative dimming for lights blueprint · GitHub