Piston is scheduling next weeks task based upon today Sunset times


#1

1) Give a description of the problem
I have a weekly announcement on my echos that lets my kids know its time to stop using electronics. Its scheduled based upon sunset times. Problem is that it seems to be scheduling next week’s task based upon today’s sunset times
2) What is the expected behaviour?
Once piston is completed it should schedule the task for that particular day’s sunset time, not the day its scheduling the task

**4) Post a Green Snapshot of the piston


5) Attach logs after turning logging level to Full
2/21/2020, 5:18:50 PM +16ms
+1ms ╔Starting piston… (v0.3.110.20191009)
+418ms ║╔Subscribing to devices…
+531ms ║║Subscribing to Echo - Kitchen Echo Show…
+532ms ║║Subscribing to Echo - Leon’s Echo Show Master Bedroom…
+533ms ║╚Finished subscribing (128ms)
+630ms ║Setting up scheduled job for Fri, Feb 21 2020 @ 5:21:00 PM PST (in 129.355s), with 1 more job pending
+645ms ╚Piston successfully started (644ms)
2/21/2020, 5:13:59 PM +64ms
+1ms ╔Received event [Home].time = 1582334040000 with a delay of -936ms
+111ms ║Runtime (38320 bytes) successfully initialized in 35ms (v0.3.110.20191009) (109ms)
+112ms ║╔Execution stage started
+3012ms ║║Executed [Echo - Kitchen Echo Show].setVolumeSpeakAndRestore (2865ms)
+3431ms ║║Executed [Echo - Leon’s Echo Show Master Bedroom].setVolumeSpeakAndRestore (416ms)
+3434ms ║╚Execution stage complete. (3322ms)
+3436ms ║Setting up scheduled job for Sat, Feb 22 2020 @ 6:17:00 PM PST (in 90177.501s), with 1 more job pending
+3446ms ╚Event processed successfully (3446ms)
2/15/2020, 6:10:59 PM +114ms
+0ms ╔Received event [Home].time = 1581819060000 with a delay of -887ms
+103ms ║Runtime (38321 bytes) successfully initialized in 47ms (v0.3.110.20191009) (102ms)
+104ms ║╔Execution stage started
+2368ms ║║Executed [Echo - Kitchen Echo Show].setVolumeSpeakAndRestore (2223ms)
+2371ms ║╚Execution stage complete. (2267ms)
+2373ms ║Setting up scheduled job for Fri, Feb 21 2020 @ 5:14:00 PM PST (in 514978.514s), with 1 more job pending
+2380ms ╚Event processed successfully (2380ms)
2/14/2020, 5:08:59 PM +95ms
+0ms ╔Received event [Home].time = 1581728940000 with a delay of -906ms
+90ms ║Runtime (38319 bytes) successfully initialized in 41ms (v0.3.110.20191009) (89ms)
+91ms ║╔Execution stage started
+3381ms ║║Executed [Echo - Kitchen Echo Show].setVolumeSpeakAndRestore (3252ms)
+3672ms ║║Executed [Echo - Leon’s Echo Show Master Bedroom].setVolumeSpeakAndRestore (289ms)
+3675ms ║╚Execution stage complete. (3585ms)
+3677ms ║Setting up scheduled job for Sat, Feb 15 2020 @ 6:11:00 PM PST (in 90117.229s), with 1 more job pending
+3685ms ╚Event processed successfully (3685ms)
2/8/2020, 6:28:52 PM +253ms
+0ms ╔Starting piston… (v0.3.110.20191009)
+299ms ║╔Subscribing to devices…
+375ms ║║Subscribing to Echo - Kitchen Echo Show…
+377ms ║║Subscribing to Echo - Leon’s Echo Show Master Bedroom…
+378ms ║╚Finished subscribing (85ms)
+472ms ║Setting up scheduled job for Fri, Feb 14 2020 @ 5:09:00 PM PST (in 513607.276s), with 1 more job pending
+485ms ╚Piston successfully started (484ms)
2/8/2020, 6:14:58 PM +65ms
+1ms ╔Received event [Home].time = 1581214499550 with a delay of -1485ms
+72ms ║Runtime (38642 bytes) successfully initialized in 33ms (v0.3.110.20191009) (69ms)
+72ms ║╔Execution stage started
+945ms ║║Executed [Echo - Kitchen Echo Show].doNotDisturbOff (857ms)
+954ms ║╚Execution stage complete. (882ms)
+956ms ║Setting up scheduled job for Fri, Feb 14 2020 @ 5:08:00 PM PST (in 514380.98s), with 1 more job pending
+964ms ╚Event processed successfully (964ms)
2/8/2020, 6:09:59 PM +199ms
+0ms ╔Received event [Home].time = 1581214200000 with a delay of -801ms
+218ms ║Runtime (38642 bytes) successfully initialized in 114ms (v0.3.110.20191009) (217ms)
+219ms ║╔Execution stage started
+346ms ║║Executed [Echo - Kitchen Echo Show].setVolumeSpeakAndRestore (40ms)
+349ms ║║Executed virtual command [Echo - Kitchen Echo Show].wait (0ms)
+350ms ║║Requesting a wake up for Sat, Feb 8 2020 @ 6:14:59 PM PST (in 300.0s)
+355ms ║╚Execution stage complete. (136ms)
+357ms ║Setting up scheduled job for Sat, Feb 8 2020 @ 6:14:59 PM PST (in 299.995s), with 2 more jobs pending
+380ms ╚Event processed successfully (379ms)
2/7/2020, 5:22:59 PM +194ms
+0ms ╔Received event [Home].time = 1581124980185 with a delay of -992ms
+129ms ║Runtime (38641 bytes) successfully initialized in 52ms (v0.3.110.20191009) (128ms)
+130ms ║╔Execution stage started
+1361ms ║║Executed [Echo - Kitchen Echo Show].doNotDisturbOn (818ms)
+2185ms ║║Executed [Echo - Leon’s Echo Show Master Bedroom].doNotDisturbOn (820ms)
+2207ms ║╚Execution stage complete. (2077ms)
+2210ms ║Setting up scheduled job for Sat, Feb 8 2020 @ 6:10:00 PM PST (in 89218.597s), with 1 more job pending
+2218ms ╚Event processed successfully (2217ms)
2/7/2020, 5:07:59 PM +64ms
+0ms ╔Received event [Home].time = 1581124080000 with a delay of -937ms
+141ms ║Runtime (38641 bytes) successfully initialized in 47ms (v0.3.110.20191009) (139ms)
+142ms ║╔Execution stage started
+783ms ║║Executed [Echo - Kitchen Echo Show].setVolumeSpeakAndRestore (584ms)
+1115ms ║║Executed [Echo - Leon’s Echo Show Master Bedroom].setVolumeSpeakAndRestore (330ms)
+1119ms ║║Executed virtual command [Echo - Kitchen Echo Show, Echo - Leon’s Echo Show Master Bedroom].wait (1ms)
+1120ms ║║Requesting a wake up for Fri, Feb 7 2020 @ 5:23:00 PM PST (in 900.0s)
+1126ms ║╚Execution stage complete. (984ms)
+1128ms ║Setting up scheduled job for Fri, Feb 7 2020 @ 5:23:00 PM PST (in 899.994s), with 2 more jobs pending
+1137ms ╚Event processed successfully (1138ms)
2/7/2020, 4:55:27 PM +595ms
+0ms ╔Starting piston… (v0.3.110.20191009)
+448ms ║╔Subscribing to devices…
+577ms ║║Subscribing to Echo - Kitchen Echo Show…
+579ms ║║Subscribing to Echo - Leon’s Echo Show Master Bedroom…
+580ms ║╚Finished subscribing (142ms)
+680ms ║Setting up scheduled job for Fri, Feb 7 2020 @ 5:08:00 PM PST (in 751.726s), with 1 more job pending
+697ms ╚Piston successfully started (697ms)
2/1/2020, 5:56:59 PM +72ms
+0ms ╔Received event [Home].time = 1580608620000 with a delay of -929ms
+84ms ║Runtime (38320 bytes) successfully initialized in 42ms (v0.3.110.20191009) (82ms)
+85ms ║╔Execution stage started
+122ms ║╚Execution stage complete. (38ms)
+124ms ║Setting up scheduled job for Fri, Feb 7 2020 @ 5:01:00 PM PST (in 515040.805s), with 1 more job pending
+131ms ╚Event processed successfully (130ms)
1/31/2020, 4:53:59 PM +135ms
+0ms ╔Received event [Home].time = 1580518440000 with a delay of -865ms
+218ms ║Runtime (38320 bytes) successfully initialized in 87ms (v0.3.110.20191009) (217ms)
+220ms ║╔Execution stage started
+258ms ║╚Execution stage complete. (38ms)
+259ms ║Setting up scheduled job for Sat, Feb 1 2020 @ 5:57:00 PM PST (in 90180.606s), with 1 more job pending
+274ms ╚Event processed successfully (274ms)


#2

I was just having this conversation in another thread…

WebCoRE schedules a wakeup based on the data it has at that moment.

This means that since this piston only runs on Friday and Saturday, that it will always be approximately 10 minutes off for Friday’s event. (and about a minute or two off for Saturday)


What I would do is stick a small block at the bottom of that piston:

Every Friday at 4am
    do (nothing)
END EVERY

This forces it to run prior to the real event, which will update the scheduled time to Friday’s sunset.
(but won’t actually do anything at 4am)


Pro Tip:

If the 90 seconds inaccuracy bothers you for Saturday, you can add a second block to the bottom:

Every Saturday at 4am
    do (nothing)
END EVERY

#3

On an unrelated note, I am very curious to see if the younger generation can go without electronics for 25 hours a week! (most cannot go 25 minutes, LOL)

Your goal sounds monumental, but I wish you the best!!


#4

On a related note, I love the meta-irony of using electronics to remind us to turn off the electronics!! :arrows_counterclockwise:


#5

:joy::joy::rofl::rofl::rofl::joy::joy::joy:


#7

This is the height of irony! :joy::rofl::joy:
I will test it today and let you know. Thanks for the tip!