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

New bundle available...

2.6.4 - 09/06/22 - Added option to export all life360 Places to file

Also, files are now available on Bundle Manager

Thanks for making this app/bundle! Is there a way to create feature requests or send you pull requests to implement new ideas?

I’d like to add support for multiple circles. I have two circles, each of which has a “home” location defined (my house). This is because the members of both circles share their location with me but don’t share with each other.

My feature request is to allow selecting more than one circle in configuration and then selecting one home location from each of the circles.

Does that sound reasonable? Would you accept pull requests? I looked around but didn’t see the code on GitHub, only the zip bundles that go to HPM.

Pull requests are the only drawback to bundles that I've come across so far. I do accept changes/additions/fixes but with bundles, we can't do pull requests. As a work around, you can update the code, then upload it to your Github and send me a PM. I'll go and download it, test it and then pack it up and update my Github.

Just a quick note, please make sure you are using the latest code before making changes.

Looking forward to seeing what you come up with!

Thanks!

After the last hub update the states are not updating anymore :cry:
It shows th person at home, but the status is "away". The logs for the devices are flooded with errors

[error]com.hubitat.app.exception.LimitExceededException: App 11 generates excessive hub load on line 340 (method generatePresenceEvent)

For last several days, Hubitat Package manager throws the following
2022-11-07 11:53:22.624 AMerrorBad manifest for Life360 with States. java.lang.NullPointerException: Cannot get property 'betaLocation' on null object Please notify the package developer.

app:22582022-11-07 11:53:22.622 AMerrorError downloading https://raw.githubusercontent.com/bptworld/Hubitat/master/Ported/Life360/packageManifest.json: groovyx.net.http.HttpResponseException: status code: 404, reason phrase: Not Found

Bundle Manager

When setting up a rule condition using the powersource custom attribute, the rule is expecting a battery state of "battery" but "Life360 with States" is returning value "BTRY" instead, so the rule condition is never true. Is this a bug? is there a way to query device attributes as arbitrary text values instead?

The weird thing is that according to an old post, powersource use to use the value of "battery".
From this post: [RELEASE] Life360 with States - Track all attributes with app and driver. Also supports RM4 and Dashboards! - #2 by bptworld
248be4261837fdb57838b7ab12a5bbe336f79d60_2_210x374

I was on 2.6.1 but it wasn't listed in Bundle Manager so I installed the latest anyway (2.6.4). Now Bundle Manager says version is at 2.6.4 but the "Life360 with States" interface says 2.6.3.

Update: my workaround:
On battery is "NOT powerSource: dc"

Update2: workaround only partially works because rules expect powerSource values to be lowercase (eg: DC vs dc). So real workaround is to set a local variable to the value of powerSource at the top of the rule. Then have condditions to compare the local variable to "DC" and "BTRY".

1 Like

Am I missing something here:

I've added Bundle manager
Installed Life360 with States
Entered Life360 username/password

All I get is:

Life360 with States

Announcement: I'll be taking an extended break from coding. I'm not going anywhere and all code will still be available. I just won't be updating anything for a while. Thanks!

No devices created so it's doing nothing - any ideas? Thanks

Edit: It looks as though Life 360 is down. I can't login and Down Detector showing a huge spike in reports.

Hi
Is there a way to refresh the SavedPlaces?

I've added new places into life360, but only the original 3 that were there when I first set this app up are showing on the device.

Thanks

Hmm...I think that two places is the maximum you got but "address1" in device attributes shows those other saved places too. So if you want to do some automation then you should use address1 attribute.

Hi @bptworld - I was looking at your Hubitat github repo.. I was going to fork it and make a few small changes to the life360 driver -- then submit a PR if you were interested. Anyway, I noticed everything is in .zip files.

How do you view changes to the source code this way? Do these bundle/package managers only accept .zip?

Anyway, I figured if I fork it then it'd be easier to see what changes I made.. mostly for myself so I can get any future updates too.

Here's what I was changing:

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

Here's most of the changes I've been testing with on my hub.. it's working well so far. Obviously there might be some cases I'm not considering but I wanted to at least put it out there in case it benefits anyone else too.

    if(logEnable) log.trace "In generatePresenceEvent..."

    // JP: only interested in sending updates device when location or battery changes
    // -- current values --
    def latitude = member.location.latitude.toFloat()               // current latitude
    def longitude = member.location.longitude.toFloat()             // current longitude
    def accuracy = member.location.accuracy.toFloat()               // current accuracy
    def battery = Math.round(member.location.battery.toDouble())    // current battery level
    // -- previous values (could be null) --
    def prevLatitude = device.currentValue('latitude')
    def prevLongitude = device.currentValue('longitude')
    def prevAccuracy = device.currentValue('accuracy')
    def prevBattery = device.currentValue('battery')
    if (prevLatitude != null && prevLatitude.toFloat() == latitude && prevLongitude != null && prevLongitude.toFloat() == longitude 
        && prevAccuracy != null && prevAccuracy.toFloat() == accuracy 
        && prevBattery != null && Math.round(prevBattery.toDouble()) == battery) {
        if(logEnable) log.trace "No change: lat:$latitude, long:$longitude, accuracy:$accuracy, battery:$battery"
        return
    }
    log.debug "changed: lat:$latitude (was:$prevLatitude), long:$longitude (was:$prevLongitude), accuracy:$accuracy (was:$prevAccuracy), battery:$battery (was:$prevBattery)"

EDITED to handle null values better

3 Likes

pretty interesting! I was looking for that! Can you tell me how to install it? I see Life360 with States and Life360 Tracker in the bundle section. Do I just need to copy the raw code to hubitat apps for each and then desabled life360 tracker? Jus want to be sure before to proceed! Also, what is the refreshing rate and could it be changed?

Thanks!

Hi,
sorry but I try to install it in Hubitat apps and all I can install is the driver. As soon as I try to add (BPTWorld.Life360Tracker.groovy, BPTWorld.Life360TrackerChild.groovy,BPTWorld.Life360withStates.groovy) it tells me when I hit save : file not found #include BPTWorld.bpt-normalStuff

Do you know how to install it properly?
Thanks

BPT Worlds apps are found only in Hubitat Bundle Manager, so:

  • Search for Hubitat Bundle Manager (it's in Hubitat Package Manager) and install it
  • Open Hubitat Bundle Manager and first install 'Common Stuff Library'
  • Then in Bundle Manager install the Life 360 With States

ok..I must do something wrong... I found out Hubitat bundle manager in the github repo and installed it in hubitat. But as soon as I click on it it just open the app code... I should have done it the wrong way! I m new to hubitat so not sure to understand everything!
Thanks for your help!

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...