[RELEASE] Life360 with States - Track all attributes with app and driver. Also supports RM4 and Dashboards!

Yeah, had to add a few other pieces. First the attribute needed added:

attribute "accuracy", "number"

Then you need to update it when you get it

sendEvent( name: "accuracy", value: accuracy )

now it can properly test current from previous

Yeah, I just posted the bulk of the changes I made. There was 2 other changes to add 'accuracy'

line 96:
        attribute "accuracy", "number"
line 442:
    sendEvent( name: "accuracy", value: accuracy )

You definitely don't need to capture or update accuracy if it's not being used though. I was going to use it for my dashboard app but it's not used there either at the moment.

Figured that out, thanks!

I'm not sure how to install this app. I'm currently using the connector and it's not working anymore. Thought I would try this one.

Hi,
I just realized that the battery level or charging state is not correct on my wife’s phone (iphone 14)
Last night she was charging and at 37% but the notification if it’s under 20% to charge it been fired… and I check this morning and it was 100% but the device in Hubitat is still not charging and at 2%… something is not working and the location sharing is always and precise…
Any idea on this?
Thanks!

** I got it show the right value but I had to open the life 360 app on her phone… so no background update on the phone? **

Hi,

Just starting using Life360 and decided to compare responsiveness among Life360 Connector, Life360 with States, WebCoRE geo, Alexa geo, and Hubitat geo. First observation, the Life360 handlers behave differently with respect to push updates from Life360. Life360 Connector receives/reflects them. However, Life360 with States does not receive push updates: it only shows changes at the scheduled 30-second updates, regardless of when my presence changes. Has anyone else noticed this? If so, is there a solution?

Thanks!

I was actually just looking to make some changes to the last version of this app/driver and noticed your comment. I'd be very interested to know if another driver is able to receive updates differently than just polling the life360 server every <30> seconds.

I took a stab at modifying this driver a few months back -- see the code here

The gist of the changes were:

  • I know the driver polls every X (30) seconds and because of this every 30 seconds there's a bunch of updates made to the device, including the lastUpdated time, map, etc. But, what I'm really interested in is getting notified when actual changes occur -- either the device moved or the battery level changed.

  • I also wanted to add accuracy to the driver - which can be used on a map to show a radius around the PIN.. it indicates the user could actually be anywhere inside that circle. accuracy is passed from the device in Life360 - at least I saw it coming from both my kids devices (iOS and Android). The smaller the circle, the more accurate the location is.
    image

My original intent was to submit a PR to his repo but it's no longer being maintained.

I don't know much about how to get added to HPM (package manager) but I will try to add my changes to github and can send the link back when it's ready.


it only shows changes at the scheduled 30-second updates, regardless of when my presence changes

Anyway, I mentioned this because of your note here. My changes won't send out updates when nothing has changed.

I'm guessing that other drivers just poll more frequently - which is why you're seeing the updates arrive faster. But, if there was another way to get them 'pushed' - that would be ideal

1 Like

just wanted to post a couple of quick updates..

It looks like in addition to the 30 second polling of members, there is code that registers a webhook. I can't find any info about this API online though.. this is all I can find. But, I'll make sure to test it out and see when/if it's called.

    // subscribe to the life360 webhook to get push notifications on place events within this circle

    if(logEnable) log.info "Create a new Life360 Webhooks for this Circle."
    createAccessToken() // create our own OAUTH access token to use in webhook url
    def hookUrl = "${getApiServerUrl()}/${hubUID}/apps/${app.id}/placecallback?access_token=${state.accessToken}"
    def url = "https://api.life360.com/v3/circles/${state.circle}/webhook.json"

Anyway, I've made several updates already and I'll look into how hard it is to add to HPM as well once it's ready to go. My overall goal is to prevent unnecessary driver updates, expose more life360 attributes and make the driver clean and easy to update/maintain in the future.. I'll post more when it's closer

2 Likes

I created a new thread for continuation of this app if anyone's interested:

1 Like

I noticed this code in the Life360 States app, but it does not seem to work. The Life360 Connector (as well as Geofency and OwnTracks) provide updates in between the 30s window of Life360 States. This, to me, indicates that Life360 Connector is subscribing effectively to Life360 for push updates. (To be fair, I have not test-modified the app to look for a resolution.)

Yeah, I never saw it called either in my brief testing. Maybe it's a holdover of the original driver that isn't supported anymore? Or, maybe there's something not configured correctly.. I don't have much experience with OAuth (or writing drivers).

I do see 2 people mentioned in this thread who might know if/how it works:

Interesting.. I removed and re-installed the app and this time noticed an error about OAuth in the logs.. same one as this post: [RELEASE] Life360 with States - Track all attributes with app and driver. Also supports RM4 and Dashboards! - #561 by es_ferret

The answer right below it worked for me although I can't see what it actually did since the code looks the same. Anyway, I removed and installed again and now noticed this in the logs:

Successfully subscribed to Life360 circle push events

I'd be curious to know if it just stopped working at some point. I haven't seen the push event fire yet but at least this is a good sign that it will.

1 Like

Well i can verify the last time i looked at this the push updates worked. Lol i do rememver spending a lot of time on this. It has been a long while and i have likely forgotten most of what i figured out at the time. I can take a look though.

It will likely take me days to do what is trivial for the experienced so dont get hopes too high.

no worries - I think maybe it does work.. maybe I just never hit that OAUTH button in the apps code. I'm hoping with HPM that isn't necessary as it'd be a pain for a user to remember to do.

1 Like

Yeah this an inportant step. Not sure if hpm does it automagically.

I believe the developer builds a package and states of it's required. Then yes it does it all automatically from there.

Thanks! I switched over to Life360+, so I'll give that a spin. (And the log reveals the successful push message.)

Glad you picked this app up. I use the related Life 360 Tracker app. I assume upgrading the underlying Life 360 with States app will break the Tracker app, at some point at least. I don’t suppose you use that app as well and have plans to maintain that in association?

I have noticed over the last couple of days that this app has stopped working, the logs show

groovyx.net.http.HttpResponseException: status code: 403, reason phrase: Forbidden on line 189 (method refresh)

and when I click on the App I see...

It seems this code is no longer being maintained. You might want to look here:

3 Likes