[RELEASE] OwnTracks for Hubitat Presence Detection

I must be thick. I have this:


in the Apps code area.

If I open the Apps I get this:

Not sure how to confirm if the new version is running.

Also appear to be having app log errors now:

To be absolutely sure, look at the line in the Apps Code that I showed you.

image

Take a look in your apps code app list to ensure you don't have the Owntracks app showing up twice. Oh wait, you do have it twice. Likely the first is the older version and the second is the newest...but check their version numbers in the code.

Also, how do I fix this on my android, I cannot find it in the program:

I do have it showing up 2X what do I do to fix it:

I tried to delete the old one, but it won't and is stating it is still in use. How do I change to the new one and delete the old one?

Android:

  1. Got to Settings>Apps
  2. Choose the "info" option (small letter i in a circle) in the pop-up menu
  3. On the App info page choose Permissions
  4. Choose Location
  5. Choose Allow all the time

Lower down on the Permissions page uou can also turn off "Pause app activity if unused" if you want to keep Android OS from taking permissons away if you don't launch the app.

Actually...this should be faster I think.

Copy/paste the app code from the 1.6.1 version into the older version, and then save the changes.

Then delete the second unused app instance in Apps Code.

Then go back into HPM and run a match-up - it should then match up to your one instance of the app.

Then you can go back into the app on your Apps page and configure as desired. The newer version should help w/your errors...

1 Like

I updated HPM and then sent a manual update from the Android app and no problems. I had imperial data in the state variables. I'm going to have to add this to my bride's iPhone this weekend.

1 Like

For those that are trying to duplicate Life 360 presence and want to display locations on a map within a HE dashboard, take a look at the following two posts/threads. For me, this looks to be the final piece of the puzzle.

UPDATE: following the directions in both threads I was able to add a map on a dashboard that shows your location.

3 Likes

I was able to get out for a walk and I got kind of odd partial reporting...I got a "Not Present" when I left:

...but it seemed to get "stuck" and stopped reporting when I was very close to home and never gave me a "Present" event...events have been sitting as below for over 25+m after I got home.

Below are logs as I arrived and they do seem to show Presence noted, but the message never gets to the OwnTracks device.

Update: At about 2:19 I finally got a Present event from the OwnTracks device. I was home after the walk when it happened.

Let me know if you want me to try anything...it was working well until Wednesday and then problems started.

Version 1.6.1 will fix that. There was an issue on the cast when it's trying to convert metric to imperial.

Are you on version 1.6.1?

1 Like

If you go to ' Settings -> Apps -> OwnTracks -> Permissions -> Location' you will see the radio buttons to select how the location permission works as well as the precise location slider.

Looking at your log, it is showing that your wifi is turned off. If you turn it back on, does it fix itself?

The Google "Fused locator service" does some black magic wizardry with wifi+celluar+GPS. If wifi is off, it might be stuck in cellular only, which would explain it not putting you back at home. With wifi on, the phone listens to all wifi access points and Google mines that for location while saving battery by not spinning up the GPS.

I have a setting on the phone (S21) that turns Wi-Fi off when not near known networks to save battery. So it should turn off when I'm out for a walk, and turns on when I get near my house very quickly. It's been that way since I started using your app (and of course was in place when I was using Brian's) so I don't think that would be the root of the problem.

Also, I don't think that would explain the time from Wed late afternoon until today when I was home, Wi-Fi was enabled, and I didn't get any presence events.

Of course I will turn off the Wi-Fi setting on the phone to be sure...need to rule things out. Too bad we can't rule me out. :wink:

I do wonder about the "Home" locations I have in the app if there is something there I'm doing wrong. I currently have two Home locations, the "Hubitat Location" option and a second "Home" option that I think was pulled from my phone?

Is there a "best practice" on this - just use the Hubitat Location unless your home isn't where the Hubitat is? Thanks!

Hmmmm.... odd. Nothing was changed that should impact the presence, except if you were getting the errors in the log (like from 1.6.0). Those errors occured as the location was pushed to the driver, and then the driver would have aborted, hence no presence.

If you don't have wifi on, then you are relying on triangularization from cell towers in your area. Maybe one is offline for service or something? That would break how the phone could locate you.

Has for "home" locations, whichever you select is copied into the "application state -> home" map that is used to determine if you are home or away. Doesn't matter if there are two, since only the selected "home" is placed in there.

One Cavet of using the "Hubitat Location" is some US ISP's don't supply the lat/long of you, but if their head office (I want to same Comcast, but don't quote me on it). This might only be an issue if you are using their cellular data points though.

Once a location comes in that puts you within your home geofence, the distance from home will collapse to 0.0. Maybe turn on the debug on your child device as well, as that would get displayed on each location update to the device in the logs.

1 Like

This actually caught my eye, as today we have had problems with Verizon service related to phone calls not working. I wonder if over the last couple of days, Verizon's been having general cell tower issues and we just weren't aware of it. Interesting...

Thanks for the details I am away from home now but will dive into them a little bit more and look at my setup.

I was out today for a bit and then back, same result getting stuck at not present the last little bit before getting home. I changed back to Use Hub Location and saved, and almost immediately got a "Dana is home" notification (have a rule setup to text me at presence changes) and the driver is updated and showing home properly again. The timeliness of the result w/the change seems like it clearly points to the Home location change to Hubitat Location as being the key change.

So...only change (I forgot to turn off the wi-fi setting) was to using "Hubitat Location" vs. "Home" location (that I think originated on my phone?).

In any case I think I'm back to normal, and I think I will not futz around w/settings that I am not competent to futz with. :wink:

1 Like

Wow... I've got this working in little to no time, for the most part. Thanks a lot, lpakula!

One issue I have is with the recorder. I have set up mosquitto and owntracks-recorder on Docker (on Synology), and in the logs I can see that the recorder is connecting to mosquitto. So far, so good.

I then went into the "Recorder Configuration" section of OwnTracks, and entered the IP address of my Synology box. Whenever my location changes in OwnTracks, I end up getting a "408" response, which means it's not connecting to the recorder.

Any ideas on how to troubleshoot this? I've tried appending the port number to the URL, and still doesn't work.

Wish me luck on successful install of Owntracks.

Took me a while only because i couldnt locate the Manual Update to the mobile app android

Somehow it finally worked and updated to where i can do the final changes

Added to my dashboard and now i will see the presence working or not.

My Life360+ is still working as of right now and will transition to this when it stops working

2 Likes

@lpakula

Any advice on this error?

app:11982024-01-05 10:17:07.005 PMerrorjava.lang.IllegalArgumentException: The JSON input text should neither be null nor empty. on line 591 (method webhookEventHandler)

OwnTracks: request.body [requestSource:cloud, HOST:cloud.hubitat.com, SCHEME:null, headers:[Accept-encoding:[gzip, deflate, br], Accept:[*/*], X-forwarded-port:[443], X-limit-d:[ot], Host:[cloud.hubitat.com], Cloudfront-viewer-asn:[20115], User-agent:[OwnTracks/17.0.5 CFNetwork/1485 Darwin/23.1.0], Accept-language:[en-US,en;q=0.9], Content-type:[application/json], X-limit-u:[jason], X-forwarded-for:[174.82.255.8, 130.176.
![IMG_5019|230x500](upload://2WeELWDUfNo7S5yVQ7CClp0rVWC.jpeg)
![IMG_5020|230x500](upload://juzuMWcmxPO8KsxjpmzlHVYqIAn.jpeg)
50.76], X-forwarded-proto:[https]]]

The error shows up as soon as I open
the iphone app and it tries to update.


Owntracks log

2024-01-06T05:15:32.061Z  [Connection] state connecting (1)
2024-01-06T05:15:32.530Z  [Connection] state error (2)
2024-01-06T05:15:32.530Z  [Connection] set reconnectTimer 16.000000
2024-01-06T05:15:38.115Z  [Connection] idle
2024-01-06T05:15:48.535Z  [Connection] reconnect
2024-01-06T05:15:48.535Z  [Connection] state starting (0)
2024-01-06T05:15:49.214Z  [Connection] sendtHTTP owntracks/jason/hidden(0):
2024-01-06T05:15:49.215Z  [Connection] NSMutableURLRequest https://cloud.hubitat.com/api/hidden/apps/1198/webhook ({
    "Content-Length" = 0;
    "Content-Type" = "application/json";
    "X-Limit-D" = ot;
    "X-Limit-U" = jason;
})
2024-01-06T05:15:49.215Z  [Connection] state connecting (1)
2024-01-06T05:15:49.528Z  [Connection] state error (2)
2024-01-06T05:15:49.528Z  [Connection] set reconnectTimer 32.000000
org.mqttitude.MQTTitude 2024-01-05--23-54-45-873.log