Help using Relays with greenhouse

Jay_Swan:
The program compiles well but as I have said the reading I want is for every 5 seconds and it takes at every moment... My relays are jumping in and out of state change...

It is very well possible that it compiles; but it will not do what you expect it to do. As cattledog pointed out (and I tried to point out in reply #15), your logic is a little flawed. Please have a look at reply #15 again and spot the differences between your code in reply #14 and my code in reply #7.

PS
Your code in reply #20 is not complete.