FYI, as per the instructions in the topic window, that you needed to erase to post this
… when pasting code here, please follow the required formatting instructions… I edited your post to correct it.
As for your question… is is more programming 101 then Blunk specific.
Search this forum for keywords like thermostat, etc… as you will find many other topics and examples on various ways of regulating values.
NOTE: A BLYNK_WRITE() function is called only when the corresponding Widget is used… so you need to have your temperature checks and relay controls separate. from the slider function so that the temp value controls the relay, based on the slider, not controlled by the slider.