Yet another stab at WiFi-centric presence on android

sharptools
project_presence

(Glen King) #1

Moving the discussion from where it was (mobile app), because it no longer is about the mobile app at all.

I’ve tried a bunch of different methods. The ST sensors, which are good for a month then flake out. Various presence apps including Life360 - which is great at detecting when I leave the house, but terrible at detecting when I return (deleted - more about that in a moment).

I hope/believe that I have a valid path forward, finally.

EDIT - I must note that I do not use cell service, I only use the phone WiFi.

The phone does great at detecting cells within range. I’m using the CDMA cells, and not the LTE. Because it turns out the LTE cells initially all report as the same cell! So you can use CDMA cells plus network or gps or whatever to, for example, trigger a shopping list to open when you arrive at the grocery store. I’ve been doing that for over a week now and it works well.

So using Tasker, upon your return home you would do the following:

  • when within range of the CDMA cells that define your local neighborhood, turn on WiFi
  • when you phone connects to WiFi, use Sharptools to do the action(s) you want.

As long as your WiFi extends out past your entrance door a bit, that works.

But there are issues.

How do we get it to NOT trigger each time the WiFi re-engages while you are at home? You don’t want your front door to unlock in the middle of the night just because your wireless router had a 3-minute hiccup.

The answer to this is: a variable. Have a GLOBAL variable that says “i’m Home”, and make your Tasker profile always check that condition as part of the context. (My variable is ATHOME, and the states are ‘= H’ for home and ‘<>H’ for away.) So if the WiFi goes off for a few minutes and then comes back on, or you turn off your phone for the night and turn it back on in the morning, Tasker sees that activity and checks the variable… if the variable says “i’m home” then the context is not fulfilled and Tasker does not perform an action.

The action sequence: do what tasks you want done, then set the variable to ‘home’.

All well and good so far.

But now we need a way to reliably tell Tasker to set the variable to ”I’m not home” when you leave the house. Hypothetically, merely getting out of range of your own WiFi (WiFi Near > Invert) should do the trick. But i’m Going a bit further, and scoping out the neighborhood. I want that to be redundant, to ensure the variable gets set. So if I pass a specific WiFi a few houses down, then Tasker knows I’m not home and sets the variable accordingly (good for walking/running, cycling). Likewise if I reach a CDMA cell tower that is not within range of my home, set the variable. So I’m scoping out the scenario in all directions, and accumulating those cells into a context.

As for deleting life360, it consumes lots of resources and does little in return. But it convinced me to get a microSD to expand the memory of my burner phone… the card, at $17, is almost as costly as the entire phone ($20) lol


(Glen King) #2

It’s 2-4-2.

Not that a sample size of 2 is anything… but I’m feeling good about it.
And I’m gonna simplify it. The actions when I arrive at my front door are only really dependent on the phone connecting to the network. The cell dependency is to turn on WiFi prior to getting to my street.

Also, I’m fine-tuning it. If you have a Schlage lock in the mix using the custom lock manager DTH, the unlock action should come first… and have a 4-second wait until other actions occur.


#3

Did you see this? [RELEASE] Improved Mobile Presence (Android only)

or this? https://community.webcore.co/t/install-instructions-webcore-presence-sensor-on-your-android-beta/1324/65

and I think you are talking about this: [HOW TO] SmartThings Presence reporting using Tasker/SharpTools/AutoLocation


(Steve ) #4

Yeah there’s various ways to do presence for yourself and your phone.
I did similar last week but my presence within SmartThings works great so it wasn’t for me.
My 2 son’s are anyways running out of mobile data so their presence was always bit and miss because of this.
So with a tablet that’s on all the time with my action tiles I setup tasker to do a Http get on my routers status page.
Then saved it to a file and basically it checks for their Mac address and changes some virtual presence sensors accordingly.
It works great but I would like a way of it detecting them before they get in the house so they don’t trip the SHM :frowning:


(Glen King) #5

Yep, saw them all, and have tried some of them. Have also tried other presence solutions, including ecobee and life360. They all seem to break down. Remember, I’m not on any cell plan. I’m WiFi-only, with cell tower references available because the phone sees them. But I can’t do a wide geofence. Btw, I just edited the title to clarify this for folks. That said, the ecobee and life360 solutions are inconsistent on my wife’s phone, which is used as a true cell phone.

The Tasker/Sharptools/autolocation fail point is the Joao app. I use his apps a lot, and most of ‘em are great… but the autolocation app is inconsistent. I haven’t tried the webcore beta presence because of the risk/unwieldiness of the install (“KNOWN ISSUE - it appears that setting up the sensor does NOT work the first time around - clicking does nothing. Kill the app and open it again to fix this. I am looking into what is causing this.”). Your own post in the thread on “improved mobile presence” indicates issues with it.

I’m seeking a simple presence solution that does not have issues, that installs without a glitch, that won’t falsely report me gone when home or vice versa, that won’t break the moment android gets updated again. I don’t need complex geofencing, although what I’m doing sorta ends up equaling that in the end. The variable seems to be the key to that. I just looked at my phone’s Tasker screen, and the variable is reporting correctly that I’m not home.

The possible fail point here might be when I power it up at home - it might, in the process of booting up, briefly say I’m not home before checking the variable. Didn’t happen when I tested it the past two days, but I’m watching for it… and the solution of course would be to put ‘wait’ into the Tasker scripts at the appropriate points so it cannot check the variable state until the phone has pinged the local cells.

I’ll report how it does over the next week and beyond. If it fails, I’ll let y’all know.


#6

Yes I’ve had issues with it but it’s been the most consistent out of everything I tried at this point the app is telling me that I’m home but it is actually updating my status and SmartThings so is the reporting of the app rather than the function that is not working consistently


(Glen King) #7

A nice feature about Tasker/Sharptools to perform the entry process: it can set the mode, and it can set the SHM state. It no longer looks from ST’s point of view as if a legit entry is a breach.

So once the conditions of the context are met, the Task attached to the Profile does the following:

Set mode to Home
Set SHM to disarmed
Wait 2 seconds
Unlock front door.
Wait 4 seconds (necessary- any shorter wait and the ‘unlock’ command errors out)
Set %ATHOME = H
Flash front door light a few times to indicate the process has worked.

Which is now 3-4-3.


(Joshua Lyon (SharpTools.io Dashboard)) #8

Does this mean it has worked 3 out of 3 times? (eg. “I’m 3 for 3”)

Also, just an FYI if you decide to give AutoLocation a try again in the future, it looks like João changed the services to foreground services (which show a notification), so it’ll work with Android 8.x which has become much more aggressive with battery management.


(Glen King) #9

Yep, 3-for-3. :slightly_smiling_face:

I tried autolocation a couple years ago. Was extremely inconsistent.
Tried it again last year. Was still inconsistent.

I have something that is working outside that parameter. Think i’ll Stay with it, rather than letting the next android update again wreck presence as it clearly did for everyone running autolocation. Not joao’s fault, just the way things work out sometimes.

And I won’t upgrade my android version. :slight_smile:


(Joshua Lyon (SharpTools.io Dashboard)) #10

Totally understand. Many people like the AutoLocation approach since it’s just dragging a circle around the area you want to trigger things, but sometimes the more detailed approach of checking for “landmarks” via things like cellphone towers and wifi APs works better (even if it can be a bit more work to setup). :smiley:


(Glen King) #11

3-for-4. :confused:

Network refused to connect this time.
Difference from past 3 days: I actually used the phone on the WiFi at work today.


(Glen King) #12

Friday worked, but took a minute.
Tonight it worked perfectly.

I have Tasker logging on, and will try to figure it out. But it’s not easy.


(ocpd+adhd+alz+md+hfa+fms+lol=me :)) #13

So…given the different kinds of components involved, and the variables they all bring to the mix, perhaps glitchiness and/or inconsistency are just things we have to live with when it comes to Presence (regardless of the method we’re using), eh?

I guess we chalk this one up as ‘yet another failed attempt’ …that is, if PERFECTION is somehow the goal (which it should be).

Seriously though, thanks for taking a jab/stab at it. I will be watching this thread to see if you ever get all of the kinks worked out, and hopefully people keep poking and prodding like this until somebody eventually lands on THE ONE.


(Glen King) #14

Update: the past few days, it triggers the actions… 15 minutes after I arrive home. ROFL

Very hard to grasp when it works perfectly for a couple days, then with no changes whatsoever in what I’ve done no longer works well. Then works great for a couple days, then falters again.

I’m not sure it’ll ever be ironed out. The Life360 thing didn’t work well for the wife with her cellphone, the ecobee location/presence doesn’t work well for her - she arrived home at 5:30 yesterday, and at 8:30 my system got the message “wife approaching” and kicked the thermostat into arrival mode…

Tonight the AA battery containers will arrive, and I will try again with the ST presence sensor (the project where you put the presence sensor in the 4-battery box, with 2 batteries). It has an on/off switch, so the battery life should be incredible.

As the ST presence sensor works great for about a month on a fresh battery, this arrangement with it using a pair of AAs should work consistently well for many months.