Home Assistant is adding energy generated from the grid plus energy from solar panels

I just installed a power meter in my house and it is measuring correctly.

I have solar panels installed in another location that I access via Growatt integration.

The Home Assistant should subtract the solar production from the grid consumption, but the opposite is happening and the HA shows as if I were consuming more than 105kWh!

How can I fix that?

You need a meter to record export. I believe that the grid reading needs to be positive for consumption and negative for export.

Potentially a template sensor, that does something like:

{% set g = states('sensor.grid_power')|float(0) %}
{% set s = states('sensor.solar_production')|float(0) %}
{% if (s-g) > 0 %}
  -{{ (s-g) }}
{% else %}
  {{ g }}
{% endif %}

So if the grid - solar, is still a positive value, then you are exporting the excess solar - so output a negative value -(grid - solar) otherwise just output grid consumption unchanged.

You would then use the Riemann sum integral integration ( Integration - Riemann sum integral - Home Assistant ) and use that instead of the Grid meter you are feeding the dashboard now.

1 Like

Thanks a lot