Solar - Keeping track of Net metering with+ home assistant

Hey all!!

How do you guys deal with net metering on your home assistant solar installation?
I have the need to set up 15min and 60min net metering for two locations.

I was thinking in setting up a counter just after the meter, that would auto-reset at the start of each period to better keep track of the energy balance. This would also allow me to turn on some loads if there was a positive balance just before the end of the period.

I don’t see many meters that can count bi-directional, and when they do - they don’t seem to roll back to keep track of absolute energy. So I was wondering what others are using here?

Thanks!