I have been trying to find a solution to combine 2 values in a template sensor and still make the outcome available to my energy dashboard.
Situation is that I have a Growatt installation that recently was expanded with batteries. I purchased the 10kWh offering but now I get 2 sensors for battery_energy_in in my Home Assistant application amd only 1 for battery_energy_out and when I use both in the energy dashboard, it requires me to use the out value twice… resulting in an incorrect (double value) there.
See the 12 kWh value vs the actual 6.3 kWh value that was loaded into my batteries.
I am trying to create a template now with this but it will not become visible to add to teh energy dashboard and all I read about adding a state_class: to the sensor is no longer supported.
Is there an alternative way?
- platform: template
sensors:
electricity_batteryinject_total:
friendly_name: 'Batterij input totaal'
entity_id:
- sensor.thuis_batterij_lifetime_total_energy_input_1
- sensor.thuis_batterij_lifetime_total_energy_input_2
value_template: "{{ (states('sensor.thuis_batterij_lifetime_total_energy_input_1')|float + states('sensor.thuis_batterij_lifetime_total_energy_input_2')|float)| abs | round(2) }}"
unit_of_measurement: "kWh"
device_class: energy