State or value_template?

Hi all.

Wondering whether to use a value_template or just state in a sensor:

  - sensor:
      - name: Vehicle Fuel
        state: >-
          {% set n = state_attr('sensor.landrover_torque','Fuel Remaining (Calculated from vehicle profile)(%)') |int()  %}
          {% if n == 0 %} Empty
          {% elif n <= 10 %} Almost empty
          {% elif n <= 20 %} Refuel soon
          {% elif n <= 30 %} Fuel sufficient
          {% elif n <= 40 %} Half tank 
          {% elif n <= 50 %} More then enough
          {% elif n <= 60 %} Just filled up
          {% elif n <= 70 %} Full tank
          {% else %} Not sure, value out of range
          {% endif %}

They seem to work the same to my untrained eye.

depends if you use the old “legacy” templates - or the new templates :slight_smile: