Do something unless its between a time on one day


#1

I have a piston setup to perform some actions based upon a door opening but I do not want the piston to run if the door opens between 7-8pm on a Sunday. In the below example I setup a fresh piston with the trigger as a button for easy testing. I can’t figure out why it does not work. If I push the button and its not Sunday between 7-8pm, then it should run, but instead its saying false.

Here is my logic:

  • Not between 7-8pm? - Current time is 9:22pm = TRUE
  • Not Sunday? - Current day is Thursday = TRUE

Instead I think it is reading it this way:

  • Only on Sundays… “wait, the current day is Thursday, so no need to check time” = FALSE.

What I want it to do:

  • If its not between 7-8pm on a Sunday = proceed (True)
  • If it IS between 7-8pm on a Sunday = stop (False)

Is there a way to accomplish what I’m trying to do without having to tell it “Time is (any) only on Mondays, Time is (any) only on Tuesdays…Time is before 7pm on Sundays, Time is after 8pm only on Sundays”


#2

To have total control of the logic, I would split it up… I am thinking something like:

IF button is pushed
Then
   IF $dayOfWeek is 0
      and
      Time is between 7pm and 8pm
   Then
      Log to console "Button pushed, and ignored"
   Else
      Send PUSH "Button pushed any other time - actions go here"
   END IF 
END IF

Note: Nothing can stop the button press from triggering the piston, but your THEN & ELSE blocks can control the actions.


"Define" help needed
#3

Hey, thanks for the super fast reply!
It’s laid out a little different then I’d expect but I gave that a try in my test scenario and it works!
Thanks!


#4

Sure thing! Glad to be able to help.


My logic is, 3 out of 4 possibilities will go to the ELSE block. IE:

True  /  True = THEN block
True  / False = ELSE block
False /  True = ELSE block
False / False = ELSE block