Help with templating, power from EV ad house

Hi I have two sensors that I need to add (one is a sum of Shelly power and other is from my prismm cartender mqtt sensor for EV charging). I need to know total house consumption (house+car), but I have trouble templating.

One sensor is 1796.0, other sensor is 3890 (no .x)

Please help


- platform: template
    sensors:
        potenza_generale_totale:
            friendly_name: "Potenza generale totale"
            unit_of_measurement: 'W'
            entity_id: 
              - sensor.potenza_generale_totale_casa
              - sensor.prism_potenza
            value_template: '{{ states("sensor.potenza_generale_totale_casa") | float + states("sensor.prism_potenza") | float }}'

<template TemplateState(<state sensor.potenza_generale_totale_casa=1796.0;  >
<template TemplateState(<state sensor.prism_potenza=3940;  )>

What is the question or issue? Your post is evolving …

BTW, unless you are running a very old version of Home Assistant, you should remove entity_id from the Template Sensor’s configuration. It was deprecated many versions ago.

Your template should work (without the entity_id) if you are using a recent version of Home Assistant.

Here’s a version with corrected indentation:


- platform: template
  sensors:
    potenza_generale_totale:
      friendly_name: "Potenza generale totale"
      unit_of_measurement: 'W'
      value_template: '{{ states("sensor.potenza_generale_totale_casa") | float + states("sensor.prism_potenza") | float }}'