For instructions see the script
This script is beta only.
No guarantee if it will work correctly.
I will keep improving it in the future.
One example how the script works.
From 10am it startet charging only from the pv.
The yellow graph is PV energy, the purple graph is the charging power.
Adjust the constants in script according to the comments.
Then enter your custom datapoints for energy and to enable the pv charging
Here are some examples for this datapoints
Set ChargeStopDelayTime to a higher value if your charger turns on and off its internal relay many times during a cloudy day. Default value is 10 seconds