[RELEASE] Improved Mobile Presence (Android only)

android
presence
dth_presence
project_presence
webcore

#241

Really appreciate the effort to provide the community with a reliable presence sensor. Thank you for your hard work. Like a few other users I can’t get this to work unless I manually refresh my status in the Presence Sensor app. Both ST and the Presence Sensor do not update themselves. I have a feeling its my phone but idk. I am running Android 8.0, GPS ON, No data or battery restrictions that I can see. I very badly want this to work. If anyone can point me in the right direction please. TIA.


#242

If you toggle the WiFi while the app is open, does it work?


#243

Turning WIFI on/off with the app open does not change the status. Only manually pressing the refresh button changes it atm.


#244

Interesting. Sounds like a permissions issue then. You have all of the permissions enabled I assume? It should at least update with the app open. Everything works as expected when hitting the refresh button?

Did you link your SmartThings account? Sometimes it can appear to not be working due to the delay (if you are not sure then you can PM me your device ID and I can check).

Side note: I’m currently looking into using the geofences in Android to improve the accuracy. This would mainly improve response time when leaving as the geofence feature can take a few minute to work. The geofences are what are used in the built in mobile presence so thats why I was a little hesitant to use them as it obviously didn’t go over well there. But anyways… if anyone has any feedback on using geofences as a second method of checking presence, let me know.


#245

I’m having problem with OAuth. Just after filling out device ID and client secret, Smartthings throw a Internal Server Error 500 at me.
I found out in another thread that I need to change connection points
from
https://graph.api.smartthings.com/
to
https://graph-na04-useast2.api.smartthings.com

Could you create an option to select which Smartthings’s server we need to connect in your page?

Thanks for your hard work putting all these together.


#246

Region does not matter when getting an OAuth token.

Regardless of the server the SmartApp is actually published to, https://graph.api.smartthings.com should be used to obtain the authorization code, access token, and endpoints.

https://docs.smartthings.com/en/latest/smartapp-web-services-developers-guide/authorization.html

What error are you getting? Make sure your Client ID / Client Secret are correct.


#247

Even though I am running 8.0…I hit a wall trouble shooting so I installed the 8.1 patch anyway and…

Connect to WIFI
Get push notification from presence sensor app “update successful”
Within approx 30 seconds ST shows I’m home.
When left open in background the icon in presence sensor app stays grey and does not change.
If I then close and open the presence sensor app or manually refresh it will show blue.
If I connect to WIFI without the presence sensor app open ST does changes to home and when I open the presence sensor app it shows blue.

Disconnect from wifi with app open or closed.
Nothing happens. No push notification of update.
Manual refresh. Receive push notification of update.
Approx 30 seconds later ST shows I’m away.

Progress :slight_smile: Yes, I double checked all my permissions they were all set as far as I can see. Also yes I had set up OAuth and connected to smart things. I will PM you my ID. Installing the patch seems to have it half working. Not sure why it doesn’t update when I disconnect. I see a few other people have this problem too. Thank you!


#248

Got it authorized now. I was using device ID instead of client ID. You may need to change your tutorial a little bit.

### Step 6: Authorize Presence Sensor

*This is a relatively new feature that I have been testing so please let me know if you have any issues*

1. Go to [https://st.callahtech.com/link ](https://st.callahtech.com/link)
2. Enter your **Device ID and Client Secret** from Step 5 and click “Next”
3. Sign in if prompted and check all devices created in Step 4 and click “Allow”

Will test responsiveness tomorrow.


#249

Opps… my bad. I’ll update the instructions.


#250

I decided to wipe my install and try from scratch. Followed the direction, made sure app permissions are set etc. Running patch on 8.0 (doesn’t seem to work without it). The app is properly setting presence for home and away in ST but ONLY if the app is open in the background. The grey/blue colors do not change without refresh or closing and reopening the app. If the app is closed it does not change anything and I have been receiving the following error. Figured id post bc it might help troubleshoot. Thanks again.

Update error #2
Error: com.android.volley.NoConnectionError:
java.net.UnknownHostException: Unable to resolve
host “st.callahtech.com”: No address associated
with hostname


#251

New update should be in beta in the next few hours. Been testing on my phone (Android 8.1) with patch for a few days and seems to work better.


(Fred) #252

This is the 2nd time i’ve completley removed and restore the apps and devices associated with your presence solution. as it stands it appears to work, but the home away acknowledgement takes 3-5 minutes. What am I missing?


#253

Any errors? Linked correctly and everything? If you turn on the status notifications do you see them immediately?


(Fred) #254

when i turn on status notifications i get them immediatley. it also updates my presence correctly if I’m in that 3-5 min waiting period


(Fred) #255

fyi - I normally have my VPN enabled when I’m on WiFi, but I don’t think that should matter


#256

If the issue is just with the SmartThings notifications, I have been noticing the same thing. Possibly due to Android battery optimization etc. As long as the status notifications come up immediately, it shouldn’t be an issue with anything other than notifications.

I don’t really have anything I can do about the SmartThings notifications as that is entirely handled by SmartThings. I just tell SmartThings to send a notification and their api handles it. The status notifications are from the Presence Sensor app and are sent only after an update is completed (if everything is linked correctly).


(Fred) #257

i’ll play around with it for a few days and let you know if i find something


#258

I’ve installed this on my Pixel 2XL with Android 9 and basically nothing happens unless I tap the refresh button. I accepted all the permissions when installing and have oauth enabled so would expect an instant update. So how do we troubleshoot the issue?


#259

You have the patch installed right?


#260

Er, no. I thought that was only for 8.1 I’ll try it now. Perhaps your instructions should say it’s for 8.1 and above of that’s the case.

What does the patch actually do?