[RELEASE] Improved Mobile Presence (Android only)

What exactly makes this better than any other phone presence solution? Why is the version for 8.1 or higher not on the Play store?

What makes it better?

  • I can attach events to leaving multiple different locations (ex. Adjust the thermostat when I leave work so the temp is how I like it when I get home)
  • It uses changes in Wifi networks to detect presence. This makes it faster since it's not just checking my GPS coordinates on a timer. I have been using this (along with a few hundred other people) on SmartThings for a few years. My presence normally updates before I even get out of the car. I am working on triggering it with personal door codes as well to fill in time gaps caused by weak Wifi or phone not connecting quickly.

Why is there not a version for 8.1 or higher not on the Play Store?

  • There is only one version of the app (which is the one on the Play Store). Because of power saving restrictions starting in android 8.1, it requires a second app that targets a lower version of android to get around the power saving. Since Google does not allow apps that target a lower version of Android on the Play Store, I have to have a second app. The only thing the second app does is forward events to the main app. I am working on a way to make this a bit cleaner.
1 Like

@Johndc7

Thank you very much for putting this together!

I can't get it to work. I put the android app on my phone and the apk (i have a pixel4).
I then installed the driver into hubitat followed by the app. I clicked on oauth and update before i saved. in the apps list it says oauth enabled.

i then go to provision the app in the apps tab. When i do that i select add a new device, give it a name and hit enter to get to the "Pair this device". At this moment i get the error "the address wasn't understood., An error occurred during a connection to st.callahtech,com. You might need to install other software to open this address".

In the system log i get this entry " 2020-11-02 06:15:27.595 pm debugSKDIgrAwn"

I don't know what the 350) refers to but the SKDIgrAwn is the device ID for the presence sensor i am trying to add according to the screen.

Any ideas what i'm doing wrong?

par

Same issue here

Somehow I got mine to work just now....

1 Like

It’s definitely good to have options. Seems like some hoops to jump through for the patch and such. It also looks like it needs to talk to a server you’re running, which might rub people the wrong way unless you’re open about what you’re doing (if anything) with their location data. Will this still work when your server is down?

Here is another option for this looming for something that’s cross-platform (Android/iOS) and has some similar features (battery, charging state, if they are on a WiFi network) and doesn’t have a backend server requirement outside your HE’s cloud endpoint: [RELEASE] OwnTracks Presence

I do like the current and previous locations and how you can tie those into a rule.

I just got it working. I'll play around a bit with this to see how well it works. The geofencing on the hubitat app haven't worked that well, I hope this works better. I'll report back in a few days.

I suspect androids battery management system is not compatible with this app. Or at least the most recent Android running in a pixel 4xl device.

I did install the companion apk and I removed all battery optimizations for both apps (and rebooted just to be sure) but once the phone enters deep sleep the app reports that it's away. I think my search for Better geofencing method in Android continues.

Edit: I left my home for an hour and just got back. I've been in the home for the past 30 minutes without touching my phone and the app reports me as being away. I'm fairly sure it's Android that is the culprit, I think the idea is pretty neat though. I like the use of representative state transfer to transfer state from the phone to hubitat, but Android is notorious for shutting down daemons running in the background, and while I don't know for sure I'm fairly certain this is what is going on.

Check your permissions, make sure you have the location enabled on your device as well as the permissions in the app. If you look at the logs on your hubitat, you can see every time that it syncs. If there is some type of info coming through then that would eliminate that possibility of it being a battery management issue.

I have a Pixel 5 so I can vouch for that it works on Pixel devices on the latest software.

I checked the log this morning on hubitat. Looks like it reports as being away to the service about every 10 minutes or so?
let me double check permissions and other settings.

EDIT: I double checked and permissions for location was only on while app is in use. i changed that to allowed all the time. let me see if that was the problem. so far i have two successful checkins.

1 Like

I do not log or store history of any data that goes through the server. The database only has records needed for authentication with the cloud api and a copy of the latest event (in case of errors). There is no personally identifiable information is stored, logged or even reaches the server. All data processing is either done locally on the device or locally on hubitat.

I have considered using the server for setup only but I feel like it adds some extra reliability and the potential for new features. As for the patch, unfortunately there is a battery optimization that was implemented in Android 8.1 that prevents apps from listening to WiFi network changes. The patch takes advantage of the compatibility mode on Android by targeting a lower version. It is the only way to get around it as far as I know (I am open to suggestions). I suspect this is the reason why OwnTracks is missing this functionality (as well as the battery / charging state) on Android.

Looks like OwnTracks could be a good option for iPhone users though.

1 Like

I've run it for 6 hours, seems to work well. Changing the app settings to location allowed all the time did the trick.

Thanks, I'll play with this a bit next for automation!

And sincerely, thanks for sharing. I really wanted a decent arrival precense sensor and nothing on my phone has worked well. This shows good promise.

Sadly this app is really a WiFi presence so when I lose internet it sets my presence as away so it's not doable -- geofencing is the only way to get proper presence sensing.

Well since hubitat is run locally, your presence would never update if you lose internet :slight_smile:

Being serious, there is also a timeout setting in the device options. You can set it to only show away if you are disconnected for more than X minutes. Arrivals will show up immediately.

Maybe that could help...

Is this app available on the Hubitat Package Manager? I will try it out.

It is not on Hubitat Package Manager yet. I need to get it added but I've been busy moving and getting all of my stuff set back up for the last few weeks.

I will try to get it added this weekend.

Edit: I submitted a request to have it added to HPM. Once they accept, it will be available.

This app is working exceptionally well with a minor tweaks.
I found that my wifi occasionally restarts and the presence sensor thought it meant I was gone. Not so much an issue when detecting arriving but definitely and issue while at home and wifi restarts and hubitat thinks I'm leaving.

But with event engine, I setup a rule that detects if my mobile presence reports that I'm gone and I use the delay option. I set delay for 60 seconds because my wifi outages rarely last 60 seconds, and if they do and I'm home I'd like to know anyway.

With that the presence sensor has been 100% correct over the past week. It perfectly detects when I'm gone with a 60 second delay (about halfway down the block) and instantly when I'm back. I highly recommend this approach to detect presence, as long was you don't turn off wifi in the phone it just works.

I'm also liking this app, I've given up on geofencing(at least for now). Using Wifi has been far more reliable for me. I haven't had any false "aways" for a couple weeks. I use a Google Nest mesh wifi system with two points, It has been great. Much more reliable than the Asus AiMesh system I was using before.

Wouldn't this be the same as setting the timeout on the device page to 1 minute?

1 Like

I have the google nest wifi, with a hardwired backhaul between my 4 pucks. Its been unreliable but got a bit better once i did a factory reset and started over.

I did have the 1 minute timeout on the device page, but i didn't find that it helped much. I find that the combo with event engine works really well.

I'm glad that it's working now but that is exactly what the timeout feature is supposed to do lol.

Did you see any errors in the logs when you used the timeout feature. The driver was a 100% copy / paste from my SmartThings version so its possible that it might need a couple changes.