[RELEASE] Improved Mobile Presence (Android only)

Can you please private message me the link to the page it sends you to with the QR code?

@Johndc7 I just tried to install this and found that the app link in "Download Links" in post 1 is to the SmartThings app, which doesn't seem to work correctly on HE. (Gives invalid parameters error, which maybe what @breindl2005 encountered.) The other link in the post to the app is for Hubitat and seemed to work for me to at least get the device QR code.

Also. I am not sure if the patch worked on my device.. the button in the patch app for notification doesn't send any notification, but with some quick testing it appears that the presence detection is working.

Can you please private message the link it sends you to where you get the "invalid parameters" error? Then I can tell you for sure why.

That is a problem with the Presence Sensor app. You have to have debug notifications on or the test notification will not work. I will change this in the next update.

Sorry I didn't save it before finding the problem and resolving it with the correct version of the app, but I believe the first parameter was stId=1

1 Like

Sorry about the mix-up. Pi-hole can definitely get in the way of the Google API with volley.

1 Like

Ok I have it setup to double check a few things before the QR code screen displays. It's possible that not saving could have caused an issue.

Need some help getting this to work. I have the app and patch installed on my phone. I have created a location for both my house and my office, both are using WiFi. I can check my hub from the office and it says I am away (not that I am at the office) When I was at home for lunch I checked a tile that I setup as presence for my phone and it was red ( I assume that means I am away) The hub is getting my battery status When I do the test from the patch I get a message from the app saying it worked. Just not getting status to the HUB. What could I be missing?

This is on a Pixel 4a BTW

In the Presence Sensor app, do the locations turn blue? For example, this is what mine look like when I'm at home:

I just setup my phone to use the wifi at home and Voila mine looks like yours and my presence changed to Home in the device. I had the requirement turned on for the office, what does that do? I have that of for the home location

The whole requirement thing is a bit confusing but it's the simplest way I could think of implementing it.

Basically the idea is that a requirement must be true for you to be at a location but by itself does not put you at that location.

There are some examples in the instructions that might make it a bit easier to understand:

Wifi is HomeWifi
Wifi is HomeWifi5
Bluetooth is SmartWatch (requirement)

Scenario 1 (At home):

Wifi is HomeWifi - false / ignored
Wifi is HomeWifi5 - true
Bluetooth is SmartWatch (requirement) - true / ignored
Result : Present

Scenario 2 (Out running, left phone at home and wearing watch):

Wifi is HomeWifi - false / ignored
Wifi is HomeWifi5 - true
Bluetooth is SmartWatch (requirement) - false
Result : Not Present

Ah I see what is going on now. I am going to date myself here. Sort of like a nand gate. The required connection must be true and if not no matter what the other connections are the result will be away
Thanks for clearing that up for me

1 Like

Hi, I followed the instructions carefully, installed the app (with auth), the driver the android app, and the patch

I'm using a oneplus 8 pro with android 11

When i press "Pair this device" or "Pair another device" i get the following message:

then I get a notification in my phone saying "Error #3"

please help :slight_smile:

Well that's strange. The problem is definitely that stId is wrong. Did you install with HPM or manually from GitHub?

Might be worth checking to make sure you have the latest app version from GitHub. I believe that's one of the things that happens if you install the SmartThings version on Hubitat :slight_smile:

Thank you for your help. I indeed installed the SmartThings version from GitHub. Note that the link in your post is directing to this version and not the Hubitat one.

Now I installed it from HPM. still, I have an error. when I press "Pair this device" it shows a QR code. I scan it with the app and then I get 2 notifications - "Error performing internal sync" and "Error #3"

I actually managed to solve it. I just pressed "Done" on the app. I suggest that the first time you open the app it should say press done to install

Example

if (!state.AppIsInstalled) {
return dynamicPage(name: "MainPage", title: "", install:true, uninstall: true){
section("WakeOnLan") {
paragraph ""
paragraph"This software is provided "AS IS", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement."
paragraph ""
paragraph "To complete the installation, click on "Done""
}
}
}

def installed()
{

state.AppIsInstalled = true

}

I updated the instructions and removed the link to the SmartThings version. Thanks for the heads up!

When you press done the first time, it sends the oauth info back to the server so it can push events back to Hubitat. If that never happened then that would explain the issues.

Glad to hear everything is working.

1 Like

Can you help me set this up and get it working? I tried to install through HPM, but it wouldn't let me (clicked on it nothing happened. There's a Checkmark at the end rather than a download arrow.


I went to the links in the initial post and added the driver and app code by importing from the URL.

I followed the instructions, I think (the two install apps, steps 3 and 4 have me kind of confused) . Looks like I only have one instance.

I added my phone via "pair another device" .. Set my home based on wifi trigger (no option for geofence) , but it says I'm away. It doesnt let me set the presence. on my app the Location icon IS NOT BLUE (like in you post above.




What am I doing wrong?

Curious... Why would a 'patch' downloaded from GitHub be needed. Shouldn't the app on the Google Play store be updated? Especially since we are at Android 12 now. Who would still have a device using 8.1 or lower!?

The nearest I can figure, the patch must make it so it can interact with habitat. The App in the play store only seems to have access to Smart Things. Even the instructions are written based on Smartthings. I'm just trying to find a better combination for presence, Currently I'm using a combination including tasker, and the tasker portion is sucking my phone battery dry.

It looks like the battery level is syncing so it should be setup correctly. When you open the location you created in the presence sensor app, do you see the wifi trigger listed? You have to hit save twice (once when you create the trigger and again to save the changes to the location. Sometimes that causes confusion.

If that all looks right the I would double check the location permissions. I would double check the presence sensor app and the patch app to make sure location is allowed all the time.

@bptworld As for the reason that the patch is needed... Starting in Android 8.1 they made some restrictions to apps listening for wifi events which causes the app to not work correctly. The best way around that (that I have found) is to create a second app that targets a lower version of Android. Since the patch runs in compatibility mode, it can listen to these events and forwards them to the real app. It cannot be on the play store because Google does not allow apps that target Android versions more than a year old to be published. The Google play listing only mentions smart things because that's what I had when I originally created this. Maybe I should update the app listing :slight_smile:

3 Likes