Time Condition Comes up as False when its not


#1

1) Give a description of the problem
Trying to add some holiday programming into my lighting. wrote the restrictions for if it was a holiday, and also for when it was not. For some reason it keeps assess the seemingly true restriction as false. Why?

2) What is the expected behaviour?
would like it to go through all the options of holiday lighting before settling on standard change otherwise

3) What is happening/not happening?
it is not doing the last (actual) action due to assessing the condition as false but its opposing condition earlier in the code is also assessed as false. Specifically condition #39 in condition group #38 versus its opposing condition #30

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

5) Attach logs after turning logging level to Full
11/5/2019, 5:56:15 PM +399ms
+2ms â•”Received event [Kitchen Motion Sensor].motion = active with a delay of 120ms
+107ms â•‘RunTime Analysis CS > 24ms > PS > 58ms > PE > 25ms > CE
+110ms â•‘Runtime (47785 bytes) successfully initialized in 58ms (v0.3.110.20191009) (107ms)
+111ms â•‘â•”Execution stage started
+121ms â•‘â•‘Comparison (string) :3f114d0b1da6aacabdf243a32a954c58: is_any_of (string) :7eedad3a0537521db57c95377480e0f1:,:37a713eb5d9b2033e116d6ab31053ef8:,:3f114d0b1da6aacabdf243a32a954c58: = true (3ms)
+123ms â•‘â•‘Condition #24 evaluated true (6ms)
+124ms ║║Cancelling condition #1’s schedules…
+125ms â•‘â•‘Condition group #1 evaluated true (state changed) (9ms)
+132ms â•‘â•‘Comparison (enum) active changes_to (string) active = true (1ms)
+133ms ║║Cancelling condition #12’s schedules…
+134ms â•‘â•‘Condition #12 evaluated true (8ms)
+135ms â•‘â•‘Condition group #1 evaluated true (state did not change) (9ms)
+149ms ║║Comparison (time) 64575537 is_between (time) 0 … (time) 43200000 = false (8ms)
+151ms â•‘â•‘Condition #30 evaluated false (12ms)
+152ms â•‘â•‘Condition group #29 evaluated false (state did not change) (15ms)
+166ms ║║Comparison (time) 64575554 is_between (time) 0 … (time) 43200000 = false (9ms)
+168ms â•‘â•‘Condition #32 evaluated false (12ms)
+169ms â•‘â•‘Condition group #31 evaluated false (state did not change) (15ms)
+183ms ║║Comparison (time) 64575571 is_not_between (time) 0 … (time) 43200000 = true (9ms)
+198ms â•‘â•‘Time restriction check failed
+200ms â•‘â•‘Condition #39 evaluated false (27ms)
+212ms ║║Comparison (time) 64575600 is_not_between (time) 0 … (time) 43200000 = true (8ms)
+213ms â•‘â•‘Time restriction check failed
+215ms â•‘â•‘Condition #40 evaluated false (14ms)
+217ms â•‘â•‘Condition group #38 evaluated false (state did not change) (44ms)
+225ms â•‘â•‘Comparison (enum) active changes_to (string) inactive = false (1ms)
+227ms ║║Cancelling condition #9’s schedules…
+228ms â•‘â•‘Condition #9 evaluated false (8ms)
+229ms ║║Cancelling condition #20’s schedules…
+230ms â•‘â•‘Condition group #20 evaluated false (state changed) (10ms)
+233ms â•‘â•šExecution stage complete. (122ms)
+234ms â•šEvent processed successfully (234ms)


#2

Just checking… you only want the piston to run midnight to noon on October 31st and December? :slight_smile:


#3

Blah!! Stupid oversight on my part there! So I will fix that to be correct times, after noon of course. That being said in my experimentation with it I was using some global variables that were well into the evening and it still was not working. With the correction of the time here, do you see any other reason why this should not work just on the face and syntax of it?


#4

Looks OK.


#5

Copy that, once back home I’ll retest it and come back to this. Thanks!


#6

But I will clarify and say it depends on time frames you are using…


#7

Understood, set it for between 12am and 12am.

Another question, could I forego the time window and just have the actions based on just 31st of October or just in december? The only reason I am using the time window is because thats how I found my way to those specific restrictions


#8

That is the time frame I thought you wanted. Now your third If block will not work as expected.


#9

can you please elaborate on that?


#10

if your first two IF blocks are time is between the entire day then the third IF block can not use time is not between


#11

Thinking about this though my original thought pattern made sense in my head.

If it is between 12am and 12am but only on oct 31st do IF #1,

If it is not between 12am and 12am but only on oct 31st do If #3.

So on oct 31st, If #1 would be true, on any other day If #3 would be true.

Or am I missing/misunderstanding something?

edit #toomany, I think i am starting to sense the issue for the #3 IF. So how would I tell that If block to not run against that #1 if block?


#12

I am fumbling with my explanation :slight_smile:

Your first two blocks are saying time is between midnight to midnight which means there can be no block of time that is outside of that block (or not between) that is available to use.


#13

Its all good! I greatly appreciate the help! So here is my solution to this then. Remove the two restrictive blocks and leave IF #3 without any time restrictions. This brings it back to basic operation that I am currently running (and works) anyway.

Beyond that if block, put 2x following If blocks in with a timer past initial action to adjust the color to the holiday.

So in other words trigger it as usual, but then revert to a different holiday color if it is any of those days.

Something like this, however I would have to check to see how this would work in real life since it would recall the original color first and then change it if applicable. Might be annoying in real life.


#14

Just brainstorming here. Going back to the original piston i posted (with times corrected).

On IF block #3 what if I remove the time/day restrictions and instead place the restriction assessing whether the light is already on or not.

So if on any of those days in IF #1 and #2 it would turn on, otherwise when it gets to block #3 and the light is still off it would turn on…

like this :slight_smile:


#15

Your IF block is empty…

temp

Why not drop the ONLY WHEN (line 60 & 61), and add that logic to the empty IF block?


IE:

IF {DevicesToControl}'s switch is off
Then
    Do stuff...
END IF

#16

I’m down with that cause

Ended up like this

I have a good feeling about this.

PS. there are a good number of threads about holiday lighting but of course I had to try and do it my own way. Thanks to everyone so far and who has yet to help!


#17

Good morning all! Final piston worked great once I turned it on last night! Made a few house keeping changes to piston state and such but otherwise here is the final working example for future references! Thanks all!