Template helper error non-numeric value

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.