btw, this could also be a ST issue:
Why am I getting double notifications?
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?
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
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â?