Temp sensor & an outlet
Thants Guys
I used WCmore’s example
I hope I got it right.
I dont understand how Motion Sensor 4 will work outside of the time 4pm to 3.59am
is it not part of the if
Every time the temperature changes (top trigger
), the entire piston runs top to bottom, and executes any code allowed by your other conditions
.
Essentially, the ELSE block covers the time range outside of line 21
(Nice job on nesting, @nursenikki… Most newbies would have had trouble with those indents)
I noticed one small issue with your last piston, so I inverted the time below…
I try to avoid spanning across midnight, since it sometimes yields strange results. The following (inverted code) should cover each 12 hour block more reliably. (with added comments to assist)
Thanks Ill give it a try tonight.
Is there a web article something that tells me how to use the IF, THEN, and the others
Nicole
This forum and the Wiki
are the best places for learning.
Here are some of my favorite links.
Something you might want to address.
If the temp is 62 just before the 4:00AM transition the switch would be on, because you are outside of the time constraint so it is running the ELSE statement, temp<63. Then at 3:59AM you want it turn off because now it is greater than 60. However, it will not run again until the temp changes, so as long as the temp remains at 62 the switch will remain on. The same could happen at the 4:00 pm transition.
You could add a time trigger at 4AM and 4PM to check temp.
Yes, I thought of that @Terminal, but since temperatures change so frequently, (especially since this is connected to a space heater)… I figured the extra code was not worth it… It would “fix itself” as soon as the next reading changed.
Pro Tip:
I usually code temperature logic on a sliding scale… So the temp adjusts throughout the day based on my parameters… But this one requires a bunch of math, and a lot of foresight.
Yeah you are right I was just looking at the code and really didn’t think about its function, being a space heater, it will be changing and as you said it will shut off shortly.