Send values via KNX using templates is not working

Hi,
I need some support for sending values via KNX. The purpose is to control my Dimplex heatpump via KNX interface.
I am recalculating the temperature from KNX sensors to values needed for my heatpump. This is done the following way:
{{ states('number.eg_wohnzimmer_soll_temp_2', ) | float(0) * 10 }}
It shows me the value with one decimal number (242,0). Then I have created a script where I use this template sensor, but according to the error, I would assume that I have to send via KNX 242 instead of 242,0. For this parameter the KNX interface on the Dimplex has DPT 7.001 set and is defined

<DatapointTypeName>DPT_Value_2_Ucount</DatapointTypeName>
     <DatapointTypeCode>07.001</DatapointTypeCode>
     <DatapointDirection>IN</DatapointDirection>
     <PCO_VariableIndex>11</PCO_VariableIndex>

Here the error I get:
Validation error: Invalid payload for knx.send service: <ConversionError description="Could not serialize DPT2Ucount" value="input_number.eg_wohnzimmer_soll_temp_2"/>
When I change from template sensor to a fixed value in script, this value is sent via KNX.
How can I modify the template or script to send the template value via KNX?
thanks for any support,
Matthias

Hi :wave:!
Can you post the full script / automation you are running here? (Where knx.send is called)
This seems like an issue with formatting since it tries to send the value “input_number.eg_wohnzimmer_soll_temp_2” instead of the template result.

Hi,
Sorry that it didn’t come to my mind. Here it is

alias: Dimplex
sequence:
  - alias: Set Raumregler
    action: number.set_value
    data:
      value: "50"
      entity_id: number.wpm_raumadresse_setzen
  - alias: Wait 3s
    delay: 3
  - alias: Send KNX Raumadresse
    action: knx.send
    data:
      response: false
      address: 1/4/41
      type: "7.001"
      payload: input_number.wpm_raumadresse
  - alias: Wait 3s
    delay: 3
  - alias: Send KNX Ist-Temp
    action: knx.send
    data:
      response: false
      address: 1/4/43
      type: "7.001"
      payload: sensor.wohnzimmer_for_wpm
  - alias: Wait 3s
    delay: 3
  - alias: Send KNX Soll-Temp
    action: knx.send
    data:
      response: false
      address: 1/4/47
      payload: sensor.wohnzimmer_wpm_soll
      type: "7.001"

Br
Matthias

knx.sends payload doesn’t accept entity_ids. It would read them as string. You can, however, use templeates there:

payload: "{{ states('input_number.eg_wohnzimmer_soll_temp_2') }}"

or directly, without what I assume this input_number is for:

payload: "{{ states('number.eg_wohnzimmer_soll_temp_2') | float(0) * 10 }}"

Another way may be to use expose for that, if you only want to send when a state changes (which would work differently than your delay blocks automation - so may not fit your use case).

Thanks a lot for this support. It is working as needed!