Android Phone Presence Sensing

presence

(Eric) #1

I know this is a common topic here, but I’ve yet to see any concrete answers from my searching…

I have been struggling with geo-fencing pretty much ever since I got into SmartThings. I have the V2 hub, but I assume the hub doesn’t really make a difference as it is the phone app that detects where I am.

I’ve set up my phone as a presence device and it is very hit and miss. So I set up Life360 to double check it, and I set up a virtual switch with an IFTTT rule to flip it on when I am home and off when I leave to triple check it.

My phone constantly reports that I have left and come home repeatedly throughout the day when I haven’t gone anywhere. My wife’s phone doesn’t appear to have any issues at all with this (she has an iPhone). I have location set to high accuracy and I have battery saving turned off for SmartThings. I never turn of my wifi or gps… So why can’t my phone tell where I am more accurately?

Life360 seems to work perfectly, but sometimes there appears to be a disconnect where Life360 doesn’t update my presence status in the SmartThings app… I don’t know if that is a Life360 problem or a SmartThings problem.

And the IFTTT trigger is just as flaky as the presence sensing in SmartThings… but I’ve never had a great experience using IFTTT, so I expect them to be flaky…

So why is it that if Life360 always seems to know where I am that it can’t properly communicate this data to SmartThings? Or why is it that SmartThings can’t properly detect where I am?

I’m fully willing to sacrifice battery life if that’s what it takes to allow the SmartThings app to use my GPS more often.


#2

I don’t anyone has ever figured out for sure what the deal is with phones and presence. There are so many potential factors up to and including where your home is in relation to cell phone towers.

It sounds a little like with GPS and wi-if turned off in your case that the only location info the phone can use is based on cell tower info. One of the cell phone towers may be a fringe location dropping in and out of the location mix used by the phone. In your case I would recommend wi-if being on when home to improve location data the phone has access to. GPS should not matter when inside your house, the phone can’t see the satellites when indoors.

I have no idea why this problem seems to be more pronounced with Android phones. I’m not even sure it really is more prevalent with Android. We have 2 IPhones used as presence sensors in our home and have had no problems at all.


(Chris) #3

Have you ever deleted and re-add your phone as a sensor? I seem to have to do this every 2 months or so.


#4

Do you have a Samsung Galaxy phone?
If so this is something that’s a fundamental core OS issue that can only be solved by Samsung. See my previous post here:

I recently moved to iPhone 7 Plus and I’ve not had a single phone presence issue that I had with my Galaxy phones.

My wife who still has the Galaxy S7 edge, still have phone presence issues similar to what you have described since day one for boht ST and Life360 apps.

Good luck, hopefully you’ll have better luck than we did.


(Eric) #7

Thanks for the replies. I never turn my wifi off.

I’ve tried deleting and re-adding my phone before but it only solves the problem for maybe a day or two.

My phone is a OnePlus2. I believe the phone has some mechanism in the software that makes it go into a sleep mode quite regularly. I’m sure this is contributing to my problem. The thing I don’t understand is why would my location magically change when it goes into sleep and then comes out of it… My location shouldn’t change in that case…


(I got a hair cut from Alexa) #8

I have a Note 7 with all the battery saving off, and location and Mobile data always on. wifi always on, It has worked 100% of the time since I started using it…and I believe it will until the day it explodes. :slight_smile:


#9

Carry some oven mittens with you! :grin:

Good luck!


(I got a hair cut from Alexa) #10

asbestos pockets!


(Chris) #11

Even then, you’re just an IR sensor away from having presence continue to work.


(I got a hair cut from Alexa) #12

heyhey…i miss the ir blaster my old s5 had…the notes dont have them…love the high rez stylus though!


#13

My phone is the OnePlus One and I don’t have any issue with Geo Fencing. You just need to set it to about 2-5 block radius…Just in case their is spacial drifting on your GPS.


#14

After many months of flawless presence, my wife’s Note5 got stuck at home since friday… I wish we had a way of resetting presence.


#15

Did you restart the device and did you update ST app?


(Don) #16

I made a profile in Tasker that detects when I connect to my wifi. It has helped with my presence with my new S7. I also use @bridaus presence smart app with it using all 3 inputs as triggers.


#17

Yep, did that. I logged it in using her username and password so we’ll see when she leaves tomorrow or maybe I’ll take the phone for a ride later.


#18

I might have to resort to this if it doesn’t get resolved.


(Don) #19

My old S5 used to mark me as home very reliably. Everything would trigger quickly. My new S7 seems to fail at this miserably. I actually think now it’s the wifi connection that triggers things not the presence. I have done all the things suggested just no good.


(Brian) #20

I’ve noticed that since Android updated to Nougat (7.0) both mine and my wife’s phones (Nexus 6P’s) have become unreliable on presence. So this issue may well become more prevalent as Nougat becomes more widespread. It looks like it’s an OS level issue as ST subscribe to high accuracy location settings in Android


(Eric) #21

I wish it were that simple. I have tried everything from setting my geofence to a rather small one, up to setting it to be 10 miles wide. Nothing seems to fix the issue.


#22

So just an update for everyone as I’ve been tracking a problem I had with two phones and Geofencing that will hopefully inform everyone as to the multiple gears involved. While this isn’t necessarily the solution to ALL the problems, they are some of the most common.

To start with, this is the order of operations on how GeoFencing works with Mobile Presence (smart phones)

  • Smart things polls the GPS location of the device repeatedly.
  • If the latitude / longitude coordinates were previously inside the geofence and are now outside, it triggers an Exit Event (or Enter event for vice versa)
  • on phones, the triggering of this event is a web request to Smartthings website.
  • once the website receives the request, the event is transmitted back to your your Hub, where your hub will perform various automations based on the Enter / Exit event.

There are two major things that can interfere with this operation.
1) Accuracy of GPS location.
Phones report GPS location as three numbers. Lattitude, Longitude, & Accuracy. This is where your phones GPS setting comes into play. This is from the log file of the Geofencing within the Smartthings app.
Tue 18:46:31 Event fix: 31.4655, -82.5144, acc= 17.0m
You can see that the reported latitude is 31.4655, and reported longitude is -82.5144, with an accuracy of 17.0m. This means that your phone is somewhere within the radius of 17m from the GPS coordinates of 31.4655, -82.5144. Most of the time this is accurate enough to register location changes. Problems start to occur however when the accuracy goes up, due to your phone not getting a good lock on the GPS satellites, in which case it falls back to the location of the cell tower that you’re connected to. In this case, it will report the GPS coordinates of the cell tower, with a much higher accuracy since you have to be within that range given that your phone is connected to it.
Here’s an example when my phone fell back to the location of the tower
Event fix: 31.4552, -82.5292, acc= 3260m
As you can see, the accuracy is a radius of 3000 meters, which is a huge swath of area. This is where your reported location, and your actual location, can very greatly, and can affect whether your inside or outside your geofence.
I’ve (crudely) drawn some examples that show how this can affect things.
Starting with an example house with a 500m radius GeoFence

Now first example is a phone’s actual location (x), and it’s reported location (triangle) in relation to the geofence

You can see that there’s no issues.

Second example shows a phone actually inside the Geofence, but due to the low accuracy (high accuracy number), the reported location is actually outside the geofence,

so while you may indeed be standing inside it holding your phone, your reported location is actually outside the geofence, so none of the automations that rely on being inside the fence are triggering.

This is not something that can be helped by Smartthings, as they rely on the location reported by your device. Smartthings can’t control your device and how accurately it decides to report it’s location.

2) Web requests not completing
This is something that I recently contacted Smartthings about, and have seen referenced a few times here and there. As part of the events triggering, your phone sends a web request to a Smartthings url reporting the phone either entering or leaving. If the phone cannot send that request for whatever reason, then your automations will not trigger. Examples are being in airplane mode, having low/no signal, etc… Just like you couldn’t load a web page, the Smartthings app cannot send the information to it’s servers to show that an event has taken place.

With the release of Android Nougat, I confirmed with Smartthings that Doze may be interferring with these requests and not letting them complete. I have been told their Engineers are working on it, and will at some release an updated app that will account for Doze, but until then, if your phone is in sleep mode, know that the request fired off to the servers when an Enter/Exit event occurs, may not actually get there, thus not triggering any automations.

There is a way you can disable Doze for particular apps (reference: http://www.greenbot.com/article/3112224/android/what-you-need-to-know-about-doze-mode-in-android-nougat.html ) and I have disabled it specifically for Smartthings, so we’ll se what that does as far as preventing it from sending requests or not.