Time Piston not Working as Expected


#1

1) Give a description of the problem

I can’t seem to figure out how to use the else function. I’ve read a ton, and tried multiple ways, but I must be doing something wrong. BTW, thanks so much for this awesome app!

2) What is the expected behavior?

I want the piston to recognize when my sleepy routine has run, to look at the time, then press the correct button whether its before or after midnight. Nothing too complicated.

3) What is happening/not happening?

It always seems to push the button under the else section

**4) Post a Green Snapshot of the piston!


#2

I am thinking you need to try an And rather than If on the time check.


#3

So more on the logic of “if routine and before midnight then button 1, else button 2” ?


#4

Yeah, see I’d go the other way with this… I’d get more specific on when “before midnight” actually is. Because if you’re saying that it always falls into the ELSE section then clearly WC is mostly thinking it’s after midnight when this piston runs…but what does that mean to a computer…

If it’s 12:01 AM, that could be considered to be BEFORE midnight on the day that you’re in. See where I’m going…

So maybe make your check look more like this:

IF time is between noon and midnight (or whatever)
Push button 1
else
Push button 2

BTW, if you do the check “is time before midnight” in the Else section there’s no need to ask “is time after midnight” because if it wasn’t you would not have got there. Likewise, if the time IS NOT between the two times you test against then there’s no need to test the opposite times later…as it’s already been proven to be false.


#5

Gotcha! Yeah that makes sense that it’s both before midnight (today) and after midnight (yesterday). I’ll add a between time and see if that works. I was just guessing by adding the time twice - but I didn’t that was needed. I’ll take it out! Thanks so much!


#6

Adding between time made it work. Thanks so much!