I installed a new pool solar (water) heating system a few years ago. It's got electronic controls for when to send the water up based on temperature etc. It has an integrated cooling mode, which does exactly what you described. Not useful for my location but I've learned in more warm climates it can be quiet a problem.