GUI defined template helper cannot set as float

This one has been puzzling me a while! I use the GUI to define my helpers to avoid YAML changes and system reloads. I have defined a template helper to read the temperature from a climate entity like this:

"{{ state_attr('climate.leahs_radiator_thermostat', 'current_temperature') | float }}"

I have NOT set anything in the drop-downs “Unit of Measurement”, “Device Class”, “State Class”.

If I try to set them to the correct values (oC, Temperature, Measurement) the preview errors out with:

Sensor None has device class 'temperature', state class 'measurement' unit '°C' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: '"19.0"' (<class 'str'>)

Which is sort of the issue I’m facing. The value is always a string even though I’m passing it a | float to convert it.
When I don’t put in the above class, it will display a value but it’s clearly displaying as a string since the output is:
“19.1”
(Note the quotation marks)
What am I doing wrong in the template helper, is this a GUI bug/issue I’ve hit perhaps?

remove the quotes on your template.

You’re pasting

"{{ state_attr('climate.leahs_radiator_thermostat', 'current_temperature') | float }}"

You should be pasting

{{ state_attr('climate.leahs_radiator_thermostat', 'current_temperature') | float }}

Oh boy do I feel stupid now, it was obvious!

Thank you, working perfectly now :slight_smile: