[RELEASE] OwnTracks Presence

Played a bunch more, and I see why you start to get increases in battery consumption. OwnTracks has stated that how each phone implements "significant monitoring mode" is radically different.

For my Google Pixel 7, running Android 14, this is what I observed.

  • locatorDisplacement How far the device travels (meters) before receiving another location update. If "0" then it will send a location as soon as it senses movement
  • locatorInterval Device will not report location updates faster than this interval (seconds) unless moving. When moving, Android uses this locatorInterval/6 or '5-seconds' (whichever is greater, unless locatorInterval is less than 5-seconds, then locatorInterval is used). Requires the device to move locatorDisplacement distance, otherwise no update is sent

IE:

  • locatorInterval=0-seconds, then locations every 0-seconds if moved locatorDisplacement meters
  • locatorInterval=5-seconds, then locations every 5-seconds if moved locatorDisplacement meters
  • locatorInterval=10-seconds, then locations every 5-seconds if moved locatorDisplacement meters
  • locatorInterval=15-seconds, then locations every 5-seconds if moved locatorDisplacement meters
  • locatorInterval=30-seconds, then locations every 5-seconds if moved locatorDisplacement meters
  • locatorInterval=60-seconds, then locations every 10-seconds if moved locatorDisplacement meters
  • locatorInterval=120-seconds, then locations every 20-seconds if moved locatorDisplacement meters
  • locatorInterval=240-seconds, then locations every 40-seconds if moved locatorDisplacement meters

The above is the reason messing with the interval seems to have no change to battery life. I'm trying the pegLocatorFastestIntervalToInterval to true, with locatorInterval=30 and locatorDisplacement 50m right now.

2 Likes

More knowledge to share (values updated above). :slight_smile:

Not 100% sure, but it seems that GPS's locations requested by one app might be served up to other apps that need locations since they are available. When I was running high power (GPS mode) with fast intervals, battery drain was pretty high (Life360 was high as well which is making me believe that it wakes to consume the "free" location event).

I've found that the above gives really decent battery life. Couple notes though regarding balanced power mode (locatorPriority: 2):

  • It will grab a GPS location if it needs it. Doesn't seem to happen much in the city since there is a lot of cell/wifi points it can grab, but highway for sure
  • You don't get a bunch of jitter when not moving since the location is fixed to a wifi point. With GPS, I get a bunch of jittery locations due to the location accuracy errors. Stops you from burning battery when at fixed locations
  • If you want to use this for automations, you would just need to make sure the radius around a region is large enough so that you are guaranteed a trigger. For me, I can only use 75m where our house is, or it can trigger on the main road behind us. 75m isn't enough to make it reliable. 200m would most likely be a lot better.
3 Likes

Can't seem to get this thing past a 401 error, despite getting all the set-up done, and getting back the confirmation from the server that my URL is correct.

The phone logs say:

2023-12-07 22:43:13.098 E MessageProcessor: Message delivery failed. queueLength: 517, messageId: 1702006975352-afd4b2
2023-12-07 22:43:13.099 W MessageProcessor: Error sending message. Re-queueing
2023-12-07 22:43:13.116 I MessageProcessor: Waiting for 16 s before retrying
2023-12-07 22:43:29.814 E MessageProcessorEndpointHttp: java.lang.Exception: HTTP request failed. Status: 401
	at org.owntracks.android.services.MessageProcessorEndpointHttp.sendMessage(SourceFile:528)
	at org.owntracks.android.services.MessageProcessor.lambda$sendAvailableMessages$0(Unknown Source:2)
	at org.owntracks.android.services.MessageProcessor.$r8$lambda$bVYaIhYhXtJCzBaSxWOGtcUu6f8(Unknown Source:0)
	at org.owntracks.android.services.MessageProcessor$$ExternalSyntheticLambda1.call(Unknown Source:4)
	at java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at android.os.Handler.handleCallback(Handler.java:938)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at android.os.HandlerThread.run(HandlerThread.java:67)

The Hubitat Logs say

app:5452023-12-07 10:27:19.316 PMdebugOwnTracks-Presence: Updated with settings: [isDebug:true, presence:[OwnTracks1]]
app:5452023-12-07 10:27:19.254 PMwarndebug logging for OwnTracks: true

For the record, Android Client ver 2.4.12 needs the following preferences set (assuming HTTP protocol, not MQTT):

Preferences -> Connection

Mode - "HTTP"
Host - Paste in the long URL the app creates when you configure it, and insert your username here (don't include the brackets, of course)

                 .../location/[username]?access_token...

Identification:
Username - same username as above
Password - leave blank
Device ID - leave blank
Tracker ID - leave blank

Once this is done, the "Status" screen should show a "Response 200"

So, despite claims to the contrary in several places, one DOES have to insert the username into the "Identification" parameters

Gotta say, your settings have improved my Owntracks experience - thanks very much. Battery usage is down and accuracy and response is excellent. I get located quickly and accurately.

Thanks very much for your work on this and for sharing the settings info. Five :stars: :stars: :stars: :stars: :stars:'s. :smiley:

2 Likes

Hi Is it possible to report driving status (speed). That can be a useful info for implementing automation based on entering geo-fence in car or a person walking. I was trying to use that from Life360 on a webcore piston but my Isdriving was always reported false even though i was driving and speed was reported in numbers while in Webcore I only saw options between low, low-med etc.

I tweaked it a bit more, performance is about the same, better battery life, notes on the 3-settings changed:

  • pegLocatorFastestIntervalToInterval: true
  • monitoring : significant
  • locatorPriority: 2
  • locatorDisplacement: 50
  • locatorInterval : 60 (better compromise for battery)
  • ignoreInaccurateLocations : 50 (I was getting spurious locations at home that would place me outside my geofence)
  • ignoreStaleLocations : 7.0 (this just removes friends that didn't report any location after 7.0 days)
  • ping : 30

With this, I find Life360 is coming in at 8% of my battery, OwnTracks ~3%. Geofencing is working great, decent updates to OwnTracks recorder (if you use that). Only exception is ignoreInaccurateLocations at a lowe number in locatorPriority=2. It is looking for locations from nearby wifi access points. You might have "no reported locations" for a while if you are moving slow away from buildings (like on a walking/cycling path). When you are moving faster, it seems the phone switches to GPS to get a pin.

2 Likes

Thanks - I've updated my settings w/your suggestions and will see how they go.

One thing - I cannot update ignoreStaleLocations - no matter what I enter on my phone in "Editor" mode, it does not update. I've tried "7" and "7.0" (no quotes, obviously) and neither works - the ignoreStaleLocations stays stuck at 0.0.

Any ideas? I've used the "Restart" option to restart OwnTracks but that didn't help.

I believe this value should be "1" not "significant" right?

2 Likes

Yes, sorry, that is correct.

2 Likes

Hmmm... never seen that. All that does is flush the friends list of "stale friends", so no real performance issues. You would just see them fall off the list if they didn't report in after a while.

1 Like

Yeah, it's weird...no matter what value I enter I get a "Invalid value entered" error. Oh well, I think I'll be allright. :slight_smile:

Are you using iOS app, I don't see locatorpriority settings , peglocator and Ping:

Android version has two places that allow you to change settings... Under Preferences. Maybe the iOS app does something similar, and the"missing" setting is in another location in the app?

Advanced and Configuration Management

Thanks for your response. Unfortunately iOS APP doesn't have those options. The screenshot I posted above is all it has to modify, How reliable is owntracks location reporting, I am not too concerned about the battery usage at the moment. I just want to automate garage opener with a tight geofence of < 30 m. Eventually if possible I would like to use it with a customizable geofence like this one:

brchri/tesla-geogdo: A lightweight app that will operate your smart garage door openers (GDOs) based on the location of your Tesla vehicles, automatically closing when you leave, and opening when you return. Supports multiple vehicles, geofence types, and smart GDO devices. (github.com)

This is incredibly accurate with my Tesla & a polygon geofence for both open and close the moment I am <10 ft away from my house. I am hoping to do something similar at least to auto-open for my wife with her phone when she is in proximity of door.

Not sure how iOS does it, but Android uses the Fused locator service that all of the other apps on your phone would use.

For the best performance, I'd switch it to "locatorPriority:3". That would use only GPS (not wifi). You get a bit of a battery hit, but each location is a GPS pin.

1 Like

If you have an Android, you can use Improved Mobile Presence to set up a "Driving" location that triggers when your phone connects to your car via bluetooth. Used in connection with OwnTracks (or other geofence-capable) presence devices, you can accomplish what you are asking about.

1 Like

Unfortunately we all have iPhones in our home. I hated the restrictions on iOS and have used Android for a while but then carrying multiple cables was such a pain I had to move to iPhone myself:-(

1 Like

FWIW, we have moved our Samsung Android devices over to Magsafe charging, so we no longer worry about cable types (USB micro, USB-C, Apple lightning, whatever) at all.

Car mounts and home charging locations are all Magsafe. All it took to make the change from plugin charging was getting a couple Magsafe compatible cases for our phones, and desktop and car Magsafe chargers. Love it, and it's all compatible with my kids GFs, who use iPhones.

I'm having another go at improving my "location clock" - there were some code issues and some mechanical ones around the servos.
Those are sorted, and I'm back at trying to improve the performance of owntracks on the family phones (android and iphone). I've taken @lpakula settings above & applied them to the android phones, and to the settings, such as they exist, on the iPhones.
I'm still not happy with the performance though - has anyone seen this sort of behaviour?
my android phone picking up me leaving home & broadcast "not present" at 13.07. it then sent an updated lat/long 1min20secs later (I was driving).
I returned home at 13.10 (short trip!).
at 14.03 it had not registered my return. on my phone I checked my location in google maps.
I looked in owntracks at my regions:


and I'm not showing as "here"
despite that being pretty clear on the map:

(I'm in "significant changes" mode)
I then hit the upload button top right - went back in to regions and there was no change. I went back in to map, hit the upload button again, and then it responded.
looking at the logs,

2023-12-28 13:07:54.448 I MessageProcessorEndpointHttp: Message id=1703768873398-ea9342 sent in 1043ms
2023-12-28 13:08:58.792 I MessageProcessorEndpointHttp: Message id=1703768937864-9077bc sent in 906ms
2023-12-28 14:02:28.926 I ServiceStarter$Impl: starting service
2023-12-28 14:05:49.669 I MessageProcessorEndpointHttp: Message id=1703772349004-418ee2 sent in 656ms
2023-12-28 14:05:50.283 I MessageProcessorEndpointHttp: Message id=1703772349016-331a98 sent in 607ms

It looks like the service stopped and then restarted? but owntracks was running all the time.
Battery usage is set to "Unrestricted":


"Pause app activity" was allowed - but that is for long periods of not being run at all isn't it?:

I probably ought to report this in the owntracks github, as it's clearly all to do with owntracks and not hubitat, but has anyone got any ideas?

Cheers,

James