Add value_template option to KNX expose (#32841)

This commit is contained in:
Matthias Alphart 2024-05-22 00:10:21 +02:00 committed by GitHub
parent 645543fce5
commit 5c97f3f295
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -437,10 +437,16 @@ Expose is only triggered on state changes. If you need periodical telegrams, use
</div> </div>
{% raw %}
```yaml ```yaml
# Example configuration.yaml entry # Example configuration.yaml entry
knx: knx:
expose: expose:
# time and date exposures
- type: time
address: "0/0/1"
# entitiy exposures
- type: temperature - type: temperature
entity_id: sensor.owm_temperature entity_id: sensor.owm_temperature
address: "0/0/2" address: "0/0/2"
@ -460,12 +466,20 @@ knx:
attribute: brightness attribute: brightness
default: 0 default: 0
address: "0/3/1" address: "0/3/1"
- type: time - type: percent
address: "0/0/1" address: "1/1/1"
- type: datetime entity_id: cover.office
address: "0/0/23" attribute: current_position
value_template: "{{ 100 - value }}" # invert the value
- type: percent
address: "2/2/2"
entity_id: media_player.kitchen
attribute: volume_level
value_template: "{{ value * 100 }}" # convert from 0..1 to percent
``` ```
{% endraw %}
{% configuration %} {% configuration %}
address: address:
description: Group address state or attribute updates will be sent to. GroupValueRead requests will be answered. description: Group address state or attribute updates will be sent to. GroupValueRead requests will be answered.
@ -491,6 +505,11 @@ default:
type: [boolean, string, integer, float] type: [boolean, string, integer, float]
default: None default: None
required: false required: false
value_template:
description: A template to process the value before sending it to the KNX bus. The template has access to the entity state or attribute value as `value`.
required: false
default: None
type: template
cooldown: cooldown:
description: Minimum time in seconds between two sent telegrams. This can be used to avoid flooding the KNX bus when exposing frequently changing states. If the state changes multiple times within the cooldown period the most recent value will be sent. description: Minimum time in seconds between two sent telegrams. This can be used to avoid flooding the KNX bus when exposing frequently changing states. If the state changes multiple times within the cooldown period the most recent value will be sent.
type: float type: float