Computation of self-sufficiency/autarkie and self-usage of PV

Hello HA-world,

I wonder why I get slightly different results between my self-computation of self-sufficiency and self-use with respect to the energy dashboard. The difference is just 2-3% mostly, but I would like to understand where this is coming from.

Example:
These are my results for today:
Dashboard

I could not find clear instructions on the parametrization of the dashboard, but I applied the following:
From grid: energy taken from the grid, as reported by the optical sensor on my appartment power meter provided that the reading is positive

To grid: my smart meter sadly does not provide this statistics on its own, so I defined a helper which integrates the power always when the reading is negative

solar: energy generated per day as reported by the smart plug of the balcony power generation module

Definition screenshot:

I defined the following template sensors to compute the self-sufficiency and pv self-usage:

The result in the following data:
OwnComputation

Can someone explain the difference (28.36% vs 27% and 56.31% vs 54%) to me?

I have the feeling that this may be due to some tiny differences in for example integration of power to energy vs usage of absolute values (the dashboard receives the daily absolute PV production, whereas in the sensor definition I am for example setting the absolute PV as self-used + put into grid, which are both derived from power and integration).

OK, so it seems this was easy. Still I think it is good to have this documented.
I used the sensor which tracks the self-used pv energy. However i figured that the energy dashboard needs to compute this value from the total produced PV energy and the energy fed into the grid.
Adapting the sensor as follows:


hence leads to:
NewOut
which considering rounding is exactly what’s shown on the energy dashboard.