Any idea why this piston would miss a trigger?


#1

1) Give a description of the problem
The piston missed me opening the door this morning. The door switch did trigger the open event. I closed it and opened again and it fired. Wondering if this was just a glitch, or I am not approaching this correctly with my statements.


#2

I’d just be guessing without a log to accompany it. When you say the door switch triggered the open event, are you seeing it in your webCoRE log or in your device event history?


#3

I saw it in my SmartThings device event history. I should turn on logging then I suppose.


#4

Here is the log:

1/19/2018, 6:25:06 AM +595ms
+1ms â•”Received event [Front Door Sensor].contact = closed with a delay of 469ms
+161ms â•‘Runtime (38672 bytes) successfully initialized in 60ms (v0.2.102.20180116) (159ms)
+163ms â•‘â•”Execution stage started
+196ms â•‘â•‘Executed virtual command [Front Porch Light, Outside Garage Lights].wait (0ms)
+197ms â•‘â•‘Requesting a wake up for Fri, Jan 19 2018 @ 6:40:06 AM EST (in 900.0s)
+202ms ║╚Execution stage complete. (40ms)
+204ms â•‘Setting up scheduled job for Fri, Jan 19 2018 @ 6:40:06 AM EST (in 899.995s)
+215ms ╚Event processed successfully (214ms)

1/19/2018, 6:24:50 AM +59ms
+1ms â•”Received event [Front Door Sensor].contact = open with a delay of 602ms
+10186ms â•‘Piston waited at a semaphore for 10022ms
+10188ms â•‘Runtime (38742 bytes) successfully initialized in 10064ms (v0.2.102.20180116) (10186ms)
+10189ms â•‘â•”Execution stage started
+10221ms â•‘â•‘Executed virtual command [Front Porch Light, Outside Garage Lights].wait (0ms)
+10222ms â•‘â•‘Requesting a wake up for Fri, Jan 19 2018 @ 6:40:00 AM EST (in 900.0s)
+10227ms ║╚Execution stage complete. (37ms)
+10228ms â•‘Setting up scheduled job for Fri, Jan 19 2018 @ 6:40:00 AM EST (in 899.994s)
+10238ms ╚Event processed successfully (10239ms)

1/19/2018, 6:24:49 AM +944ms
+1ms â•”Received event [Front Door Sensor].contact = open with a delay of 467ms
+144ms â•‘Runtime (38675 bytes) successfully initialized in 42ms (v0.2.102.20180116) (142ms)
+145ms â•‘â•”Execution stage started
+242ms â•‘â•‘Executed [Front Porch Light].on (20ms)
+262ms â•‘â•‘Executed [Outside Garage Lights].on (18ms)
+265ms ║╚Execution stage complete. (120ms)
+267ms ╚Event processed successfully (267ms)

1/19/2018, 6:24:48 AM +204ms
+2ms â•”Received event [Front Door Sensor].contact = closed with a delay of 658ms
+144ms â•‘Runtime (38675 bytes) successfully initialized in 44ms (v0.2.102.20180116) (142ms)
+146ms â•‘â•”Execution stage started
+176ms â•‘â•‘Executed virtual command [Front Porch Light, Outside Garage Lights].wait (1ms)
+177ms â•‘â•‘Requesting a wake up for Fri, Jan 19 2018 @ 6:39:48 AM EST (in 900.0s)
+183ms ║╚Execution stage complete. (38ms)
+185ms â•‘Setting up scheduled job for Fri, Jan 19 2018 @ 6:39:48 AM EST (in 899.994s)
+195ms ╚Event processed successfully (195ms)

1/19/2018, 6:24:43 AM +566ms
+1ms â•”Received event [Front Door Sensor].contact = open with a delay of 443ms
+324ms â•‘Runtime (38668 bytes) successfully initialized in 232ms (v0.2.102.20180116) (323ms)
+325ms â•‘â•”Execution stage started
+355ms â•‘â•‘Executed virtual command [Front Porch Light, Outside Garage Lights].wait (1ms)
+356ms â•‘â•‘Requesting a wake up for Fri, Jan 19 2018 @ 6:39:43 AM EST (in 900.0s)
+361ms ║╚Execution stage complete. (36ms)
+363ms â•‘Setting up scheduled job for Fri, Jan 19 2018 @ 6:39:43 AM EST (in 899.995s)
+372ms ╚Event processed successfully (372ms)


#5

Turn on full logging. We can’t see enough detail otherwise.


#6

Your piston is executing and setting the wake up time for the 15 minute wait period. I think it was just a fluke if your piston didn’t pick up the event.

The other likely culprit is “piston waited at a semaphore for xxxx ms”. At least one of your executions had this event, and it’ll delay your piston by 9 or 10 seconds, usually. So it may have looked like it picked up your 2nd door opening when it was just a delayed reaction to the first.

I usually only see those delays when a piston or numbers of pistons are triggered in rapid succession.


#7

Last night when my presence triggered late, the lights came on but the turn off timer didn’t initiate. Very strange. Here is the log.I included the previous door opening that worked correctly. Should i move the wait and off to right after the turn on command:

1/25/2018, 9:12:29 PM +533ms
+2ms â•”Received event [Android].presence = present with a delay of 132ms
+165ms â•‘RunTime Analysis CS > 22ms > PS > 46ms > PE > 96ms > CE
+167ms â•‘Runtime (38760 bytes) successfully initialized in 46ms (v0.2.102.20180116) (165ms)
+168ms â•‘â•”Execution stage started
+184ms â•‘â•‘Comparison (enum) present changes_to (string) present = true (1ms)
+186ms ║║Cancelling condition #14’s schedules…
+187ms â•‘â•‘Condition #14 evaluated true (12ms)
+236ms ║║Comparison (time) 76349721 is_between (time) 1516917120000 … (time) 1516881900000 = true (9ms)
+237ms â•‘â•‘Time restriction check passed
+239ms â•‘â•‘Condition #15 evaluated true (50ms)
+240ms ║║Cancelling condition #18’s schedules…
+241ms â•‘â•‘Condition group #18 evaluated true (state changed) (65ms)
+242ms ║║Cancelling condition #1’s schedules…
+242ms â•‘â•‘Condition group #1 evaluated true (state changed) (68ms)
+245ms ║║Cancelling statement #4’s schedules…
+271ms â•‘â•‘Executed physical command [Front Porch Light].on() (22ms)
+272ms â•‘â•‘Executed [Front Porch Light].on (24ms)
+296ms â•‘â•‘Executed physical command [Outside Garage Lights].on() (20ms)
+296ms â•‘â•‘Executed [Outside Garage Lights].on (22ms)
+299ms ║╚Execution stage complete. (131ms)
+300ms ╚Event processed successfully (300ms)
1/25/2018, 5:15:14 PM +68ms
+1ms â•”Received event [Some Road].time = 1516918514048 with a delay of 20ms
+191ms â•‘RunTime Analysis CS > 32ms > PS > 46ms > PE > 113ms > CE
+194ms â•‘Runtime (38761 bytes) successfully initialized in 46ms (v0.2.102.20180116) (192ms)
+196ms â•‘â•”Execution stage started
+238ms â•‘â•‘Executed physical command [Front Porch Light].off() (19ms)
+239ms â•‘â•‘Executed [Front Porch Light].off (20ms)
+262ms â•‘â•‘Executed physical command [Outside Garage Lights].off() (20ms)
+264ms â•‘â•‘Executed [Outside Garage Lights].off (22ms)
+267ms ║╚Execution stage complete. (72ms)
+269ms ╚Event processed successfully (269ms)
1/25/2018, 5:00:13 PM +340ms
+2ms â•”Received event [Front Door Sensor].contact = closed with a delay of 707ms
+647ms â•‘RunTime Analysis CS > 106ms > PS > 243ms > PE > 297ms > CE
+650ms â•‘Runtime (38758 bytes) successfully initialized in 243ms (v0.2.102.20180116) (648ms)
+652ms â•‘â•”Execution stage started
+680ms â•‘â•‘Condition #14 evaluated false (19ms)
+681ms â•‘â•‘Condition group #18 evaluated false (state did not change) (21ms)
+687ms â•‘â•‘Comparison (enum) closed changes_to (string) open = false (1ms)
+689ms ║║Cancelling condition #3’s schedules…
+691ms â•‘â•‘Condition #3 evaluated false (7ms)
+692ms ║║Cancelling condition #19’s schedules…
+694ms â•‘â•‘Condition group #19 evaluated false (state changed) (10ms)
+695ms ║║Cancelling condition #1’s schedules…
+696ms â•‘â•‘Condition group #1 evaluated false (state changed) (37ms)
+699ms ║║Cancelling statement #16’s schedules…
+706ms â•‘â•‘Executed virtual command [Front Porch Light, Outside Garage Lights].wait (1ms)
+708ms â•‘â•‘Requesting a wake up for Thu, Jan 25 2018 @ 5:15:14 PM EST (in 900.0s)
+715ms ║╚Execution stage complete. (64ms)
+717ms â•‘Setting up scheduled job for Thu, Jan 25 2018 @ 5:15:14 PM EST (in 899.992s)
+726ms ╚Event processed successfully (725ms)


#8

I don’t see anything out of the ordinary there. Your piston detected a presence change and it passed your time restrictions, so it executed the actions under “THEN”. That only turns lights on; you need a trigger that fails your IF condition and runs the “ELSE” code to initiate your timer and lights turning off.

Maybe your piston isn’t written in a way to catch all the scenarios that may trigger what you want it to do. Can you explain what you want it to do and a few scenarios? We can make a few edits to it to make sure it’s performing as you want, even if SmartThings runs slow and throws it a curve ball.


#9

Yeah, it’s a pretty simple piston. It’s only purpose is turning the outside lights on at night if we arrive home, or if we open the door to leave. This felt too simple to get so complicated.


#10

Give this one a whirl. I’ve simplified what you were doing while retaining the desired functionality. Also, sometimes there are issues when there is a long wait in a piston as the triggers which initiated things are no longer true after the wait time is over. For instance, when you arrive home your presence “changes to present” however, 15 minutes later that is no longer true. You’re already present. In some of those cases it’s best to include a “Never cancel” command in the piston which will get it to continue even if the triggers have subsequently changed.


#11

LOL, I just did this before I even saw this. I’m still missing the else routine a bunch so I moved it in with the then function like you did. I understand what you are saying. Interesting. I didn’t think it would get evaluated during the wait. As you did it, it should work perfect. I will look into the never cancel too just to familiarize myself. Thanks for the input.


#12

Actually, after a 15 minute wait it makes perfect sense. Let me quote myself… :slight_smile:


#13

I reread and agree, which is why I edited my response. You’re just too quick for me this morning.