I think I found the issue with my wife's HTC One M9. There's a setting in her Advanced Wifi settings to Optimize Wifi, which essentially means to put it to sleep when not in use. I unchecked that box and tested 4-5 arrivals and it's working much better now. I was able to take her outer geofence radius from 2000m down to 1500m. I don't have that option on my Droid Turbo 2, so I'm guessing they leave wifi awake all the time. According to the AutoLocation FAQ, wifi needs to be on in order for geofencing to work correctly, so hopefully this is the cause of the problem I was seeing. If her's continues to cause problems, I may add a third "way-outer" geofence with something like a 5000m / 3 mile radius that does location updates every 3 minutes or so.
After fixing that issue on her phone, I noticed that while High Accuracy location would enable correctly when inside the outer geofence, Tasker wouldn't actually fire the SharpTools "arrived" command until I turned the screen back on. I had to mess with the Screen Off All Checks and Timeout Seconds settings. The default is All Checks 600 seconds and Timeout 60 seconds. I added tasks to change Tasker Prefs to All Checks 30 seconds and Timeout 25 seconds in all of the profiles that enable high accuracy location, and set those same values back to default in all of the tasks that disable high accuracy location.
The other strange thing that her phone does is use GPS full time when high accuracy mode is on. Her battery life kinda sucks anyway, and this makes it much worse. I don't think my phone is doing that, I usually get a satellite dish in my notification bar when GPS is active, but I haven't seen that a single time when Location Monitor is enabled. I ended up changing her location type to Balance Power/Accuracy instead of High Accuracy and it still seems to work ok, at least with the limited testing I did. GPS symbol is gone from her notification bar, so hopefully this will solve the battery drain issue on her phone.
Revisiting Near WiFi as well...I tried setting this up on my phone and initially it did not seem to ever deactivate the profile once active. Did a little bit of reading and saw that a network doesn't get "forgotten" until it goes two consecutive scans without seeing it, which could be up to 6 minutes with the default 120 second scan period depending on when the last scan was done. I wasn't happy with how long that might take to deactivate, but again, this is a setting that is configurable as part of a task. So...here's what I now have on my phone, haven't done a lot of testing but the two times I've come and gone today it worked:
Near Home Profile activates when inside my outer geofence. Entry task turns AutoLocation Location Monitor on to High Accuracy mode. Exit task turns AutoLocation Location monitor off.
Home-WiFi profile activates when I am connected to my home wifi network. Entry task turns AutoLocation Location Monitor off and sets Tasker Wifi Scan Period to 120 seconds (default). Exit task turns AutoLocation Location Monitor On to High Accuracy mode and sets Tasker Wifi Scan Period to 25 seconds (minimum allowable).
Home-NearWiFi profile activates when I am near either my primary home wifi network (router is near the back of the house) or near my wireless bridge (router is near the front of the house). I did this because occasionally my phone will disconnect from wifi when I'm out in the driveway since the signal is weak out there. I also referenced these two networks by mac address instead of SSID in case my phone ever sees another wifi network with the same name while I'm out. I do not have an entry task for this profile. Exit task sets Tasker wifi scan period to 120.
Home-Location profile activates when I enter my inner geofence. Only task associated is a dummy wait task.
Home profile activates when any of Home-WiFi, Home-NearWiFi, or Home-Location profiles are active, using the %PACTIVE variable. Entry task uses SharpTools to make me arrive, and I have a second task that opens my garage door if my car's Bluetooth profile is also active. Exit task uses SharpTools to make me depart.
The normal sequence of event when coming home now looks like this:
- When I cross into my outer geofence, Near Home is activated and Location Monitor turns on to High Accuracy mode
- When I cross into my inner geofence, Home-Location is activated. Since this is one of the three profiles that can activate the Home profile, it also activates and tells SharpTools that I have "arrived" in SmartThings. Additionally, if my phone is connected to my car's bluetooth, an additional SharpTools command is sent to open the garage.
- When I connect to my home WiFi network, Location Monitor is turned off
- At some point after I arrive home (timing isn't significant), my Home-NearWiFi profile activates. No action taken at this point.
The normal sequence of events when I leave home now looks like this:
- When I leave home and disconnect from my home WiFi network, Home-WiFi deactivates, Location Monitor turns on to High Accuracy mode and Tasker is set to rescan wifi networks every 25 seconds
- When I leave my inner geofence, Home-Location profile deactivates, with no action taken
- After 2 scans without being near one of my wifi networks, my Home-NearWiFi profile deactivates (usually around a minute after leaving the area). Wifi scan period is reset to the default 120 seconds. Since all three of the profiles that are referenced in the Home profile are now deactivated, Home is deactivated, and SharpTools tells SmartThings I have departed.
- When I leave my outer geofence, Location Monitor is turned off.
I tried setting up the Wifi Near on my wife's phone but ran into the same problem where it wouldn't deactivate, even with the scan period set to 25 seconds. At this point I was tired of tweaking stuff, so I gave up and deleted all of the references to "wifi near" on her phone. Might play with it again later, but both of us are tired of me stealing her phone to tweak stuff for an hour at a time