Template sensor says it has a non-numeric value

I’m trying to create a template sensor to monitor kWh for my air conditioner. I’m monitoring one leg of the 240v circuit for the heat pump and air handler, so I must duplicate and combine two values: duplicate the heat pump and duplicate the air handler, and then combine the two.

When I try to create a template sensor to do this, I get an error stating the number is not numeric, despite it being numeric.

The code returns a numeric value in the developer tools.

My state Template is:

{{ states(‘sensor.shellyem_ec64c9c69931_channel_1_energy’) | float * 2 +
states(‘sensor.shellyem_ec64c9c69931_channel_2_energy’) | float * 2}}”

what version of home assistant are you running? my template sensor dialog looks slightly different. your template works fine for me. so i’m wondering if there’s a version issue.

i don’t see anything really wrong with your template but i suppose you could try to force the whole thing to a number with:

{{ (states(‘sensor.shellyem_ec64c9c69931_channel_1_energy’) | float * 2 +
states(‘sensor.shellyem_ec64c9c69931_channel_2_energy’) | float * 2) | float}}

but that really shouldn’t be necessary and as i said, it seems to work fine on mine.

The last character in your template is a double-quote. Remove it because it becomes part of the final value.

That’s why the error message is complaining the value is non-numeric because it is 116.2142"

2 Likes

bah! good catch!!!

That worked. Thank you!

1 Like