Rounding a number does not work

I’m using below lines in the configuration. Idea is to generate a rounded number out of 2 sensors to 0.1 accuracy. But figures given in the chart are still not rounded. Also while checking the sensor value itself is giving a not rounded figure. What goes wrong.

template:

  • sensor:
  • name: “Gewogen Gemiddelde Temperatuur Kamer”
    unit_of_measurement: “°C” # Pas aan naar de juiste eenheid als nodig
    state: >
    {% set temp1 = (states(‘sensor.keuken_temperatuur’) | float) - 0.7 %}
    {% set temp2 = states(‘sensor.klimaat_woonkamer_temperatuur_2’) | float %}
    {% set lowest = [temp1, temp2] | min %}
    {% set highest = [temp1, temp2] | max %}
    {{ ((lowest * 9) + highest) / 10 | round(1) }}

You are rounding the number 10. Put another set of parentheses around the group in front of the pipe.

(((lowest * 9) + highest) / 10) | round(1)
1 Like

Thank you so much. Works fine.
Sometimes you get blind for lines. Even chatgpt did not give me the correct answer.
Thanks again.