[RELEASE] OwnTracks Presence

While I'm not 100% sure as I went straight to HTTP, I believe in the setup instructions is does mention that you lose that capability. As for showing regions and such I'd suggest using Tile Master 2 and setting up whatever info you like for your dashboard. That's what I use, this is what I have on my dashboard.
image

FWIW, I also took the lat and long from the OT driver and used the Google Map iFrame driver to put our actual locations on the dashboard, too; so I can track everyone... muhahaha :slight_smile:

1 Like

I don't suppose you could be persuaded to provide a "how to" for this? If it's too involved, maybe in a separate topic?

1 Like

It's actually really easy, Load up the Google Maps iFrame driver and create a device with said driver.
Create a rule in RM to update the Google Maps lat and lon whenever a change in the OwnTracks lat (or lon) is detected. Here's my rule, you do need to create a local variable to get the second value into the Google driver. I trigger on a change from the OT driver, update the Google lat with the new value, then I move the lon value into a variable then into the Google driver (it can't go direct). Then I run the updateFrame() function, which is a custom function in the Google driver which re-centers the map on the new location. 'Location Mark' is the Google device in this rule.

Then obviously plop the Google device onto a dashboard. Now, the Google map has a lot of extra crap on it that covers up parts of the maps (links, Logo, etc). You can't 'remove' those items but I found that if you play with the CSS you can hack it a bit to keep them out of view. My tile is modified like below and the only thing visible is the map. Basically what you do is make the map huge but center the tile on your location, this pushes all the crap outside the tile viewing window. You have to play with the margin settings for your particular install because it is dependent on your tile size.

#tile-30 .tile-contents{
padding: 0;
overflow: hidden;
height: 300%;
width: 300%;
margin-top: -75%;
margin-right: -50%;
margin-bottom: -50%;
margin-left: -100%;
}

2 Likes

Wow, that's a great write-up, thanks very much. I'm looking foward to saying muhahahaha as I track the crap out of my family... :wink:

1 Like

I've been using this Owntracks implementation for a few months now. For the most part it "just works" and I don't have to think about it. However twice now I've had an issue where Hubitat stops receiving location updates. Each time I restart the phone, checked iOS and App settings, etc but to no avail. An uninstall and reinstall of Owntracks mobile app seemed to fix it. However the last time this happened I also checked the Hubitat logs for [OwnTracks Presence] Hubitat app and found some errors which were logged at the same time Hubitat wasn't receiving location updates. My assumption has now moved from it being an issue with the Owntracks mobile app or mobile phone, to instead being an issue with the [OwnTracks Presence] Hubitat app.

Has anyone else experienced this? Any suggestions?

The errors were:

app:1242022-12-03 12:46:14.832 PMerrorjava.lang.IllegalArgumentException: The JSON input text should neither be null nor empty. on line 125 (method updateLocation)
app:1242022-12-03 12:46:11.961 PMerrorjava.lang.IllegalArgumentException: The JSON input text should neither be null nor empty. on line 125 (method updateLocation)
app:1242022-12-03 12:46:09.886 PMerrorjava.lang.IllegalArgumentException: The JSON input text should neither be null nor empty. on line 125 (method updateLocation)
app:1242022-12-03 12:46:02.661 PMerrorjava.lang.IllegalArgumentException: The JSON input text should neither be null nor empty. on line 125 (method updateLocation)
app:1242022-12-03 12:45:53.495 PMerrorjava.lang.IllegalArgumentException: The JSON input text should neither be null nor empty. on line 125 (method updateLocation)
app:1242022-12-03 12:45:48.347 PMerrorjava.lang.IllegalArgumentException: The JSON input text should neither be null nor empty. on line 125 (method updateLocation)
app:1242022-12-03 12:45:45.224 PMerrorjava.lang.IllegalArgumentException: The JSON input text should neither be null nor empty. on line 125 (method updateLocation)
app:1242022-12-03 12:45:43.156 PMerrorjava.lang.IllegalArgumentException: The JSON input text should neither be null nor empty. on line 125 (method updateLocation)

Setup details
Hubitat: Platform Version 2.3.4.117, Hardware Version Rev C-7
Phones: 2x iPhone 12's with latest iOS and Owntracks app.
(Let me know if any further info would be useful)

Thanks for the detailed info. I pushed an update to remove the null json issue. You can also comment out line 81 in the app, save, then go re-enable debugging and debugging will stay on indefinitely. This may help in diagnosing any issues. I re-configured OwnTracks (don't use it regularly as it kills my battery - Geofency is much more battery-friendly) and messed with it while walking this morning and it appeared to properly report entries and exits. One thing to keep in mind, if you see the notification from the OwnTracks app about arriving and leaving that location, then it SHOULD also trigger an update for the mapped Hubitat region/user.

IMO it's more user friendly too. It's easier to set up. Easier to control tracking - the default in OwnTracks is to report all locations (I'm sure it's easy to only track specific locations, but the documentation is so-so.). Geofency also has a Mac app if you want to do more analysis.

1 Like

I am having trouble with wife's iPhone. It is reliably sending update Lat/Lon which is a victory over other presence detection options that I have tried in past. However, it is not changing status of present/not present or on/off. It's working fine for my Android. I have the Home setup on iPhone just like on Android. Any suggestions? I am sure it has something to do with my inexperience (and extreme dislike) of Apple products. :grin:

EDIT: When iPhone is Home, there is a red dot when in Regions settings. If I change the lat/lon to force an exit, the dot is blue. Is that correct?

Yes.

You might find OwnTracks to be more reliable using MQTT. I've used it for about 4 years now. 1.5 years with an Android, and 2.5 with two iPhones. It is equally responsive and accurate in both situations. I have only ever used it with an MQTT server.

1 Like

Do you use a cloud based MQTT broker? I have Wireguard split tunnel that includes my local MQTT broker for my Android but that will be a tougher option for my wife's iPhone. She hates me messing with her phone.

Local broker, with wireguard on my phone.

1 Like

I did some Googling. I didn't realize that the Wireguard iOS app allows you to specify Wireguard On Demand when connected to cellular or not connected to home Wifi. I wish the Android app had similar. I use Tasker for that logic on my phone.

1 Like

Yes, it does. I thought the Android app also supported that, but it has been so long that my memory must be wrong.

I thought OwnTracks didn't report location on android in the background any more unless you open the app at least once after a reboot - which my family won't do?

I know for a while some android users had tasker just open the OwnTracks app one time after a reboot, but that isn't an acceptable workaround for me.

That still seems to be case and, yes, easily resolved with Tasker.

Got it.

Yeah, that's when I stopped using OwnTracks. Not going to manage a bunch of tasker rules on 4 different phones.

Life360 works in the background just fine.

@brianwilson - I'm just looking at OwnTracks as a replacement for running Life360 for my kids phones. This app seems perfect as a way to use the Hub as the server.

I just wanted to ask a couple of questions while playing around with it..

  1. Can a 'lastUpdated' field be added so I know the last time a device checked-in?
  2. Is there any way to store some kind of location 'history' so I could build some kind of route-type UI? It wouldn't have to be anything special - just a list of the last X lat/lng/radius entries or something

For reference, I'm updating my dashboard app to treat these owntracks devices the same as Life360 - by displaying a google map

3 Likes

I’m up for suggestions on how to do the history. I suppose you could use event history? Would using MQTT be a better way to implement this, perhaps? I can add a lastUpdated should be trivial to add; I’ll see what I can do.

I'd kinda like that too, if you can do it that would be nice, Brian.

Both true...needs to be opened after reboot, and I use Tasker to do so. Not an issue for me, and Owntracks is still my preferred option on Android. I use Tasker for other things as well and adding the Owntracks restart was trivial.

2 Likes