PID Control with Limit // PV

Hi Guys,
i want to do a Controller to heat my water with PV Energy when there is an "overflow". I grab the Data from my main meter and convert it to these numbers shown in the pictures.
My Problem is, that i got low numbers in the night (under 50) because the PV doesnt produce any Power. So my PID Controller is running away with very high numbers (200,300...) (Right now i only simulate it and use the values: P=1, I=0.5 D=0). Is there maybe any solution to code a PID Controller in javascript and do something like a limit to the top and bottom? (sorry i dont have any coding experience)
A workaround for me would be a periodical reset but thats not the nicest Solution....
Do you have any tipps? Thanks

Use a PID node that has integral lock to prevent the runaway from happening. node-red-contrib-pid for example.