Adjusting a retrieved value

Is it possible to retrieve a value, in this case a reading of the temperature via mqtt, and then adjust the actual reading so the the displayed value is the temp -8.

  - name: "SN3 Temperature"
    state_topic: "bruh/sensornode3"
    unit_of_measurement: "°F"
    value_template: "{{ value_json.temperature | round(1) }}"

So basically in this case I would need SN3 Temperature = SN3 Temperature -8 in order to display the adjusted or corrected value. Everything else works just fine.

Just subtract 8.

If the value coming from MQTT is a float/int:

value_template: "{{ (value_json.temperature - 8) | round(1) }}"

Otherwise:

value_template: "{{ (value_json.temperature|float(0) - 8) | round(1) }}"

1 Like

Awesome! Thanks so much the second option is what I needed to do.