MQTT temperature round problem

Hi there,

I’m usind DIY DHT22 (AM2301) sensor with ESP8266-01 and tasmota firmware. I’m getting normal temperature result with following config:

  - platform: mqtt
    name: "Balkon Sıcaklık"
    state_topic: "tele/sonoff/termostat/SENSOR"
    value_template: "{{ value_json['AM2301'].Temperature | float - 2 | round(2) }}"
    unit_of_measurement: "°C"

But, when temperature is below <10°C Temperature result like this:

7.800000000000001 °C

rount (2) is doesnt work under 10 degrees.

any advice?

What about:

{{ (value_json['AM2301'].Temperature | float - 2) | round(2) }}
2 Likes

Oops. Thanks for prompt answer. :+1: