Handling false departure/arrival notifications

presence

#1

SmartThings decided today that my wife’s phone left the house and then immediately returned. This, of course, triggered my departure and arrival piston, and caused the garage door to roll up and the doors to unlock. She was… unimpressed.

We’ll of course check her app to ensure the presence circle is positioned appropriately but I’d also like to add some code to guard against this from happening again.

What’s the accepted design pattern for dealing with this issue? I’m thinking of having some sort of “don’t do the open stuff if departure happened within the last 1 minute”, but I’m not sure how to code that in webcore. Anyone have any good sample pistons that handle this well?

Thanks!


#2

Here’s what I am using. The 180000 I believe is 3 minutes. The arrival sensor has to of been away for at least 3 minutes. You can also use location mode to help control when your garage opens. Because ST presence is so unreliable most users will tell you not to use presence to open doors and unlock locks. I’ve been very lucky and have had very few false positives in the past 1.5 years.


#3

In case anyone is wondering, 180,000 is 3 minutes. The functions age() and previousAge() are measured in milliseconds. So it is important that you also use milliseconds.

180000 milliseconds = 3 min @ 60 seconds per minute is 180 multiplied by 1000 milliseconds per second


#4

Cool, thank you! That’s exactly the kind of sample I needed, and even uses the same kind of $currentEventDevice construct I have.


#5

Update: I’ve tested this with my virtual sensors and it seems to work. It also worked this morning when my wife’s phone decided to report away/home within a minute of each other. The house ran through the departure script (locking some doors), but did not run the arrival script.

Yay!