Ball valves hot tub controller - ESPhome

I have a system comprised of 2 ball valves, one for hot water, another for cold water. I want to control the water temperature going to a hot tub. Both valves have end signals - i.e. when fully turned on or fully turned off a pin is pulled to GND. Otherwise they are pulled up to VCC.
I have 2 outputs per valve to turn the valve on or off. I can pulse those outputs to make minor adjustments either way on both valves.
There’s a ds18b20 sensor on the combined output of the ball valves to monitor temperature.
When the system is off I want both valves turned completely off, i.e. off signal on both valves.
When the system is on optimally I want one valve to be fully open (f.e. hot water should have on signal) and the other one is pulsed up or down to reach desired set temperature. In my case I know that hot is always wide open, but cold needs modulation.
It’s important to make sure when one valve is fully open or closed, it won’t be trying to open or close it more - maybe a lambda on switch.turn_on and turn_off?

So to my question: How would you design this system in esphome? Could the thermostat component be tweaked with a few lambdas or would it be more effective to just write a C++ component for this?

Maybe something other than esphome would be more effective? I’m open to ideas.

I’m sure that this is possible but how well it works, I’m interested to see. I recently needed a hot water mixing valve, I figured that I’d get something digital and connect it to HA.

No go, pre made units were thousands and the speed at which it needs to react (to prevent scalding) was not feasible to build. Just some food for thought you maybe better off with a mechanical mixing valve with a stepper motor to adjust the temp.