From 5c97f3f29538e18443d420c931d43d6de81d7674 Mon Sep 17 00:00:00 2001 From: Matthias Alphart Date: Wed, 22 May 2024 00:10:21 +0200 Subject: [PATCH] Add value_template option to KNX expose (#32841) --- source/_integrations/knx.markdown | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/source/_integrations/knx.markdown b/source/_integrations/knx.markdown index fe56c434c70..335133c5141 100644 --- a/source/_integrations/knx.markdown +++ b/source/_integrations/knx.markdown @@ -437,10 +437,16 @@ Expose is only triggered on state changes. If you need periodical telegrams, use +{% raw %} + ```yaml # Example configuration.yaml entry knx: expose: + # time and date exposures + - type: time + address: "0/0/1" + # entitiy exposures - type: temperature entity_id: sensor.owm_temperature address: "0/0/2" @@ -460,12 +466,20 @@ knx: attribute: brightness default: 0 address: "0/3/1" - - type: time - address: "0/0/1" - - type: datetime - address: "0/0/23" + - type: percent + address: "1/1/1" + entity_id: cover.office + 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 %} address: 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] default: None 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: 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