Question on auto-consumption value in energy bashboard

Hello,

I recently installed HA and a shelly 3EM coupled with the integration of my SMA solar pannels controler.

I firstly tried to include the 3 phases values from the shelly 3EM (from the grid) in the energy panel but I quickly add a entity template to sum the 3 energy values from the grid.

It’s working fine but the auto consumption is not correctly calculated.
Why the orange bar is not covering all the blue one ?

Do you have any idea to solve that ?

I found the origin of my problem.
The shelly 3EM is giving the info for the energy consumed and for the energy injected to the grid, not just the delta of it.

from the main home energy meter point of view, this is not correct because I’ve only injected 2kWh to the grid and consumed 0.

Do you have an idea how to solve that ?

thanks