Create calculated sensor

Im trying to create a sensor using the template assistant, to give me a % range left for my vehicle. In the state template section, I have added:
sensor.volvo_yv12zem10rs081866_distance_to_empty_battery/217
where 217 is the total range, but I get the error:

Sensor None has device class ‘None’, state class ‘None’ unit ‘%’ and suggested precision ‘None’ thus indicating it has a numeric value; however, it has the non-numeric value: ‘sensor.volvo_yv12zem10rs081866_distance_to_empty_battery/217’ (<class ‘str’>)

any idea how I can rectify this to return a % value?

You need to use the correct functions, filters, and delimiters. Without them, you are telling the template engine to just print the string of letters and numbers you have provided.

{{ states('sensor.volvo_yv12zem10rs081866_distance_to_empty_battery')
| float(0) / 217 }}