It’s that bit there that needs to go positive for it to switch on. You should see the calculations every so often for how its getting that number which looks like:
> 2023-05-05 15:27:48.758 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] PV Excess (PV Power - Load Power) History: [-382.1, -1567.1, -1520.1, -555.1, -43.1, 5.899999999999999, 35.9, 71.9, 120.9, 189.9, 156.9, 224.9, 249.9, 329.9, 444.9, 472.9, 752.9, 566.9, 646.9, 1350.9, 1548.9, 1657.9, 1654.9, 1659.9, 1696.9, 1705.9, 1709.9, 1712.9, 1042.9, 1719.9, 1721.9, 1681.9, 1633.9, 1627.9, 1633.9, 1653.9, 1681.9, 1714.9, 1673.9, 1797.9, 1721.9, 1693.9, 1560.0, 510.0, 730.0, 1854.0, 1486.0, 298.0, 564.0, 62.0, -10.0, -50.0, -22.0, 28.0, 53.0, 1326.0, 662.0, -124, -284, -285]