Made the switch to storing VA in the datalog instead of pf. Since then, everything has fallen into place. I’ve got a branch working where you can specify units of Amps, VA, pf, Hz, Watts, Volts, kW, kWh and that’s what comes out of the calculator. The values can be used to upload to Emoncms or influxDB or plotted in the local graph. The averages are accurate over any time interval.
The algorithm allows adding and subtracting inputs as before, so if you wanted to know the power factor of your mains with the air-conditioner off, you can subtract the AC from the main in calculator and get the resultant pf. Same with Amps and the others.
Only downside now is that my year old datalog doesn’t have the VA so I can’t look back on it.