Life360 Device Tracker Platform

FYI, it appears the Life360 server had a problem between about 5:15 PM and 6:20 PM CST yesterday. Unfortunately, the error message wasnā€™t very useful because of a bug I just found in the underlying Python package the HA Life360 integration uses to communicate with the Life360 server. Iā€™ve created a fix Iā€™m testing now and hopefully will submit it soon. But I was able to catch the error while it was happening and the real error was an HTTP 502 error, which means ā€œBad Gatewayā€. Basically, the server had hiccups. :grinning_face_with_smiling_eyes: I might implement a retry for that error since it did seem to be very intermittent and retries might have been able to insulate the HA integration from the problem, at least partially.

That server issue last night hit me also and I had to scramble to shut down some automations. Similar to what happened a couple of weeks ago. Prior to that it had been working rock solid with the last update.

Yeah, Iā€™m very unhappy that the integration is required to set the entities to unavailable when there is a server communications problem, but there isnā€™t anything I can do about that. This is one of the main reasons I use my composite tracker custom integration ā€œon top ofā€ life360 (and/or googe_maps.) It ignores unavailable & unknown states, so the rest of my system is insulated / isolated from this design flaw.

1 Like

Do you have a link or instructions on how to set this up with Life360?

3 Likes

What Gary said. :slightly_smiling_face:

If you have any questions about it, see:

Iā€™m happy to provide any assistance via that topic.

FWIW, Iā€™d recommend something like:

composite:
  trackers:
    - name: My Name
      id: my_name_composite
      entity_id:
        - entity: device_tracker.my_name
          use_picture: true

This assumes your life360 device trackerā€™s entity ID is device_tracker.my_name.

Thanks, Iā€™ll try that once I have another device tracker platform setup. I tried the Google Maps location tracker but ran into a problem trying to rename the cookie file in the config folder as it wouldnā€™t let me save it with a leading ā€œ.ā€

You can use it with just one. I do for a few people. Then you can always add the second tracker if/when you get it working.

Can I ask, I assume you had to do this as well. How did you save the file with the leading ā€œ.ā€ ?

Save the cookie file to your Home Assistant configuration directory with the following name: .google_maps_location_sharing.cookies. followed by the slugified username of the NEW Google account (account B).

Step3

  • For example: If your email address was [email protected], the filename would be: .google_maps_location_sharing.cookies.location_tracker_gmail_com

I use a Python virtual environment install, so itā€™s easy.

ok that makes sense but for someone that is not just wondering how would someone be able to execute that step . . . not that I expect you to know that answer but Iā€™ve been searching but havenā€™t found anyone else that has run into that issue so far.

How do you access HAā€™s config folder? I.e., how did you get the cookie file there? If you canā€™t rename it after getting it there, can you rename it before putting it there?

thanks, i managed to set it up and use this composite entity instead of life360 entity

hopefully now my house doesnā€™t shut down because home assistant lost contact with life360ā€¦

1 Like

Hi @CauseFX! Itā€™s been a while. lol

Iā€™ve finally gotten around to giving this a try. I was able to successfully send the request. And for some Circle Members, it seems to work almost immediately. But for others, it works only sometimes. However, if I open the Life360 app on my phone, all the Circle Members update pretty much right away. So, there must be more to it than just sending this POST request.

Can you fill me in more on what you discovered? Did you see any other traffic? Retries? I noticed the response contains a request ID, and and an item that indicates the request ā€œisPollableā€???

UPDATE:

Further testing shows that after sending this request for a given Member, that Member updates seven consecutive times (either on the very next seven queries, or possibly on seven consecutive queries after some amount of delay. Note that HA queries the Life360 server every 10 seconds.)

So now Iā€™m wondering if HA should be polling the request somehow and cancelling the request once it sees an update. Iā€™m afraid to release this code ā€œinto the wildā€ as it stands now, because it seems it has a very likely potential to have a detrimental effect on battery usage on the Memberā€™s phone/device.

FWIW, if I open the Life360 app on my phone, I see that HA gets updates for all the Members in my Circle on the next query, but it happens just once, not seven times.

If anyone has any insights into how this is supposed to work, by all means, let me know. Remember, the implementation I created is based on very limited ā€œreverse engineeringā€ someone did years ago. Iā€™m aware of no official Life360 API or related documentation, so itā€™s all guesswork!

I have this integration running for over 2 years with no problem. But this afternoon I started to get the following error:

ClientConnectorError: Cannot connect to host api.life360.com:443 ssl:default

Does anyone is experiencing the same problem?

Thanks for any help I can get.
Marco

I seems to be working ok for me, but I do get a message when I open up the Life360 app on my phone saying there is a known problem theyā€™re working on.

Thanks for your answer @pnbruckner.

I hope my problem is related to this problem. Iā€™m connecting from Europe.
Iā€™ll see tomorrow morning.

1 Like

Hello all,
I spent about an hour browsing through this and another Life360 topic and could not find what I was looking for, so hopefully you donā€™t mind me asking a, basic maybe, question.
I installed the integration, entered my daughters username and pw and all her friends showed up on the map. So far so good, but she (my daughter) was not shown on the map? In States a device_tracker linked to her is present, with all kind of relevant info, like Long and Lat, battery level, address and everything else, so the info is known in HA.

Q: is it standard behaviour that when a user is at Home that the avatar is not shown? That is not so in the app on the phone? Or ā€¦ is something else going on?

Are you talking about a Map page or a Map card?
Is your daughter is not displayed when she is at your current ā€œhomeā€ zone?