Machine Learning to Control heating based on temp sensors

I am trying to find an optimal formula to control my heatpump to get a specific temperate based on outdoor temp and maybe forecast…

I have a long history to train on…

Has anyone done something similar?