Home Assistant Community

Life 360 support

#1

As far as reliable background location updating goes with iOS, Life 360 has been the most reliable client I’ve used with Smart Things (It blows owntracks out of the water on reliability). It would be fantastic if someone could write a component for Hass. In the mean time I’m tempted to try and adjust the Smartthings mqtt code to pass on the life 360 location and battery info.

Life 360 Integration?
My Home Assistant configuration… IT'S ALIVE
HELP : How to Mimic HA Zone Triggers in Node-Red
My Home Assistant configuration… IT'S ALIVE
My Home Assistant configuration… IT’S ALIVE
#2

No need to edit anything. See my reply to your post on the Smartthings message board. :slight_smile: It’s as simple as adding the Presence Sensor in the Bridge smartapp.

#3

I would be interested in this… @atomicpapa can you provide more details. Thanks!

#4

Life360 connects to Smartthings via a Smartapp, Smartthings connects to HASS via the ST-MQTT Bridge which is a combination of Smartapp on the ST server and a bridge app on your own server.

#5

So that would require SmartThings? If it can connect to ST, it should be possible to interface with HA.

#6

Exactly. The bridge allows you to pass anything connected to ST over to HASS via MQTT

#7

The only problem is the Life360 app for smart things keeps the lat/long/ and battery info internal and only passes present and not present through the MQTT bridge. https://community.smartthings.com/t/current-mobile-location-lat-lon/37775/10

#8

Is the app working only with smart things hub?

#9

Was taking a look at this- life 360 is most accurate across both phone platforms.

Can someone help out converting this to python

First you need to get the bearer access token via this call

https://api.life360.com/v3/oauth2/authorize?client_id=pREqugabRetre4EstetherufrePumamExucrEHuc&response_type=token&redirect_uri=http%3A%2F%2Fhome-assistant.io

using this bearer id you can get the following

Circles
curl -X GET -H “Authorization: Bearer XXXX bearer code from above call XXX” https://api.life360.com/v3/circles.json

From Circles you can use the circle id to get

Places

curl -X GET -H “Authorization: Bearer XXXX bearer code from above call XXX” https://api.life360.com/v3/circles/XXX Circle id XXXX/places.json

and Members
curl -X GET -H “Authorization: Bearer XXXX bearer code from above call XXX” https://api.life360.com/v3/circles/XXX Circle id XXXX/members.json

Which reveals their lat long and batt etc in JSON. which is what we need

There is a web hook setting to trigger when a change of a member happens but still trying to figure how use that
"https://api.life360.com/v3/circles/${state.circle}/webhook.json"

2 Likes
#10

Wow…this is perfect. I did not even know that there was an API available. I’m hoping someone can help us integrate Life360 in HA.

#11

Adding a Me Too for this feature request please.

Thanks.

#12

Me 3 :wink:

Thanks

#13

This feature would be a great addition. I currently use Life360 in combination with IFTTT. It would be great to bring it all into Home Assistant.

1 Like
#14

Would love to have this as well!!

1 Like
#15

I wrote a quick shell script to login to life360 and publish a mqtt message. It’s pretty basic but seems to work well. Just fill in your username and password in the script and run it. You also need to add the following to your configuration.yaml:
"device_tracker:

  • platform: owntracks"

You can find the script at https://pastebin.com/3q3ntT0a

2 Likes
#16

Wow…this is exciting. How do we run the script? Can you provide little more details and steps involved? Also, if I already have a MQTT server (mosquitto), can I just use that? IN which case, what should mosquitto_pub="/path/to/mosquitto_pub" be?

Location using life360 script not working after homeassistant update to 0.46
#17

I’ve been using life 360 for a long time and got tired of checking for the promised api. If the app is now useable that would be awesome. I have found it to be a reliable app. I tried it with IFTTT and getting a response 15-30 minutes later was pointless. This is encouraging news!

#18

You can run the script on any linux box. Make sure you have jq and mosquitto_pub installed. mosquitto_pub is part of the mosquitto package, so if you have mosquitto installed mosquitto_pub should already be on your server.
Create a new file on your linux server. paste the code from the pastebin into it. Change the top ten lines to your personal information. Chmod +x the file and run it. It requests member locations every 300 sec (set by the timeout var) it then publishes a JSON message (in the owntracks format) to owntracks/FirstName/DeviceID/ on the mqtt server you specified.
Use nohup to run the script in the background when your done testing.

I am just starting to evaluate home assistant to run for my home automation. I did not want to invest to much time into this. I don’t sanitize any input from life360, so don’t name your kids Tommy’); DROP TABLE or anything silly. Also, life360 does not publish any info about their api so they might block this at some point.

Show input_boolean status
#19

I copied the code to file life360.sh, modified the first few lines, and have both jq and mosquitto_pub installed. I ran the script and get the following errors:

[email protected]:/home/hass/.homeassistant/python $ ./life360.sh
./life360.sh: line 4: username360: command not found
./life360.sh: line 5: password360: command not found
Error: Unknown option '='.

Use 'mosquitto_pub --help' to see usage.
./life360.sh: line 7: mqtt_host: command not found
./life360.sh: line 8: mqtt_port: command not found
./life360.sh: line 9: mqtt_user: command not found
./life360.sh: line 10: mqtt_pass: command not found
timeout: invalid time interval ‘=’
Try 'timeout --help' for more information.
./life360.sh: line 21: syntax error near unexpected token `<'
./life360.sh: line 21: `    read - a circles_id << <$(curl - s - X GET - H "Authorization: Bearer $1" https: // api.life360.com / v3 / circles.json | grep - Po '(?<="id":")[\w-]*')'
#20

change first line to #!/bin/sh