Emontx V3 PV relay for ASHP

I have almost finished an adaptaion of Emontx V3.4 with output to relay to control an ASHP.
In a nutshell…
CT clamp on PV, house import/export & heat pump.
Dip switched used to change start threshold
Output to relay using ADC5/dig19 that was DS18b20 power.
4 to 6 DS18b20 temperature sensors

The idea is to monitor the system, and to start/encourage the ASHP when there is PV export.
To measure the benefit, I want to send an on-going value that is a measure of ‘net worth’ .
e.g. %age of PV energy ‘grabbed’ by the HP compared to HP on mains. I tried a few things, but realise it is well beyong my mathematical ability.
Any suggestions?
I am already sending values for; ‘PV used directly in house’ (as opposed to exported), and ‘PV used by HP’, but I was looking for %age number. Should it be %PV (compared to total PV) going to HP? or %age HP power from PV compared to total HP input. Cannot get my head around it.

DiscreteSamplesForASHP.ino (29.0 KB)