Good day everyone… I’m try to do a template that measure the charge of a battery measuring the difference betwin the KWH ingoing and the kwh outgoing, but i have always error report from HA (states.sensor.energy_meter_1_energia - states.sensor.inv_gar_out_energia) = Battery_Garage_KWH
Can you please check this code for me? Or translate in new standards?
# Calculated Value Sensor : Battery_Garage_KWH
- platform: template
sensors:
Battery_Garage_KWH2:
entity_id:
- sensor.energy_meter_1_energia
- sensor.inv_gar_out_energia
value_template: =
{set BatGarIn2 = states.sensor.energy_meter_1_energia.state| float }
{set BatGarOut2 = states.sensor.inv_gar_out_energia.state| float }
{{ (BatGarIn2 - BatGarOut2)|round(1) }}
Tnx
Best regards.