The code looks OK. What values are displayed for "Temperature for the device 1 is: "?
The values i think that are correct...initially i test my room temperature, and the values are about 21°C .
The serial monitor show me this:
Temperature for the device 1 is: 21.37
Temperature for the device 1 is: 21.44
So the code as you say is correct...now i dont understand if i write the if condition like that my switch magically work well.. its strange isn't it?
Working code (like blink example):