Energy dashboard - Strange cost calculation

Hi and happy new year!

Since a couple of days, the calculation of the costs linked with the energy dashboard is doing strange things… The strange behavior has started after I change the way I import my inverter data in HA… Calculation of the energy used, produced and sold (all in kwh) is ok but the costs are totally wrong as soon as I start to sell to the grid my production not used in my house…

Example from today :
At 7am
Production : 0 kWh
From grid : 4.0 kWh (cost = 0.69 CHF) => correct at 0.17 CHF/kWh
Sold to grid : 0 kWh
At 8 am
Production : 0 kWh
From grid : 4.38 kWh (cost = 0.76 CHF) => correct at 0.17 CHF/kWh
Sold to grid : 0 kWh
At 9 am (I have sold a small part of the production)
Production : 0.39 kWh
From grid : 4.60 kWh (cost = 682.17 CHF) => NOT correct at 0.17 CHF/kWh
Sold to grid : -0.01 kWh (gain = CHF -402.31) which is not possible as I sell at 0.07 CHF/kWh
At 10 am
Production : 1.23 kWh
From grid : 4.61 kWh (cost = 682.67 CHF) => NOT correct at 0.17 CHF/kWh
Sold to grid : -0.32 kWh (gain = CHF -402.33)

It means that the issue starts as soon as I sell to the grid (the 1st hour being at 9am today). The following hour (ie 10am), costs are wrong in absolute terms but if we subtract numbers from 9am to 10am, it looks correct => I have sold to grid -0.32kWh for CHF 0.02 (CHF 402.33 - CHF 402.31) which is correct as I sell to the grid for CHF 0.07/kWh.

It is really strange as energy produced, consumed, bought and sold (all in kWh) is ok.

Any idea of my problem ? Thx in advance.