Volatile values because power from two Shelly 3EMs are not delivered exactly synchronously

I have two Shelly 3EM.
The 1st one is directly behind the meter and thus represents the entire flow of electricity into the house and from the house into the grid.
The second one is directly behind the inverter and measures the PV power generated.
I calculate my house consumption from the two values.

The two values ​​are probably not updated 100% synchronously. This creates a very strange picture on a changeable day with wispy clouds.

One moment the house consumption shoots up to over 5,000 W and the next moment it drops to 0 W (negative values, the formula does not calculate). This happens all the time as soon as clouds move over the PV system.

Does anyone have an idea how to avoid or solve this?