GPSTracker with Life360, OwnTracks and GPSLogger integration

For information: mendhak provided the new version (100) in the android store. It’s now possible to use GPSTracker with GPSLogger via MyOpenHAB without sideload of the apk.

Hi,

Tried the presence detection thread but it seems it might be a owntracks issue so trying here too!

I’ve set up some items and rules as per the Generic PResence detectino example, modified them slightly to include a second person, but all still in the gPresent group.

Both my and my wife have owntracks on mobile and both have a region set to home, which when there is movement in or out of a region passes back on or off to my dummy item, (Presence_GP/EP_Home in the image below), so that it triggers the rule…everything perfect here, the logs show the logic working, and vPresent is set to off, (ie no one home), only if both of us are out…SUPERB…

Now for the issue,

Every morning I wake up and check the presence items, (I’m testing it for a while to make sure it’s rock solid before I apply logic to the home / away state), and it seems that sometime every night all the variables are setting themselves back to OFF for no logical reason - that I can see anyway!

Two instances from the logs.

image

image

Different times, but same result…it’s almost like the system is deciding to dump the variables and turn everything off.

The problem is that I now have to spend a day going in and out of region on OneTracks to reset them all properly so it’s up to date…do that and then sometime during the night I’m back to square one…

Any ideas anyone?

Got some time to play around and finally found the reason why my region triggers were not firing. I haven’t had my Region Trigger channel linked to an item. You can do this in Paper UI under Configurations -> Things -> Region Trigger

I have been able to get this to work by defining the state trigger, per this thread. But, I am curious why the following does not seem to work. Any ideas? I am trying to improve my understanding of OpenHab.

rule “Mikes iPhone Xr Enters Home”
when
Channel “gpstracker:tracker:MP:regionTrigger” triggered “Home/enter”
then
Garage_Door_Control.sendCommand(ON)
end

What is the recommended binding version?
The one that comes default with OH 2.4 or the version or the URL mentioned above ?

Hi,
I’m planning to extend the gpstracker binding to support Life360 application. It would be great if you could help me with testing. Let me know pls if someone’s interested.
Thx

1 Like

@gbicskei I’m an OpenHAB/Life360 user so integration between the two would be great. I’m currently trying out your binding and using OwnTracks - but finding OT not as accurate as Life360 in general.

Also, if it helps anyone wanting to see what else Life360 gives back from the API, I created a Postman collection of all the endpoints that I could find.

See: https://gist.github.com/alackmann/d4ead389f10042a8b280db93e0cae138

Hi,
I don’t think the Life360 is more accurate. If you play a bit with advanced settings in OT (locator displacement, interval, inaccurate locations) you can make the OT very!!! accurate and reliable.

In the meantime I’ve implemented a test version of Life360 integration using the same API you’ve mentioned. I can send you the binary it you would like to test it. My general conclusion is that the location provided by this API is delayed with 1-2 minutes compared to the real location. E.g. I’ve set up some automation when a family member is arriving home. With this delay I had to turn it off because the alarm was not disarmed automatically - I had to do it manually…

Yeah I’m happy to test. I don’t use Life360 for time critical events arriving home anyway. I use Bluetooth and Network presence instead as it’s more timely.

I plan to use Life360 for notifications when a family member leaves or enters a zone to do announcements and prompts in the home. I setup the script and cron and it works fine - but it’d be neater in the single binding.

I’ve found Own Tracks to be so sloooooow it’s almost unusable. I basically have to open the app to trigger a location refresh. So as I already use life360 this works great.

Oh and not sure if it’s outside your scope or not, but it’d be super handy to add a channel for the life360 ‘in_transit’ and ‘speed’ variables. As these could be handy in rules to calculate expected arrival times.

Binding test version with Life360 support [WP]

@gbicskei looking good, but it failed to create a thing for one of my users, as the email address with the user has a period (eg. firstname.lastname) and I get the following error in the logs:

2019-08-29 17:35:58.428 [ERROR] [nternal.handler.Life360BridgeHandler] - Failed to update circle 976635a0-420b-4b53-8829-f689eeacda48
java.lang.IllegalArgumentException: ID segment 'life360_firstname.lastname' contains invalid characters. Each segment of the ID must match the pattern [A-Za-z0-9_-]*.
	at org.eclipse.smarthome.core.common.AbstractUID.validateSegment(AbstractUID.java:97) ~[?:?]

(truncated the rest and anonymised the actual first/lastname)

Maybe rather than using the email address from Life360 to name the tracker, you use the actual firstName & lastName in the API response?

Also, extra credit if you add channels for each of the places configured in Life360 for each Thing (eg. https://api.life360.com/v3/circles/{{life360_circleId}}/places). That would be awesome!

I’ve fixed the tracker id. You can use the same download link as before.

I’m not sure about importing places. Till now I sticked to the binding side place maintenance. This is the case with OT as well to make things simple (what if a place is deleted/modified on application side…). You can create these channels manually in PaperUI.

Considering you have a Life360 ‘Thing’ that manages the connection, you could have an option there to allow the user to sync/not sync places.

I have a bunch of places in life360 and I can have the ability to copy these across - but tbh it’s not simple to setup gpstracker regions and afaikt you need to do it for every user. So for me, ideally these would just be the same.

As for changes - can the polling process modify the related things or is that problematic technically?

Yes it can. The new version creates the distance channels for Life360 places but it doesn’t check for updates. If you modify a place you need to delete the channel manually which will be recreated with the new settings.

@gbicskei awesome work on this binding! Made it much easier for me to get up and running with OwnTracks as I was expecting to have to setup my NGINX to handle TLS for an encrypted MQTT connection.

I have a suggestion though:
Currently the geofence triggers for presence switches are only set by the transition event, but what if you are already in the region? I suggest taking the "inregions": [] data from the OwnTracks location message and sending ON commands to those listed, and OFF commands to any other known regions. I also suggest using the regionDistance channels to determine the same thing for server defined regions. Server defined regions should take precendence over client defined regions with the same regionName though.

I know you explicitly state that these triggers only update when the client sends the transition message, but that behavoir for the binding is counter to its intended use for presence detection.

1 Like

Hello, Used to be I was also Life360 user before I had changed to OH+Owntracks. My experience is that OH + Owntrack is same accurate and usuable. I use it for my doorlock and heating control. One thing what I have realized. If you check the location of other family members in Owntrack it won’t give you accurate result. It lates compares to Life360. But information reaches OH accurate so if you create a visualization in e.g. in sitemap than you can check it in live through your OH server. If you are experiencing delays, you need to check your mobile phone and Owntrack settings. We use it on Iphone and Android as well. I need to make some changes on each phone to get a good result.

My problem with Owntrack is different. It is more resource cosuming on android than Life360. On Iphone it operates strange but works.