About the STPM32 metering chip. In your document UM2092 you refer to a source file called handler_metrology.c, but in the firmware package (en.stsw-stpm002.zip) there is no such file. I also don't find it on Github.
I believe most related materials are either covered by an NDA or SLA, you'll need to request via your local sales office or FAE assigned to your account.
Tips, Buy me a coffee, or three.. PayPalVenmo Up vote any posts that you find helpful, it shows what's working..