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

Ok, I installed the bundle manager by importing zip inside hubitat bundle section... But for now I only have the Location tracker user driver that is installed... I cant figure out how to install 'common stuff library' just cant find it. I have BPTNormalstuff in library section but stuck there! :slight_smile: Thanks

You have the code there but it isn't installed yet...

Once you have the Bundle Manager in Bundles, in the menu go to:

Apps > Add User App (top right corner) > Select Bundle Manager from that list and install it

Once you've done that go back to Apps in the menu and you'll see Bundle Manager. Open the app and you can do everything from there (install Common Stuff then Life360 with States)

I already look inthere but the bundle manager is not there...I can see it in bundle section but nut in new app-> create user app... I only have hubithings there... Any refresh to perform? I ll try to exit and log in...

I'm not sure. I didn't import it the way you have, I installed it from Hubitat Package Manager. To be fair it's a bit confusing but but world removed his apps from Hubitat Package Manager and created Hubitat Bundle Manager and put them there.

here what I got in bundle manager


But nothing in the new app...

@jpage4500 Rule Machine can trigger based on attribute value changes, but as far as I know, it doesn't expose the previous values... which seems to be what your modification is adding to this app.

There was some discussion about exposing previous values but I'm not sure if anything came out from it.

I'm out of ideas unfortunately. I would start again and not bother with the GitHub for this. Make sure you have Hubitat Package Manager installed then install Bundle Manager from there, then install the Life360 app from Bundle Manager.

I install virtually all my apps through Hubitat Package manager as it keeps everything up to date.

1 Like

I deleted the bundle and library...then reinstalled it and it works... But I cant find common stuff... is it this one?
image

The code snippet here is what's called every 30 seconds as a result from an API call to life360 to get the device's location/state/etc. There's a lot of logic that happens after this point but the code here will compare the location passed in with the current device's location (+ battery). If they're the same it will skip all of the extra logic which sets a bunch of device attributes.

But, my goal was to prevent all of that work if the device hasn't moved or nothing else has changed. The end result for me at least is fewer device updates being sent to my dashboards which listen to changes via the /eventstream websocket.

3 Likes

Yes thats what you want first.

@jpage4500 Thanks for your work on this. I too, have been receiving excessive "spammyDevices" notifications for this driver. I like your approach, and I will also test the changes and report back.

In the meantime, I also wanted a way to change the polling schedule. Every 30 seconds is simply overkill for my uses. I needed something more like every 20 or 30 minutes. So I have made an option which will give a few selections for adjusting that polling interval.

This is in the BPTWorld.Life360withStates parent app.

Find this line (around 283):

input(name: "logEnable", type: "bool", defaultValue: "false", submitOnChange: "true", title: "Enable Debug Logging", description: "Enable extra logging for debugging.")

And insert the following line directly below it:

input "poll", "enum", multiple: false, required: false, title: "Poll Interval: ", defaultValue: "30 Seconds", options: ["30 Seconds", "1 Minute", "2 Minutes", "5 Minutes", "10 Minutes", "20 Minutes", "30 Minutes", "60 Minutes"], submitOnChange: false

Now, find this line (around 461):

schedule("0/30 * * * * ? *", updateMembers)

Comment it out; and add the following below. Final code block should look like:

//schedule("0/30 * * * * ? *", updateMembers)

if( poll == "30 Seconds" ) {
    schedule("0/30 * * * * ? *", updateMembers)
}
else if( poll == "60 Minutes" ) {
    schedule("0 0 0/1 * * ? *", updateMembers)
}
else {
    poll = poll.replace( " Minute", "" )
    poll = poll.replace( "s", "" )
    schedule("0 0/${poll} * * * ? *", updateMembers)
}

Now, go to the Life360withStates app; open it; scroll down to "Other Options" and there will be a new option for "Poll Interval".

It will default to the original "30 Seconds" value. But if you select a different option and save; the schedule will be updated to reflect the new value.

1 Like

Mine doesn't seem to be passing accuracy. It keeps showing as a null.

image

If I remove that it seems to be working

I haven't looked at @jpage4500 's code yet. But it looks like he is checking what is passed back from the api response (member.location.accuracy); against what is set as the current value for accuracy (device.currentValue('accuracy')).

What is missing, is where he updates the devices accuracy variable from the api response. When this gets properly updated; then you'll have a current value to compare.

I do not think we have all of @jpage4500 's code. I have to run to work for a few hours. But I'll be taking at look at this when I get home. I love his approach!

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