HowDoI: Convert MQTT received value to a 2 decimal place float?

DO something like this:

  - name: "Temperature WZ 2"
    platform: mqtt
    state_topic: office/sensor3
    unit_of_measurement: °C
    value_template: "{{ value_json.temperature | round(1) - 1 }}"

round(2) will give you the right float number back, and you can do simple calculations too

1 Like