Life 360 support

Glad it worked. But you should probably thank @brazen1445 instead of me; I just copied him :slight_smile:

Right, Also If anyone else runs into this i found you shouldn’t add the Mac address its not reliable

Thanks @brazen1445 for your help everything is working great

Hey, guys, I am fairly new to HA got most things running great and I know enough Linux to get by but this one is over my head.

I have my Life360 account setup and running on my iPhone along with CloudMQTT.

Here are some of my questions:

  1. You run the script on any Linux box and make sure mosquitto_pub is installed.

I am on a pi with Hassbian I believe that mosquito is installed as part of the AIO and I installed jq already.
What location should this file be created in, such as the home directory or homeassistant directory?
What do I save the file as I noticed a lot of people calling it or do I just run it and background it?

  1. I have this setup as a
  • platform: owntracks

and I use Cloud MQTT so I have

port: 10704
client_id: life_360
keepalive: 60
username: xxxxxx
password: xxxxxx

But I do not see this come up in my known devices yaml.

I see this as my mosquitto_pub path according to Cloud MQTT /var/lib/mosquitto/10704/mosquitto.conf Is this correct?

  1. Are the sensors a necessary part to make this run or are they just used to get info?

Thanks in advance for the info sorry for all the questions but I cant fully peice this all together.

@enigmacarpc I run the script as a service in the background. Maybe a stupid question, but you did remember to edit the file first, right? Editing the first 10 lines as described above?

Try using this guide for testing MQTT. Then run the script, and see if you get the info showing up on your command line. For instance, I run

mosquitto_sub -h -v -t "owntracks/#"

Before running the script (as a service, but it shouldn’t matter for testing). Then I see my MQTT notifications being published the the “owntracks” topic (and sub-topics). Something like:

owntracks/aephir/phone {"_type":"location","tid":"s7","acc":16,"batt":76,"conn":"m","lat":REDACTED,"lon":REDACTED,"tst":REDACTED}
owntracks/REDACTED/REDACTED {"t":"p","tst":REDACTED,"acc":50,"_type":"location","alt":0,"lon":REDACTED,"lat":REDACTED,"batt": 77}

Where the top is my owntracks (actually owntracks) and the bottom is from the life360. Let me know if this works.

@Aephir I haven’t run the script yet I was confused as to where if needed the script was to be placed but you are saying to just run it and background it.

Also, I am using cloud MQTT not a local MQTT server I am not sure where to point the mosquitto_pub line to point to.

Thanks for the info I’m still not 100% but will run the script and test.

Update: ran mosquitto_sub -h -v -t “owntracks/#” got bash mosquitto sub not found.

Installed mosquitto locally and fixed that issue.

Now when I run the command I get bash: /etc/mosquitto/mosquitto.conf: Permission denied.

The script does see my Life360 info as far as the users I have setup I see them listed before the permission issue.

So my 2 current issues are 1. how to fix the permission issue and 2 how to use this with a cloud MQTT.

I can’t be of much help with a cloud MQTT. Maybe you can just change the info in the top 10 lines? Or maybe it needs a local MQTT broker running? I actually don’t know.

I missed that you were using cloud when suggesting the mosquitto test. If it can be used, you could probably do the same with cloud? Test what is published to “owntracks” topics when running the life360 script?

If you want to use mosquitto, the /etc/mosquitto/mosquitto.conf (and /etc/mosquitto/conf.d/) are not scripts, they are configuration files. You need to edit them, so e.g.

sudo nano /etc/mosquitto/mosquitto.conf

I had some issues with setting up mosquitto, and ended up having to do a clean install of Debian. But I got a lot of help, and the method outlined in this thread worked for me. One of the users there posted config files as well, so you can use those as guidelines.

@Aephir I dont think you are understanding where I am at.

I have changed the first 10 lines and ran the command, the result was /etc/mosquitto/mosquitto.conf: Permission denied.

I have already edited the mosquitto.conf file with my info.

So I am looking into why when I paste your command string I get a permission issue on the mosquitto/mosquitto.conf

As for mosquitto itself, the MQTT works just fine as I have run some tests and gotten messages.

I would prefer to use Cloud MQTT but this seems to be an issue because your script needs to see a local mosquitto pub file, so I have put that all on hold.

Ahh, sorry, perhaps I was a bit tired when reading.

OK, what are your permissions for that file? Try these

ls -l /etc/mosquitto/

And see what it spits out for each. You should at the very least have read access to the user who will be running it. E.g. mine says:

ls -l /etc/mosquitto/
drwxr-xr-x 2 root root 4096 Jun  7 20:46 ca_certificates
drwxr-xr-x 2 root root 4096 Jun  7 20:46 certs
drwxr-xr-x 2 root root 4096 Jun  7 20:46 conf.d
-rw-r--r-- 1 root root  415 Apr 19 00:36 mosquitto.conf
drwxr-xr-x 7 pi   pi   4096 Apr 18 01:10 tools

So everyone can read the mosquitto.conf, even though it’s owned by “root”. If this is not the case, you can use

sudo chmod +r /etc/mosquitto/mosquitto.conf

which adds the “read” permission (for everyone! Change accordingly if that’s an issue for you) to that file. Hopefully I understood the problem this time :slight_smile:

Oh, and it’s not my script. All credit goes to brazen1445, I just used what he/she made. I have no clue at all about how to actually make that from scratch (and barely a clue to what most of it means/does).

Update: I figured out the issue with permissions my mosquitto_pub="/path/to/mosquitto_pub" was not set to the right path it was pointing to the mosquitto.conf file.

After running the command now it just sits there saying 1497556848 INFO: requesting members
“user name”
“user name”

No new device in the .yaml file

So I am not sure what is wrong now.

Sorry for all the posts but that’s how it goes in the world of the Homeassistant.

I was able to get everything working seemed to be an MQTT issue after fixing the above problems.

The issue seems to be with adding my own mosquitto install as the AIO for Hassbian did not install the service fully I ran an install of mosquitto again on top of what I had installed and I noticed that 2 strange devices were in my knowndevices.yaml and I knew it was working once I saw that.

It’s odd I am able to use 2 different logins and passwords as my first mosquitto install points to a password file with another password then what I setup in the new mosquitto install.

But so far this is the best presence sensor ever as I have been working with Trackr for a month and their app and system are garbage I wrote an article on another thread and basically the app was taking 3-5 hours to update locations and they fixed the issue after 10 support tickets but the Trackr app only updates your location in the app it doesnt send that info to home assistant for 30 minutes and sometimes you need to actually open the app and view the info for it to update.

@brazen1445 Thank you very much for the script! I was able to integrate it with no problems and have it running as a service via systemctl. Created all my zones in HA and am able to add Life360’s stable device tracking to my current presence detection. Really appreciate you putting it together.

Hey, maybe I should have posted in this thread first, but I wasn’t sure (I’m still not) if it’s specifically related to the script or not. But I’ve had issues after updating HASS. The location only works when I’m home, anywhere else it jumps between that location and “home”.

Has anyone seen anything like this? Or any ideas if I missed something important?

I noticed a few days ago it wasn’t working right, but today it has been fine, wife drove all over town today and it updated at every zone.
I haven’t updated to 47.0 yet still on 46.1

Is there an API call/day limit?

@brazen1445 Thanks so much for this script! Got it up and running in a matter of minutes on my local MQTT server.

@ntalekt Would be interested how you got this to run via systemctl.

Me and my family have been using this app for a while now and it’s great to have it working in Home Assistant, I was just about to set them all up with OwnTracks but it would have been a nightmare convincing them it was needed.

A question though, as it polls every 300 seconds. Will everyone in my circles notice a drop in battery life? I’m not sure how life360 works but won’t it keep polling their devices for a location update?

Anyone noticed battery life decrease?


Hopefully @brazen1445 or someone else might have a clue what’s up here as I am super excited to run this. I too hae found Life360 to be the best iOS based location app. I have been playing with Owntracks but I find it times out too easily and stops running, at least on iOS 11 Beta.


I have the script installed and upon running I get:

INFO: requesting access token
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
	[-e pattern] [-f file] [--binary-files=value] [--color=when]
	[--context[=num]] [--directories=action] [--label] [--line-buffered]
	[--null] [pattern] [file ...]
(23) Failed to writing body

INFO: requesting circles.
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
	[-e pattern] [-f file] [--binary-files=value] [--color=when]
	[--context[=num]] [--directories=action] [--label] [--line-buffered]
	[--null] [pattern] [file ...]
(23) Failed to writing body

and that repeats for as long as I run the script.

Any ideas?

Okay fixed my own issue by running the commands manually in a shell and fixing stuff step by step.

Two things I needed to fix:

  1. My password had a special character in it that was forcing an escape in the script. Fixed that.
  2. After soom Googling I found out that thre -P (Perl) flag has not been avialable in OSX since 10.8 so that is why the grep’s where failing. So two choices: Fix the grep (I am no grep-xpert) or just install the GNU version of grep. To do that for OSX: /usr/bin/ruby -e "$(curl -fsSL" and then brew install grep --default-names (note the --with-default-names allow you to use GNU grep with the normal grep command. (this one maybe @brazen1445 can put this in host script comments or something)

After this my devices showed up in known_devices.yaml.

Hopefully this will help get people working on OSX if they have had issues. I also have this working with Opentracks and also have my bridge from Smartthings ( My plan is to see if I can use the Life 360 sensor (which is only home/not home) via Smartthings for arrival scripts but then Life 360 for locating people in other zones outside the house. Only reason is I am not sure how low I can take the timeout of this script to trigger arrival home scripts where as the Life360/Smartthings integration is almost instance on arriving in the Life 360 home zone.

Script no longer seems to be gathering data from Life360. When I run a tail of nohup.out I get the following…

glenn@zeus:~$ tail nohup.out
1504615921 INFO: requesting access token
1504615921 INFO: requesting circles.
1504616221 INFO: requesting access token
1504616221 INFO: requesting circles.
1504616521 INFO: requesting access token
1504616521 INFO: requesting circles.
1504616821 INFO: requesting access token
1504616821 INFO: requesting circles.
1504617121 INFO: requesting access token
1504617121 INFO: requesting circles.

Previously it would show a list of the people in my circle every time it would request data from the Life360 site. Anyone know what’s going on?

@brazen1445 I am still having the above error. Script was running fine for a long time but has just stopped for no apparent reason. Has Life360 changed something that prevents the script from logging in and getting the information?

I wrote a custom component in python for Life360 based on the shell script someone wrote. The python based custom component makes HTTP calls to the Life360, renders the data in OwnTracks format and drops it into the MQTT. I configured OwnTracks with my Home Assistant, and the device trackers are automatically updated.

Here is the Life360 custom component

Also check out the Life360.yaml from my repo at