I have a special usb cable connected between the p1 port of our home energy meter and my RPI which runs Home Assistant. I use the DSMR integration in HA to readout values in Home Assistant.
I use the consumption/production sensors created by the DSMR integration to populate the energy view.
With this setup I normally get a nice overview of my production, consumption and how much I used from / pushed into the grid.
Because when your energy sensor disconnects or becomes unavailable it reports 0 instead of unavailable. Then when it reconnects there’s a massive jump from 0 to whatever your energy running total is.
You can filter the sensor. Here’s how I did it for my SMA Inverter:
I created below “stabilised” sensors according your suggestions and replaced them in my energy dashboard. The stabilised sensors are based on the original sensors.