I have a piston that turns on my outside lights at a random time within 15 minutes of sunset. Sometimes, when it runs, I get multiple push notifications for the event. I have it set to send them just once. Any ideas why I’m getting multiple?
Why am I getting repeat push notifications?
Logs from when it happens?
My best guess would be that your random time is happening again inside the window of the last.
11/30/2017, 7:32:59 AM +145ms
+1ms ╔Received event [Home].time = 1512045180000 with a delay of -855ms
+891ms ║Setting up scheduled job for Thu, Nov 30 2017 @ 5:05:00 PM EST (in 34319.964s)
+909ms ╚Event processed successfully (909ms)
11/29/2017, 5:06:59 PM +183ms
+1ms ╔Received event [Home].time = 1511993220000 with a delay of -817ms
+348ms ║Setting up scheduled job for Thu, Nov 30 2017 @ 7:33:00 AM EST (in 51960.47s), with 2 more jobs pending
+367ms ╚Event processed successfully (367ms)
11/29/2017, 4:55:59 PM +103ms
+0ms ╔Received event [Home].time = 1511992560000 with a delay of -898ms
+260ms ║Setting up scheduled job for Wed, Nov 29 2017 @ 5:07:00 PM EST (in 660.637s), with 2 more jobs pending
+277ms ╚Event processed successfully (278ms)
11/29/2017, 7:31:59 AM +120ms
+0ms ╔Received event [Home].time = 1511958720000 with a delay of -881ms
+915ms ║Setting up scheduled job for Wed, Nov 29 2017 @ 4:56:00 PM EST (in 33839.965s)
+935ms ╚Event processed successfully (934ms)
Any idea why? Webcore is a little bit of a puzzle for me, as far as the nitty gritty goes.
Each time this piston wakes up it will schedule the next wakeup. On Nov 29th it was scheduled to run at 4:56:00 PM. Let’s say that was 15 minutes before sunset. When it wakes up at 4:56 PM it schedules the next task, which random
determines will happen at 4 minutes before sunset.
Since “4 minutes before sunset” hadn’t happened yet that day it scheduled the next run for 11 minutes later at 5:07 PM. However, it still runs through the whole piston at 4:56 PM so at 5:07 PM you get a duplicate notification.
@c1arkbar do you know of a good workaround for this? Nothing came to mind other than something aloong the lines of setting a variable and clearing at midnight.
Add a condition that the switch is off. Then it shouldn’t run after the first time. @bwarman
@c1arkbar adding the switch off condition unfortunately made it so that my lights did not turn off at sunrise. It seems to have cancelled the whole event, after the first fire. I added the condition to the if statement.
Is there no way to make it so that the piston only runs once, but runs the whole thing? My logic would say that a variable would have the same result as the switch off condition.
I have a few pistons like this that I only want to run one time.
Create variable LastDay (integer) and use that as part of your IF statement: