[OBSOLETE] Improved Mobile Presence (Android only)

Hello, i keep trying to pair my device and the smarthings program keeps opening a webpage which gives me an error and then nothing happens.

I have read all of the pages and wonder is the server down or did i messup somewhere. I have device handler etc all working and have both the android google play software loaded and patched etc…

thanks in advance

What is the error you are getting?

Hey thanks for quick response.
I am attaching screen shot. Parameter invalid

Please DM me the url it is sending you to.

https://st.callahtech.com/pair/?stId=a1775f4b-34e0-49bb-ac4a-a2ab2e550e7d&id=user_uuid:81c4adfe-14e9-49c8-975e-b0b45a22589a%7Ca1775f4b-34e0-49bb-ac4a-a2ab2e550e7d%7Cdc918dbd598469eb&current=true

Hi there.

I’ve tried to follow the instructions, but obviously I’ve done something wrong as I’m getting an error :frowning_face:

Error 3: This request is not authorized by the specified access token

Can someone please help?

J.

That is caused by the smartapp not giving the presence sensor server a valid api token.

Open the smartapp from the smartthings app and hit save and that should fix it.

Thanks for the quick reply :slight_smile:

After some fumbling about and opening/closing various things I seemed to fixed it :+1:

One observation during my install, it looked like you repo was empty, I had to use the cut and paste method of getting the code installed.

J.

Just been testing the functionality and it seems to work good.

I am occasionally getting the following error (I see other people have had this in the past, but I couldn’t see what the fix was?):

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

J.

So that error is a connection error. Most of the time that happens because it tries to update while your phone is in the middle of switching networks. It does retry though so it is nothing to really worry about unless you notice it isn’t updating.

At some point I’m going to update the app to not show those errors unless it has like 10 failed attempts.

I assumed it was during the transition of networks. I noticed during my testing that it queued the actions/requests/status while it couldn’t contact your sever. Once it re-established comms my light (which I was controlling based on presence) turned on and off a few times in quick succession lol

The errors are just annoying, but I can live with them :slight_smile:

Thanks for your help,

J.

Hi,

I’m been testing your app(s) a bit more and not having much luck :frowning:

I am simulating arriving/leaving by turning my wi-fi on/off on my phone (so with switches between wi-fi and 4G). The android app detects the change (icon goes from purple to grey) but throws and error “Update error #3: Error setting presence” and ST doesn’t detect the change.

After a while I re-enable my wi-fi, again the app detects this but throws a different error “Update error 2: No address associated with hostname” .

Any ideas?

J.

ps - I’m running Android 9 (security patch 1st August 2019)

So the error setting presence is a server error (should be fixed now) but for future troubleshooting the is what the errors mean:

Update error #1: Error within app before being able to attempt a connection to the server (should never happen)

Update error #2: Error when contacting the server (most of the time due to being between networks - not much to worry about unless you see like 10 or them and it’s not syncing)

Update error #3: Server side error (These can come from a few different places. If it says anything about a token or authentication then update smartapp and device handler, open smartthings app, go to presence sensor smartapp, hit save. If it says anything else, let me know and I will look into it)

As far as the error you were getting, that was an issue on my server caused by my internet not working. This wouldn’t normally be an issue except it wasn’t reporting the errors correctly (normally it would report the error and traffic would get routed to a different server). I was also getting that error and it appears to be good now. Let me know if you have any other issues :slight_smile:

Appreciate the explanation and quick response :+1:

I do seem to get Error 2 quite a bit, is it more a name resolution issue during the switch or the fact the IP address is not allocated to the phone yet? If the former, could your app store the IP address temporarily and only refresh/perform a hostname/dns request if it fails to get a server response?

Is there anyway of reducing the delay in retrying to send the presence update to your server once that error occurs? The network switch/dns update on the phone is quite quick (appreciate there will always be some outage) but it looks like your app takes a while longer to retry and send the update?

I think I set it to retry after like 30 seconds. It is also only supposed to try to sync when there is an active internet connection. The name resolution and other stuff will fail when it is between networks due to not being able to contact the DNS server so it wouldn’t really help to cache the IP addresses.

Most of the delay you are seeing is probably smartthings not sending the notifications quickly. If you are wanting to see the exact timing on it, you can turn on the status notifications in the settings on the presence sensor app. The status notification will tell you once the update actually goes through to smartthings instead of only notifying you of errors.

It was from experience of dealing with other OSs and apps with networks where I had fun and games with name resolution even when connectivity was working.

I did have status notifications turned and there was a delay. I’ll do so timings and see.

Thanks again :+1:

Me again :slight_smile:

This might sound a stupid idea/feature request, but…

Would it be possible to get your Android app to check the presence of a paired Bluetooth device and if not present then notify ST?

I’m not quite sure how Bluetooth on android works, whether it’s event driver or you’d need to poll the device? I’m not sure of the battery implications either, but hopefully BLE negates them.

Thanks,

J.

Do you mean showing Bluetooth devices with the WiFi networks and if you are connected to a Bluetooth device or on one of the WiFi networks then you are at that location?

Hi @johndc7 - thanks for all of your hard work on this project! I just ran through all of the installation instructions and everything seems to be working except for one major thing - I see my device listed in “My Devices” but it’s not listed in webCoRE’s physical device(s) list, so I can’t click on it and use it for conditions within my pistons. I tried going to the webCoRE app in Automations and checked under Available devices to add it as an actuator in the setup, but my device isn’t listed there either. I must be missing something here… help!

Thank you,
Jonathan

If you go to the webcore smartapp, then settings, available devices. Make sure you have the devices checked. :slightly_smiling_face: