[Resolved] Time is NOT between condition


#1

1) Give a description of the problem

I don’t think the piston execution is not paying attention to the time “NOT’ in between range condition

2) What is the expected behaviour?

When the Side Hall Lights switch stays on for longer then 15 minutes

and

we did not arrive home late (Global Variable called @arrive_home_late)

and

 Time is not between 6:30am and 8:30am but only Mon., Tue., Wed., Thr., Fri.,

 Or

 Time is not between 5:00pm and 11:00pm.

Note: for testing I am using Local variables, but these will be changed to Global Variables that I use in other pistons

3) What is happening/not happening?

Regardless of the conditions

Time is not between 6:30am and 8:30am but only Mon., Tue., Wed., Thr., Fri.,

Or

Time is not between 5:00pm and 11:00pm.

the Side Hall Light is turn off after 15 minutes.

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

5) Attach logs after turning logging level to Full

5/6/2020, 7:20:21 AM +668ms

+1ms ╔Received event [Side Hall Light].switch = off with a delay of 98ms

+89ms ║RunTime Analysis CS > 25ms > PS > 38ms > PE > 26ms > CE

+92ms ║Runtime (43914 bytes) successfully initialized in 38ms (v0.3.110.20191009) (89ms)

+92ms ║╔Execution stage started

+102ms ║║Comparison (enum) off stays (string) on = false (1ms)

+103ms ║║Cancelling any timed trigger schedules for condition 2

+104ms ║║Cancelling statement #2’s schedules…

+105ms ║║Cancelling condition #2’s schedules…

+106ms ║║Condition #2 evaluated false (10ms)

+107ms ║║Cancelling condition #1’s schedules…

+108ms ║║Condition group #1 evaluated false (state changed) (11ms)

+110ms ║╚Execution stage complete. (17ms)

+111ms ╚Event processed successfully (110ms)

5/6/2020, 7:20:21 AM +119ms

+0ms ╔Received event [My home].time = 1588764022239 with a delay of -1121ms

+102ms ║RunTime Analysis CS > 28ms > PS > 55ms > PE > 20ms > CE

+105ms ║Runtime (43923 bytes) successfully initialized in 55ms (v0.3.110.20191009) (104ms)

+106ms ║╔Execution stage started

+111ms ║║Cancelling condition #2’s schedules…

+112ms ║║Condition #2 evaluated true (2ms)

+116ms ║║Comparison (boolean) false is (boolean) false = true (1ms)

+118ms ║║Condition #3 evaluated true (4ms)

+133ms ║║Comparison (time) 26421238 is_not_between (time) 23400000 … (time) 30600000 = false (9ms)

+134ms ║║Condition #6 evaluated false (15ms)

+149ms ║║Comparison (time) 26421254 is_not_between (time) 61200000 … (time) 82800000 = true (9ms)

+150ms ║║Time restriction check passed

+152ms ║║Condition #8 evaluated true (16ms)

+153ms ║║Condition group #12 evaluated true (state did not change) (33ms)

+153ms ║║Cancelling condition #1’s schedules…

+154ms ║║Condition group #1 evaluated true (state changed) (44ms)

+157ms ║║Cancelling statement #9’s schedules…

+192ms ║║Executed physical command [Side Hall Light].setLevel([0]) (28ms)

+193ms ║║Executed virtual command [Side Hall Light].fadeLevel (32ms)

+210ms ║║Executed physical command [Side Hall Light].off() (15ms)

+211ms ║║Executed [Side Hall Light].off (17ms)

+214ms ║╚Execution stage complete. (108ms)

+215ms ╚Event processed successfully (2


#2

Well… 7:20am is not between 5pm and 11pm, so your piston did exactly what you programmed it to. Maybe try splitting those two time conditions into indented IFs?

(although you may get lucky changing the “OR” to an “AND” on line 32)


#3

@WCmore thanks for the reply!
My thinking was that 7:20am was been 6:30am and 8:30am the first time condition on a Wednesday… so I couldn’t understand why the light was turn off.

But let me try your “AND” instead of “OR” idea. Then I will try two separate indented ifs.


#4

A good way to look at is that each line is evaluated independently, one by one…

So when it got to this IF block:
pic

… as long as one of the statements were true, then the pistons continues onwards.


Pro Tip:

If you want to use OR without indenting, you can select the inverted times.
(the acceptable times, instead of the NOT times)

IE:

Time is between {LocalMorningLeave} and {LocalEveningOn}
OR
Time is between {LocalEveningOff} and 23:59:59
OR
Time is between 00:00:01 and {LocalWakeup}

#5

Thanks @WCmore this was just a case of me not using my “and” and “or” correctly. I had it in my head this need to be an "or’. Works great now!