btw, this could also be a ST issue:
Well that’s interesting…all I did was change the time condition so it was true a few minutes into the future and when the time triggered, we both got just one notification! So this seems to be an issue with the sunrise - 180 minutes condition I will change the logic back and keep full logging enabled and see what happens overnight. Here is the log:
OK so with the logic changed back to switch the light off 180 minutes before sunrise, we both got the double notifications again. Here is the log:
12/09/2017, 03:31:59 +99ms
+1ms ╔Received event [Home].time = 1505183520000 with a delay of -902ms
+131ms ║RunTime Analysis CS > 24ms > PS > 59ms > PE > 48ms > CE
+143ms ║Runtime (37418 bytes) successfully initialized in 59ms (v0.2.0e7.20170906) (140ms)
+144ms ║╔Execution stage started
+184ms ║║Comparison (time) 12719255 happens_daily_at (time) 1505240700000 = false (1ms)
+187ms ║║Condition #6 evaluated false (30ms)
+188ms ║║Cancelling statement #6’s schedules…
+196ms ║║Requesting time schedule wake up at Tue, Sep 12 2017 @ 7:40:00 PM BST
+200ms ║║Condition group #1 evaluated false (state did not change) (45ms)
+212ms ║║Comparison (time) 12719306 happens_daily_at (time) 1505194320000 = true (1ms)
+213ms ║║Time restriction check passed
+215ms ║║Condition #21 evaluated true (9ms)
+217ms ║║Cancelling statement #21’s schedules…
+225ms ║║Requesting time schedule wake up at Wed, Sep 13 2017 @ 3:32:00 AM BST
+230ms ║║Condition group #17 evaluated true (state did not change) (25ms)
+234ms ║║Cancelling statement #18’s schedules…
+241ms ║║Skipped execution of physical command [218 Light].off() because it would make no change to the device. (3ms)
+242ms ║║Executed [218 Light].off (5ms)
+251ms ║║Calculating (string) Home + (string) Switched Off At Sunrise >> (string) Home Switched Off At Sunrise
+297ms ║║Executed virtual command [218 Light].sendNotificationToContacts (37ms)
+303ms ║╚Execution stage complete. (159ms)
+305ms ║Setting up scheduled job for Tue, Sep 12 2017 @ 7:40:00 PM BST (in 58080.597s), with 1 more job pending
+321ms ╚Event processed successfully (321ms)
12/09/2017, 03:29:59 +136ms
+1ms ╔Received event [Home].time = 1505183400000 with a delay of -864ms
+231ms ║RunTime Analysis CS > 19ms > PS > 59ms > PE > 150ms > CE
+291ms ║Runtime (37421 bytes) successfully initialized in 59ms (v0.2.0e7.20170906) (289ms)
+295ms ║╔Execution stage started
+331ms ║║Comparison (time) 12599439 happens_daily_at (time) 1505240700000 = false (3ms)
+333ms ║║Condition #6 evaluated false (29ms)
+343ms ║║Cancelling statement #6’s schedules…
+348ms ║║Requesting time schedule wake up at Tue, Sep 12 2017 @ 7:40:00 PM BST
+351ms ║║Condition group #1 evaluated false (state did not change) (48ms)
+360ms ║║Comparison (time) 12599491 happens_daily_at (time) 1505194320000 = true (0ms)
+361ms ║║Time restriction check passed
+362ms ║║Cancelling condition #21’s schedules…
+363ms ║║Condition #21 evaluated true (9ms)
+365ms ║║Cancelling statement #21’s schedules…
+369ms ║║Requesting time schedule wake up at Tue, Sep 12 2017 @ 3:32:00 AM BST
+372ms ║║Cancelling condition #17’s schedules…
+373ms ║║Condition group #17 evaluated true (state changed) (18ms)
+376ms ║║Cancelling statement #18’s schedules…
+704ms ║║Executed physical command [218 Light].off() (324ms)
+704ms ║║Executed [218 Light].off (326ms)
+716ms ║║Calculating (string) Home + (string) Switched Off At Sunrise >> (string) Home Switched Off At Sunrise
+828ms ║║Executed virtual command [218 Light].sendNotificationToContacts (104ms)
+833ms ║╚Execution stage complete. (541ms)
+836ms ║Setting up scheduled job for Tue, Sep 12 2017 @ 3:32:00 AM BST (in 120.029s), with 1 more job pending
+850ms ╚Event processed successfully (850ms)
11/09/2017, 20:59:27 +494ms
+5ms ╔Starting piston… (v0.2.0e7.20170906)
+246ms ║╔Subscribing to devices…
+344ms ║║Subscribing to 218 Light…
+345ms ║╚Finished subscribing (106ms)
+412ms ║Comparison (time) 75567863 happens_daily_at (time) 1505154420000 = false (4ms)
+418ms ║Cancelling statement #6’s schedules…
+428ms ║Requesting time schedule wake up at Tue, Sep 12 2017 @ 7:42:00 PM BST
+450ms ║Comparison (time) 75567940 happens_daily_at (time) 1505107800000 = false (0ms)
+452ms ║Cancelling condition #21’s schedules…
+454ms ║Cancelling statement #21’s schedules…
+460ms ║Requesting time schedule wake up at Tue, Sep 12 2017 @ 3:30:00 AM BST
+463ms ║Cancelling condition #17’s schedules…
+483ms ║Setting up scheduled job for Tue, Sep 12 2017 @ 3:30:00 AM BST (in 23432.027s), with 1 more job pending
+507ms ╚Piston successfully started (507ms)
Look up the sunrise times for yesterday/today/tomorrow. Are they two minutes apart from each other?
I have a feeling that the sunrise time is updated after the piston schedules the job. And then the next correct sunrise time job is scheduled when the old time executes.
Hmm, sounds plausible. Where do I look up the sunrise times? Where does Smartthings source these from?
Weather underground I believe
Struggling to find historical sunrise/sunset times on WU. Today’s times are 06:32 for sunrise and 7:24pm for sunset and when I look at my IDE the times in their are 06:33 and 07:25 so they are a minute off but not sure why that is if ST is using WU. And not sure if that might be the cause of my issue either.
OK so looking at the sunrise and sunset times on that site for my location, they are roughly 1-2 minutes apart every day although the timings are quite different to the sunrise/Sunset timings showing in my IDE.
I’m wondering whether I simply hard code a time for the switch off, it wouldn’t compromise my requirement really. I just didn’t want the light on all night so I could pick a time I’d be happy with regardless of summer or winter daylight hours.
you could hard code it or just add this to both of the ifs as an and condition:
age([Switch 1 : switch]) is greater than 600,000
this way the second sunrise or sunset will not do the tasks because the tasks have already been triggered by the first sunrise or sunset.
OK I’ll get that. I’d rather go for the elegant solution over here coding just because it’ll make me feel better will try that out and see what happens.
That worked! Finally only one notification when the light was switched off! Many thanks all, particularly @bangali for the final solution
yay! you are welcome.
Re-opening an old thread. For some reason a number (not all) of my pistons are sending multiple Push notifications. The solution here seemed very specific to this use-case.
As you can see from the attached piston, it’s a very simple piston, but for some reason sends TWO push notifications. Anyone have an idea?
I’m really stumped here. I even tried to recreate this simple piston thinking there might be some phantom legacy or caching issues there. Thought it might also be a classic vs modern app thing, but I’m not getting multiple push notifications on any other piston.
Even rebuilding from scratch, this piston produces to push notifications.
Any ideas? Thank you!
It might not make a difference, but I would try placing the PUSH command in a new “Location” block. (and maybe make it the very first command, above 'Set SHM status")
If that does not work, then we’d need top see a fresh green snapshot with Trace turned on, and a FULL log during an error to properly diagnose. (preferably in a new thread)
Actually, did have logs turned on. I’m only seeing one sendPushNotification in this log.
2/6/2020, 2:45:29 PM +72ms
+1ms ╔Received event [Our house].time/recovery = 1581018329072 with a delay of 0ms
+112ms ║RunTime Analysis CS > 47ms > PS > 53ms > PE > 12ms > CE
+115ms ║Runtime (37990 bytes) successfully initialized in 53ms (v0.3.110.20191009) (114ms)
+116ms ║╔Execution stage started
+123ms ║║Comparison (time) 53129193 happens_daily_at (time) 53100000 = true (1ms)
+124ms ║║Time restriction check passed
+125ms ║║Condition #2 evaluated true (4ms)
+126ms ║║Cancelling statement #2’s schedules…
+129ms ║║Requesting time schedule wake up at Fri, Feb 7 2020 @ 2:45:00 PM EST
+132ms ║║Condition group #1 evaluated true (state did not change) (12ms)
+134ms ║║Cancelling statement #3’s schedules…
+148ms ║║Executed virtual command setAlarmSystemStatus (11ms)
+168ms ║║Executed virtual command setLocationMode (18ms)
+195ms ║║Executed virtual command sendPushNotification (22ms)
+197ms ║║Cancelling statement #7’s schedules…
+232ms ║║Executed physical command [Heat].setHeatingSetpoint([70.0]) (30ms)
+233ms ║║Executed [Heat].setHeatingSetpoint (32ms)
+236ms ║╚Execution stage complete. (120ms)
+237ms ║Setting up scheduled job for Fri, Feb 7 2020 @ 2:45:00 PM EST (in 86370.692s)
+244ms ╚Event processed successfully (244ms)
Interesting that the logs indicate it was a ‘recovery’. I don’t know whether to make anything of that.
So two push notifications arriving near simultaneously? And definitely both from the same mobile app? That is to say not one from ‘new’ and one from ‘Classic’?
Yep. Arriving at the the same time. And coming from the classic app.