Photovoltaic Feed In Calculation from values of Energy Meter

Hello everyone,

this is my first topic, so I hope to not mess it up:

Setup:

  • I have a Aeotec Home Energy Meter Gen 5 installed in my main breaker box. As I have a 3-Phase System, I measure L1, L2 and L3 right at the meter. (Sensors: “Home Energy Meter - Gen5: Electric Consumed [W]” and “Home Energy Meter - Gen5: Electric Consumed [kWh]” show the relevant data)

  • Photovoltaic Solar inverter (SMA STP 5000TL-20) is reporting generated AC Watts and kWh through modbus TCP to Home Assistant (Sensor: “SMA Power AC” in Watts and “SMA Daily Yield” in kWh)

All sensors work flawlessly and I have been able to integrate the sensory output through influxDB to grafana.

My problem is that the HEM shows negative values for feed-in energy, which I feed into the grid – the orientation of the AC clamps is correct).

Is there a simple way to sum up the positive values (bought kWh from the grid) and the negative values (feed-in kWh – for which I receive a feed-in-tariff)? I looked into template sensors, and they seem the way to go?

Thank you, best wishes and greetings from Germany :slight_smile: