Template Sensor with math and rounding the result

Hi,

I create a Sensor template so add 2 solar energy values. On in Watt, the other in kW. The calculation ist working fine, but I want to round the result on 2 decimal places without success

      - name: "Summe akt. PV Leistung"
        unique_id: summe_akt_pv_leistung
        unit_of_measurement: "kW"
        icon: mdi:solar-power
        state: "{{ (states('sensor.hm_600_power') | float / 1000 | round(2)) + (states('sensor.senec_webapi_powergenerated_now') | float | round(2)) }}"

I also tried the folling, but in both cases I get 4 decimal places after comma. e.g. 1,2417 kW instead 1,24 kW

state: "{{ ((states('sensor.hm_600_power') | float / 1000 | round(2)) + (states('sensor.senec_webapi_powergenerated_now') | float | round(2)) | float | round (2)) }}"

How can I fix it

Thank you

Ingo

You are rounding the number 1000. Order of operations. Use some parentheses but not in the places you have them, division is performed before addition.

state: "{{ ( states('sensor.hm_600_power') | float / 1000  + states('sensor.senec_webapi_powergenerated_now') | float ) | round(2) }}"

Perfect, Thank you