Rounding data in sensor

Hi

Trying to round to 1 decimal place the fuel consumption sensor of my car, but, while the sensor is working, it is not rounding at all. Any thoughts?

  - platform: template
    sensors:
      volvo_fuel_consumpetion:
        friendly_name: "Fuel Consumption"
        value_template: "{% set miles = 282.481 / (float(states('sensor.volvo_fuel_consumption'))) | round(1) %} {{ miles }}"
        unit_of_measurement: "MPG"
        icon_template: "mdi:ruler"

Thanks

You aren’t rounding the final value…

- platform: template
    sensors:
      volvo_fuel_consumpetion:
        friendly_name: "Fuel Consumption"
        value_template: |
          {% set cons = states('sensor.volvo_fuel_consumption') | float(0) %}
          {{ (282.481 / cons) | round(1) }}
        unit_of_measurement: "MPG"
        icon_template: "mdi:ruler"

Perfect, thanks so much! Worked a treat.