SmartThings Community

[RELEASE] Improved Mobile Presence (Android only)

android
presence
dth_presence
project_presence
webcore

#261

It bypasses the implicit broadcast limitation by targeting a lower version of Android and sends them as an explicit broadcast to the regular app.


(Spencer Wagner) #262

I am having an issue with this. When I set the presence timeout to 0, everything functions perfectly and quickly.

If I set the presence timeout to 1 minute, it does show that I am away on my “Things” page in the smartthings classic app. But if I click on the device, it never switches to away on the “Right now” tab. It always stays blue and still says the time that I arrived. This page does update properly when the timeout is set to 0 minutes.

Also, when it is set to 1 minute, a webcore piston that is supposed to be triggered by me arriving home, never triggers after I arrive home. Even if I wait for longer than the 1 minute. When I set the timeout back to zero, the piston runs every time.

Any ideas?

Edit: In my house, there are three Essential Phones. We love the phones, but their wifi connection is not very reliable and cuts out for a couple of seconds multiple times each day. With the timeout set to 0, the arriving home piston gets triggered falsely about once an hour.


#263

Check if your device handler is updated. The presence timeout option should no longer be there (as it was no longer working properly).

I would also recommend using the currentLocation and previousLocation attributes for webcore.

Edit: Didn’t see the note about the essential phones. If you need it, I will look into adding it back. (Give me a few hours)

Edit: Been a bit busy over the weekend but it should be done tomorrow


(Spencer Wagner) #264

It seems to be fully updated. I set it up from github two days ago and when I click on “update from repo”, there is nothing there.

I’ve actually had to remove it from triggering my get home routine. I’m going to look into trying to figure out a webcore flow where it will only consider the phone coming home if it had been gone for a certain amount of time. I’m pretty new to webcore, but this sounds possible.

That probably won’t completely solve the problem though. It seems that with the momentary "away"s, the presence sensor app loses track of what’s going on and it doesn’t switch back to being home. This only happens intermittently and only seems to be happening when the phone drops the wifi for a second.


#265

Was working on it Friday but ran into some issues. Should be done tomorrow. I’ll let you know.


#266

Just finished the update. The timeout has been added back in and is functional.

Let me know if you have any issues with it.


(Spencer Wagner) #267

Its working great. We’ve got it set up on 5 phones and they’re all working beautifully. Thanks a lot, I really appreciate it.

You ought to consider adding a donate link to the presence sensor app. Or, do you have Paypal? I’d love to send you maybe $20 or so for adding that back in for me. Direct message me your Paypal email if you’re willing to let me do it.


#268

Added a donate link. Any donations would be greatly appreciated. :slightly_smiling_face:


(www.smartukhome.co.uk) #269

Would this able be all to pull information to ST like phone battery percentage


#270

It currently does not have that functionality (although it wouldn’t be too difficult to add if there was interest in having that functionality)


(Amauri Viguera) #271

Just wondering if this has been tested on Android 9?

I’m using a Pixel 2 and 3 and it’s giving me errors installing the patch apk.


#272

I tested it in the Android 9 emulator. I’m running Android 8.1 currently on my phone but I have a pixel 3 getting delivered tomorrow. It should work on Android 9 but I will look into it more tomorrow when my phone arrives.


(Amauri Viguera) #273

Yeah I just noticed the error was an installation issue.

It was being blocked by the MobileIron work profile, even when I tried to install it via my personal profile.

I’ll let you know if I find any issues though.


#274

Ok. Just let me know if it has problems.


(Spencer Wagner) #275

I have it running on three Essential phones all running Android Pie.


(Amauri Viguera) #276

Yeah my first couple of runs in and out of the house and enabling / disabling WiFi worked fine, so it appears to work fine – with the patch – on the Pixel phones.

The only thing that I did notice is that I had to install the patch APK and open it after it installed, otherwise it wouldn’t communicate the state change.

My first test was installing the app and the patch apk, but I did not click on the “open” button after the apk was installed. In that case, everything still worked but I had to manually hit refresh before it would reflect the change.

After I re-installed the apk and actually clicked on the “open” button after it was installed, it started working as intended and refreshing automatically after it disconnected / connected.

WebCore integration is working fine as well on my end.


#277

The patch must actually be opened or it will not work. This is due to a security feature in Android. All apps are in a “stopped” state when they are first installed. No services or any type of background functionality will work until the app is opened for the first time.


(Amauri Viguera) #278

Understandable, and I figured that was the issue, but I was following the instructions… :slight_smile:

So maybe Step 1b should be “open both apps” before you proceed.


#279

Changed it in the instructions


(TOO FLY FOR A FLY GUY) #280

I just found this and can’t wait to test it. Thank you!

However, I really wish your repo wasn’t named SmartThings, just like everyone else. It really makes it a nightmare to find the right repo…