[RELEASE] Life360+ (BROKEN)

Gotcha. Yes, IsDriving and InTransit with values 0 are shown in Current States of both presence objects. They just never change, even though Life360 app is showing them moving far in excess of the configured minimum.

If you provide non-zero values for 'Minimum Transit Speed' and Minimum Driving Speed' in the driver's preferences it will use those to compare to the 'speed' attribute and adjust inTransit and isDriving, overriding the (always "0") values that the Life360 API provides.

I think we may have exhausted that possibility.

I'd say the last thing you could try is editing the driver. Comment out lines 301 and 304 (the if() block()

You'll now see this show up if your device is sending different locations - which should happen if you're moving

//    if (logEnable && (isDriving == "1" || inTransit == "1" || speed > 0.0)) {
        // *** On the move ***
        log.debug "Life360+ Driver: speed: " + sprintf("%.2f", speedUnits) + ((isMiles) ? " MPH" : "KPH") + ", distance: " + sprintf("%.2f", distanceUnits) + ((isMiles) ? " miles from Home" : "km from Home") + ", transitThreshold: $transitThreshold, inTransit: $inTransit, drivingThreshold: $drivingThreshold, isDriving: $isDriving"
//    }

I did notice a post from the original thread that mentioned that more values are sent with a paid Life360 account.. I'll try to dig that up. But, like I said I'm also on the free plan and I do get speed values > 0 passed so I don't think that's it

1 Like

Making some progress. It seems to be working now, although I haven't yet figured out why. I commented out that if block, and I also stepped through all the settings in the Life360 app finding no discrepancies. In the process I found another possible issue with arrival not triggering properly in another rule and this gives me a lot more to look at.

Oh, and regarding the data type of isDriving and inTransit, I had to go back to comparison to 1 rather than "1" and that part is working. I guess the text compare was literally looking for the quotes, so that way didn't work (see green highlight below)

Maybe I'm missing something, but when I select the map tile in HD+ it brings up the map view showing the world map at GMT.

If I press the blue bar at the bottom, it moves to the next device, and shows the same scale but centered on the device location. FWIW, the device location is inaccurate on this screen. Seems like stale data. Shows my wife's location 10 miles off her current location.

If I long press to edit the tile, it shows a view with the life360 device in the center of maybe a 2 mile radius. Current location of each device is accurate.

OneDrive photo sync is giving me fits ATM so I don't have images from my phone to post.

FWIW I just checked and see that it's still working with the latest driver version (my old testing was with an earlier version). I haven't tried using a rule yet but I'll do that and see if I can get a notification every time my daughter is in the car (isDriving) to test it out

Life360+ Driver: speed: 7.63 MPH, distance: 7.26 miles from Home, transitThreshold: 3, inTransit: 1, drivingThreshold: 5, isDriving: 1

Oh, and regarding the data type of isDriving and inTransit, I had to go back to comparison to 1 rather than "1" and that part is working.

It does make sense that this would be a boolean (true/false) and not a string (1/0). I'm not sure if it'd cause any problems changing it now with others though but maybe just something to think about for the future

Yeah, mine continues to work and not sure what is different. Oh well.

The challenge now is to make the rule smarter. It actually is working too well now with an event being raised when the person stops at a stoplight, for example. Another interesting thing is that turning off wi-fi at home for a moment triggered "on the move" since the position the router reports not equal to triangulation from the cell towers, so it appeared I travel a tenth of a mile in a quarter second. These things are what makes this a fun hobby.

I updated the driver to version 3.0.12 - primarily to change isDriving, isTransit, wifiState and charging to boolean values (instead of strings "1" or "0")

Sorry, this will likely break your rule. I did create a rule to test and it should be easier to setup in the future:

Well, that's ten seconds of my life that I'll never get back. :slight_smile: Good change. Thanks.

1 Like

just a quick heads-up -- I'm testing a new feature of this app that will speed up (or slow down) the refresh rate when one of the Life360 devices are moving.

Today, the app will refresh the user's device state (ie: poll Life360 API) every 30 seconds.

What I'm doing is -- when 1 or more of the Life360 devices has moved, I'll do the next refresh 15 seconds later instead of 30. If the user continues to move I'll lower it to 10 seconds. If the user stops moving it'll go back down to 15 for the next refresh and then back to 30 again.

I made it a setting though so you don't have to use it if you don't see the need.

My goal is to mimic (as close as I can anyway) users actively moving in my dashboard app. Of course it'd also apply to the html tile that others display so it'd have the same benefit

It's not updated yet -- I'm going to make sure it's well tested first so I don't have to push out needless updates. If you have any thoughts on it let me know.

6 Likes

updated - 3.0.14

By default it'll do this 'auto' refresh logic so if you only want every 30 seconds or every minute (new) just open the app, change this setting and hit Done

Let me know if any issues!

2 Likes

Thanks @jpage4500 for this update, I am using the html tile and it always displays Not Moving even when my kids are driving. The inTransit and isDriving fields always say false so maybe that is why. I did notice that the acceleration field does change so maybe that is a better trigger, your thoughts?

My guess is you have not opened the devices created by the app and entered values for 'Minimum Transit speed' or 'Minimum Driving Speed'. Putting values in there will override the values for inTransit and isDriving that Life360+ API provides. The problem is I have never seen the Life360+ API return anything other than 'false' for InTransit or isDriving regardless of the speed provided.

Just came across this, haven't had a chance to try it out, but thought I'd suggest a tiny change to the html attribute.

In the Life360 with States Driver code I made a tiny alteration to add classes to the html so I could restyle the tile (mainly so it didn't take up as much space). I also noticed I changed the div height to 100% from 90%, again so I could fit more in. I suppose I could have added a class name there too.

image
My mods...


#tile-38 .tile-title {
position: absolute;
bottom: -10px;
color: #ff0000;
font-size: 30px;
}
#tile-38 img, video {
border-radius: 35px;
max-width: 120%;
height: auto;
vertical-align: -139px !important;
}
#tile-38 .tile-primary p {
position: absolute;
margin-left: 11px;
margin-top: -26px;
line-height: 17px;
}
#tile-38 .tile-primary a {
font-size: 30px !important;
color: #00ff37;
position: absolute;
left: 15px;
width: 310px;
margin-left: -100px;
margin-top: -61px;
line-height: normal;
}

1 Like

I would suggest you make sure you are on the latest version ('Update' or 'Repair' in HPM) and see if that works for you (mine works as expected). If it does, then something in your 'mods' may be the issue.

1 Like

copied from another thread from @rjterry21 :

Also, what's the possibility of getting the Tiles ("Items" in Life360) that are tied to Life360 to show?

I'm open to supporting this but I'd need some help as I don't have any Tiles to test with. I see 3 API calls made to life360.com -- listed below. Hopefully the tile data would be returned in 1 of these -- ideally the last one:

          def urlCircles = "https://api.life360.com/v3/circles.json"
            def url = "https://api.life360.com/v3/circles/${state.circle}/places.json"
            def url = "https://api.life360.com/v3/circles/${state.circle}/members.json"

What would help is to see an example response that contained the tile(s). You can do this by going to Apps Code and editing the Life360+ app. Look for the following code block and add the log line:

members: (~ line 527)

def cmdHandler(resp, data) {
    if(resp.getStatus() == 200 || resp.getStatus() == 207) {
        result = resp.getJson()
        log.trace "Life360+: cmdHandler: $result"

Save this and watch the Hubitat logs until you see this log line show up. Copy the text and feel free to change any sensitive values like lat/lng or account ID's and either post it in a snippet here or DM me.

If nothing about the tiles shows up in the members response then I'd guess it's a new API call

Hi Everyone,
In reviewing HE logs, l am recieving the following error messages

Life360+: cmdHandler: resp:hubitat.scheduling.AsyncResponse@c3adc1

Could someone please advise as to how to fix this error?

Thanks in advance

Me too. It happens occasionally.