"Only on these days of the week..." not working in piston!


#1

1) Give a description of the problem
I am trying to create a piston that resets a simulated switch I have set up for when my kids have school or not.

2) What is the expected behavior?
The piston executes only on Sunday at 7pm or on Friday at 7pm and speaks the text inputted.

3) What is happening/not happening?
Both pistons seem to be firing at 7pm no matter what day it is.

**4) Post a Green Snapshot of the piston


#2

try using a timer block instead of the IF block


#3

I did a quick test and ‘only if’ worked for me. One with correct day and one with incorrect day.


#4

When you say firing no matter what day it is… Do you mean the timer counts down so you can see it’s going to execute every day at 7pm, or it’s setting the switch and speaking the text every day at 7pm?


#5

Depending on the answer to this, I have a related fix that may clarify what is happening. That fix has been withheld from a few releases until we can test any other effects it may have on scheduling, but it would ensure that the next scheduled wakeup of the Piston respects your restrictions. Currently it wakes up daily but should only drop into the if actions on your specified days.


#6

Hmm. That’s weird. This is the first time I’ve used that logic in a piston. I tried recreating the piston from scratch a couple times and it wouldn’t execute only on the day wanted.


#7

Both. The timer is counting down to the next scheduled event, which in this case is today at 7pm.


#8

I didn’t think of that approach. Thank you! I will go with that if @ipaterson fix doesn’t do the trick.


#9

Do you know when this may be pushed in an update? Or do I need to go with @jkp suggestion for now?


#10

I recommend using a different approach for now, it will be awhile before that makes its way into a release.


#11

Can you turn logging on full, let the piston (original one you posted) run at 7pm tonight, and post the results?

Even with the timer triggering the piston at 7pm every day, the IF conditions you have should prevent it from executing further. It’d be interesting to see how that’s being skipped over - can come up with a few solutions then too.


#12

Okay, thank you!


#13

Will do. Thanks for the help!


#14

1/17/2018, 6:59:59 PM +126ms
+0ms ╔Received event [Ziegler House].time = 1516237200000 with a delay of -875ms
+94ms ║RunTime Analysis CS > 16ms > PS > 50ms > PE > 28ms > CE
+96ms ║Runtime (37794 bytes) successfully initialized in 50ms (v0.2.102.20180116) (95ms)
+97ms ║╔Execution stage started
+106ms ║║Comparison (time) 68399230 happens_daily_at (time) 68400000 = true (0ms)
+107ms ║║Time restriction check failed
+109ms ║║Condition #4 evaluated false (5ms)
+110ms ║║Cancelling statement #4’s schedules…
+113ms ║║Requesting time schedule wake up at Thu, Jan 18 2018 @ 7:00:00 PM CST
+116ms ║║Condition group #1 evaluated false (state did not change) (13ms)
+121ms ║║Comparison (time) 68399245 happens_daily_at (time) 68400000 = false (0ms)
+123ms ║║Condition #8 evaluated false (3ms)
+124ms ║║Cancelling statement #8’s schedules…
+127ms ║║Requesting time schedule wake up at Thu, Jan 18 2018 @ 7:00:00 PM CST
+129ms ║║Condition group #5 evaluated false (state did not change) (10ms)
+132ms ║╚Execution stage complete. (35ms)
+134ms ║Setting up scheduled job for Thu, Jan 18 2018 @ 7:00:00 PM CST (in 86400.741s), with 1 more job pending
+140ms ╚Event processed successfully (140ms)

I believe it worked and successfully executed!


#15

Yes, if that’s your original piston that’s what I’d expect to see when it ran at 7pm, confirmed it’s NOT Friday or Sunday, then set a timer for itself to wake up at 7pm tomorrow.

It’s working the way you want it to. :slight_smile: