although in the serial monitor show “Failed to read from DHT sensor” , the gauge widget in blynk are showing the temp and humid value correctly. When I slide the slider value below room temp, the relay ON and slide value above room temp the relay went OFF.
p/s: i detected another problem. When put the setpoint into 30 and the room temp went from 29 to 33 (i put at my laptop fan to heat it up), the relay did went ON but when the relay wont went OFF although the room temp went below the setpoint.
I coded it that way based on your OP request for slider setting of setpoint. As you have found the sketch is not very practical and needs to be expanded.
From what you have hopefully learnt so far how would you go about resolving this issue?
You don’t have to provide code, just a possible way of implementing a “fix”.
You don’t want the relay going on and off repeatedly when the temperature is around setpoint.
Personally I don’t like code that repeatedly turns a relay on when it’s already on or off when it’s already off. I guess practically this is not really a problem but it’s bad form to repeat a process that’s not actually required.
You need to be thinking about additional timed functions to decide what state the relay should be at, but not at 2 to 5 second intervals.