Hi @snowbird,
As lame as it may seem, the overall ambient temperature control is far more complicated. I shared these lines of code hoping someone will get in the same “boat”.
PID control is not something new, nor easy to understand!
So, please understand that I am willing to share knowledge, but not doing your homework! Thus said, please check the following links:
Not the best insight knowledge, but a very good start!,
then this one, with the enclosed not so very bright (but working!) initial contribution!
So, fair and square, if you want to switch a valve on and off, my topic is not for you. If you want to send some commands to devices that can handle the basic control (below 1-200ms), then you just hit the jackpot!
BR,
George