Template helper error non-numeric value

I’m trying to subtract one sensor from another but I get an error message when I do with the helper.

Sensor None has device class ‘energy’, state class ‘total’ unit ‘Wh’ and suggested precision ‘None’ thus indicating it has a numeric value; however, it has the non-numeric value: ‘“12950271.440000001”’ (<class ‘str’>)

“{{ states(‘sensor.haushaltsstrom_positive_active_energy_total’) | float - states(‘sensor.energie_warmepumpe’) | float }}”

I can see the correct value but don’t understand why its non-numeric?

It’s got quotes around it (so "42" rather than 42). If this is a template sensor created in the UI, the state template should be:

{{ states('sensor.haushaltsstrom_positive_active_energy_total') | float -
   states('sensor.energie_warmepumpe') | float }}

Please format code correctly for the forum: I’ve had to correct “smart quotes” when copy/pasting your code.

Thank you this was the solution.
I try to post better next time.