My piston only works once in a while


#1

1) Give a description of the problem
My piston is only working a small percentage of the time.

2) What is the expected behavior?
When my iphone presence is first detected (when I return home), a smart lock on a door opens.

3) What is happening/not happening?
80% of the time, nothing happens and I have to manually open the door, even if several minutes have passed since I arrived and my presence should have been detected.

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
11/11/2017, 1:25:52 PM +709ms +5ms ╔Received event [Home].test = 1510424752693 with a delay of 7ms +199ms ║RunTime Analysis CS > 39ms > PS > 68ms > PE > 98ms > CE +212ms ║Runtime (29325 bytes) successfully initialized in 68ms (v0.1.0b7.20170603) (200ms) +214ms ║╔Execution stage started +421ms ║║Cancelling condition #4's schedules... +422ms ║║Condition #4 evaluated false (35ms) +423ms ║║Cancelling condition #1's schedules... +424ms ║║Condition group #1 evaluated false (state changed) (40ms) +454ms ║╚Execution stage complete. (241ms) +493ms ╚Event processed successfully (495ms) 11/10/2017, 4:43:51 PM +437ms +4ms ╔Received event [Bill's iPhone].presence = present with a delay of 270ms +395ms ║RunTime Analysis CS > 231ms > PS > 72ms > PE > 96ms > CE +408ms ║Runtime (29343 bytes) successfully initialized in 72ms (v0.1.0b7.20170603) (399ms) +412ms ║╔Execution stage started +491ms ║║Comparison present changes_to present = true (8ms) +500ms ║║Cancelling condition #4's schedules... +501ms ║║Condition #4 evaluated true (53ms) +503ms ║║Cancelling condition #1's schedules... +504ms ║║Condition group #1 evaluated true (state changed) (59ms) +515ms ║║Cancelling statement #2's schedules... +574ms ║║Executed physical command [Garage Door].unlock() (44ms) +575ms ║║Executed [Garage Door].unlock (49ms) +595ms ║║Executed virtual command [Garage Door].sendNotification (5ms) +609ms ║╚Execution stage complete. (200ms) +625ms ╚Event processed successfully (627ms) 11/10/2017, 6:52:04 AM +358ms +4ms ╔Received event [Bill's iPhone].presence = not present with a delay of 399ms +315ms ║RunTime Analysis CS > 158ms > PS > 72ms > PE > 89ms > CE +328ms ║Runtime (29339 bytes) successfully initialized in 72ms (v0.1.0b7.20170603) (319ms) +332ms ║╔Execution stage started +398ms ║║Comparison not present changes_to present = false (5ms) +406ms ║║Cancelling condition #4's schedules... +407ms ║║Condition #4 evaluated false (43ms) +408ms ║║Cancelling condition #1's schedules... +409ms ║║Condition group #1 evaluated false (state changed) (49ms) +425ms ║╚Execution stage complete. (96ms) +441ms ╚Event processed successfully (443ms) 11/9/2017, 6:13:31 PM +289ms +4ms ╔Received event [Bill's iPhone].presence = present with a delay of 230ms +325ms ║RunTime Analysis CS > 160ms > PS > 83ms > PE > 84ms > CE +338ms ║Runtime (29343 bytes) successfully initialized in 83ms (v0.1.0b7.20170603) (329ms) +342ms ║╔Execution stage started +408ms ║║Comparison present changes_to present = true (5ms) +415ms ║║Cancelling condition #4's schedules... +416ms ║║Condition #4 evaluated true (42ms) +418ms ║║Cancelling condition #1's schedules... +418ms ║║Condition group #1 evaluated true (state changed) (48ms) +429ms ║║Cancelling statement #2's schedules... +533ms ║║Executed physical command [Garage Door].unlock() (90ms) +533ms ║║Executed [Garage Door].unlock (95ms) +550ms ║║Executed virtual command [Garage Door].sendNotification (5ms) +563ms ║╚Execution stage complete. (223ms) +577ms ╚Event processed successfully (579ms) 11/9/2017, 5:34:01 AM +71ms +4ms ╔Received event [Bill's iPhone].presence = not present with a delay of 485ms +341ms ║RunTime Analysis CS > 169ms > PS > 90ms > PE > 86ms > CE +355ms ║Runtime (29341 bytes) successfully initialized in 90ms (v0.1.0b7.20170603) (346ms) +358ms ║╔Execution stage started +424ms ║║Comparison not present changes_to present = false (6ms) +431ms ║║Cancelling condition #4's schedules... +432ms ║║Condition #4 evaluated false (43ms) +433ms ║║Cancelling condition #1's schedules... +434ms ║║Condition group #1 evaluated false (state changed) (48ms) +450ms ║╚Execution stage complete. (95ms) +470ms ╚Event processed successfully (472ms) 11/8/2017, 9:32:25 PM +38ms +6ms ╔Received event [Bill's iPhone].presence = present with a delay of 78ms +452ms ║RunTime Analysis CS > 24ms > PS > 320ms > PE > 106ms > CE +463ms ║Piston waited at a semaphore for 257ms +467ms ║Runtime (29410 bytes) successfully initialized in 320ms (v0.1.0b7.20170603) (460ms) +470ms ║╔Execution stage started +482ms ║║Comparison present changes_to present = true (1ms) +483ms ║║Cancelling condition #4's schedules... +484ms ║║Condition #4 evaluated true (7ms) +484ms ║║Cancelling condition #1's schedules... +485ms ║║Condition group #1 evaluated true (state changed) (10ms) +486ms ║║Cancelling statement #2's schedules... +525ms ║║Executed physical command [Garage Door].unlock() (34ms) +526ms ║║Executed [Garage Door].unlock (35ms) +545ms ║║Executed virtual command [Garage Door].sendNotification (5ms) +549ms ║╚Execution stage complete. (82ms) +606ms ╚Event processed successfully (606ms) 11/8/2017, 9:32:24 PM +455ms +4ms ╔Received event [Bill's iPhone].presence = not present with a delay of 445ms +600ms ║RunTime Analysis CS > 243ms > PS > 71ms > PE > 290ms > CE +613ms ║Runtime (29340 bytes) successfully initialized in 71ms (v0.1.0b7.20170603) (604ms) +616ms ║╔Execution stage started +686ms ║║Comparison not present changes_to present = false (6ms) +696ms ║║Cancelling condition #4's schedules... +697ms ║║Condition #4 evaluated false (49ms) +699ms ║║Cancelling condition #1's schedules... +700ms ║║Condition group #1 evaluated false (state changed) (55ms) +720ms ║╚Execution stage complete. (105ms) +737ms ╚Event processed successfully (738ms) 11/7/2017, 4:57:38 PM +727ms +3ms ╔Received event [Bill's iPhone].presence = present with a delay of 168ms +252ms ║RunTime Analysis CS > 117ms > PS > 64ms > PE > 74ms > CE +264ms ║Runtime (29343 bytes) successfully initialized in 64ms (v0.1.0b7.20170603) (257ms) +266ms ║╔Execution stage started +314ms ║║Comparison present changes_to present = true (4ms) +319ms ║║Cancelling condition #4's schedules... +320ms ║║Condition #4 evaluated true (31ms) +321ms ║║Cancelling condition #1's schedules... +322ms ║║Condition group #1 evaluated true (state changed) (35ms) +329ms ║║Cancelling statement #2's schedules... +379ms ║║Executed physical command [Garage Door].unlock() (32ms) +379ms ║║Executed [Garage Door].unlock (35ms) +391ms ║║Executed virtual command [Garage Door].sendNotification (4ms) +401ms ║╚Execution stage complete. (136ms) +465ms ╚Event processed successfully (467ms)


#2

Do you actually get the notification 100% time or only coincident with the lock actually unlocking?

I’d put an if that checks the lock status before sending the unlock request.

Just out of respect for lagging system function, I’d put a short wait in there before sending the unlock request.

I’d also have the lock changing to unlocked trigger the notification rather than just have the piston send the message without regard to the action’s success. You could even add an unlock failed notification if you want to get fancy.


#3

Thanks for your reply. TBH I put that part in there to give me a notification, however i have Never received this notification not one single time, not even on the occasions that the door actually unlocks.
Also, I am brand new to this whole thing and I have no idea how to do any of the things that you are telling me to add. Do you think that putting this wait in it would make it work, or do you know what the problem is?
I used to have this all just run in Smartthings without Webcore but the people on the ST forums pursuaded me to get webcore and do everything through it, but I cannot figure out how to do anything except make this one piston, and it hardly ever works.


#4

Looking at your logs, looks like you’re testing with a mixture of actually coming and going but also using the piston test button.

Your piston will never fire using the test button as it checks for presence changing which won’t have been the case.

I would use is present.

Also, you have no safety built in, what if you travel past home without actually going in, or you arrive by foot and use a door instead of the garage.

After the notification, add a wait (say 2 minutes) followed by a lock command… that way you won’t accidentally leave the garage unlocked.


#5

Also, for added safety, add a second condition to check that you’ve been away for a while:

If
Bill’s iPhone‘s Presence IS present
and
previousAge([Bill’s iPhone : Presence]) is greater than 300000 (5 minutes)
Then
With Garage Door
unlock
Send notification
Wait 2 minutes
lock


#6

Piston’s are kind of fun once you get into the zeitgeist of the system. Hang in there. You’ll get it.


#7

I edited my piston over the weekend and tried it out today and again it did not work at all. The door did not unlock and the notification did not fire. I am attaching an image of my edited piston, and below is the log from today.

Here is the log from today. The times are correct, it should have fired at 4:22pm. It looks like it was doing something but it did not actually open the door or give notification.

11/13/2017, 4:22:25 PM +314ms
+5ms ╔Received event [Bill’s iPhone].presence = present with a delay of 298ms
+407ms ║RunTime Analysis CS > 224ms > PS > 95ms > PE > 92ms > CE
+422ms ║Runtime (29809 bytes) successfully initialized in 95ms (v0.1.0b7.20170603) (410ms)
+426ms ║╔Execution stage started
+507ms ║║Comparison present is present = true (7ms)
+516ms ║║Cancelling condition #4’s schedules…
+517ms ║║Condition #4 evaluated true (53ms)
+530ms ║║Comparison null is_greater_than 300000 = false (6ms)
+532ms ║║Condition #6 evaluated false (14ms)
+533ms ║║Condition group #1 evaluated false (state did not change) (73ms)
+553ms ║╚Execution stage complete. (131ms)
+573ms ╚Event processed successfully (574ms)
11/13/2017, 6:49:35 AM +480ms
+6ms ╔Received event [Bill’s iPhone].presence = not present with a delay of 80ms
+147ms ║RunTime Analysis CS > 19ms > PS > 48ms > PE > 77ms > CE
+159ms ║Runtime (29806 bytes) successfully initialized in 48ms (v0.1.0b7.20170603) (153ms)
+162ms ║╔Execution stage started
+180ms ║║Comparison not present is present = false (7ms)
+184ms ║║Cancelling condition #4’s schedules…
+184ms ║║Condition #4 evaluated false (16ms)
+186ms ║║Condition group #1 evaluated false (state did not change) (18ms)
+189ms ║╚Execution stage complete. (30ms)
+199ms ╚Event processed successfully (199ms)


#8

The logs are saying that your time evaluation is false.
image
Would thhis work for you?
image


#9

I will put that in and try it but I dont know what that means. Does that mean that my presence has to be present for 5 minutes before my door unlocks? I want the door to unlock right away. Also I dont understand why the time evaluation is false. What does that mean?


#10

Yes. I thought that was what you were trying to do.

It means exactly that, the argument that you have put in is not greater the 300000. 5 minutes.


#11

I want the door to open immediately, or within like less than a minute, of when my presence is detected. I added the 5 minute line just this weekend because someone else in this thread said that I should add that to say that I should have been gone for 5 minutes so they told me to add that line.
Can someone show me how to write it so that the lock unlocks immediately please?


#12

Two things. First, sorry if this is a simplistic question, you can lock and unlock from the ST app manually correct? Is the response immediate or close to it?

If so, take out that 300000 delay line. Just get rid of it for now. For a test, leave until you know your presence is away, verify with the app, then come back and see if the door activates.

That’s what I would do anyway.

If the door can be locked and unlocked with the app, this should work as it’s a most basic piston.


#13

This is how mine is set up and works just fine. So before any of this code, everyone seems to have missed the basic question. Does Smart things show you as present? Are you using ST built in presence based on the app. I use Life360 app and connector instead. I didnt want everyone to have access to ST app. This was my solution and it works well. You can adjust the location bubble to tackle some of the issue of false positives Robin mentioned. I also wrote a separate piston for auto lock options for a bit more control. Many ways to do a lot of this. Go back to the basic on your code. Make sure “presence changes present” works before you start adding extra code in. Once that is working then you can add waits and presence timers and so on.


#14

Using the Smartthings app, I have always been able to successfully unlock the door perfectly. Also, the smartthings app has always showed me as Present when I am present, and not present when I am away.


#15

Puzzling.


#16

So I see in your first logs that it seems to have executed all the requirements. I had the same thing happen with my Garage open, after working just fine for months somehow it had an issue. showed connected in ST but could not open it manually in ST. So the piston was telling it to open but it never would. That is the only thing I can think of here. its a very simple piston. It should be “Presence Changes to Present”.


#17

I had it originally as Presence changes to Present as you can see in the original post, but then someone in this thread told me to change it to Presence IS Present.


#18

Here is the smartthings presence sensor. You can see that it registers correctly each time I come and go.


#19

I believe you. Something else is wrong. If you aren’t sick of trying stuff yet, try this.

Create a piston with nothing but a notification.

~ If (your device) changes to present PUSH “it worked”

In a separate piston make a piston

~ If (your device) changes to away PUSH “it appears I’ve left”

The message is unimportant as long as you can tell arrive from depart.

I would create separate pistons just ‘cuz.’

Free advice and worth every penny!


#20

I did this, and both the present and away pistons worked perfectly today. Any ideas?