Skip to content

Commit e32c562

Browse files
farmiomarvin-w
andauthored
Add decoded telegram payload value to knx_event (home-assistant#20190)
* knx_event type key * caps KNX * Update source/_integrations/knx.markdown Co-authored-by: Marvin Wichmann <marvin@fam-wichmann.de>
1 parent 9df4a2d commit e32c562

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

source/_integrations/knx.markdown

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,25 +195,37 @@ local_ip:
195195

196196
```yaml
197197
knx:
198-
event_filter:
199-
- "1/0/*"
200-
- "6/2,3,4-6/*"
198+
event:
199+
- address:
200+
- "0/1/*"
201+
- address:
202+
- "1/2/*"
203+
- "1/3/2-4"
204+
type: "2byte_unsigned"
205+
- address:
206+
- "3/4/5"
207+
type: "2byte_float"
201208
```
202209

203210
{% configuration %}
204-
event_filter:
205-
description: Defines a list of patterns for filtering KNX group addresses. Telegrams with destination addresses matching this pattern are sent to the Home Assistant event bus as `knx_event`.
206-
required: false
211+
address:
212+
description: Defines a list of patterns for matching KNX group addresses. Telegrams with destination addresses matching one of the patterns are sent to the Home Assistant event bus as `knx_event`.
213+
required: true
207214
type: [list, string]
215+
type:
216+
description: Telegram payloads in `knx_event` events will be decoded using the configured type (DPT) for the addresses in the same block. The decoded value will be written to the event data `value` key. If not configured the `value` key will be `None` - the `data` key will still hold the raw payload (use this for DPT 1, 2, 3). All sensor types are valid types - see [KNX Sensor](#sensor) (e.g., "2byte_float" or "1byte_signed").
217+
type: [string, integer]
218+
required: false
208219
{% endconfiguration %}
209220

210-
Every telegram that matches the filter with its destination field will be announced on the event bus as a `knx_event` event containing data attributes
221+
Every telegram that matches an address pattern with its destination field will be announced on the event bus as a `knx_event` event containing data attributes
211222

212223
- `data` contains the raw payload data (e.g., 1 or "[12, 55]").
213224
- `destination` the KNX group address the telegram is sent to as string (e.g., "1/2/3).
214225
- `direction` the direction of the telegram as string ("Incoming" / "Outgoing").
215226
- `source` the KNX individual address of the sender as string (e.g., "1.2.3").
216227
- `telegramtype` the APCI service of the telegram. "GroupValueWrite", "GroupValueRead" or "GroupValueResponse" generate a knx_event.
228+
- `value` contains the decoded payload value if `type` is configured for the address. Will be `None` for "GroupValueRead" telegrams.
217229

218230
## Services
219231

@@ -289,7 +301,7 @@ automation:
289301

290302
### Register Event
291303

292-
The `knx.event_register` service can be used to register (or unregister) group addresses to fire `knx_event` Events. Events for group addresses matching the `event_filter` attribute in `configuration.yaml` cannot be unregistered. See [knx_event](#events)
304+
The `knx.event_register` service can be used to register (or unregister) group addresses to fire `knx_event` Events. Events for group addresses configured in the `event` key in `configuration.yaml` cannot be unregistered. See [knx_event](#events)
293305

294306
{% configuration %}
295307
address:
@@ -301,6 +313,10 @@ remove:
301313
required: false
302314
type: boolean
303315
default: false
316+
type:
317+
description: If set, the payload will be decoded as given DPT in the event data `value` key. KNX sensor types are valid values [KNX Sensor](#sensor) (e.g., "2byte_float" or "1byte_signed").
318+
type: [string, integer]
319+
required: false
304320
{% endconfiguration %}
305321

306322
### Register Exposure

0 commit comments

Comments
 (0)