Using Life360 with Home Assistant

Tell me if you have heard this one before. Home Assistant doesn’t seem to know where you are when you use your phone as your presence tracker.

We have all been there. Notifications firing that you are home when you are not. Or watching automations, that should happen only after you leave, happen like you are not actually sitting in your house.

Before moving to Home Assistant as my main home automation hub, I relied on Smartthings. Even in Smartthings presence tracking was iffy. This is because I use my phone as my presence tracker. As convenient as it is it has some inherent problems. Like the phone sleeping or the need for wifi to be on. Your phone may not respond to pings if it is sleeping and sometimes people turn off wireless on their phone. And while I don’t have a big need for presence, it sure makes home automation more powerful when your system knows if you are home or not.

So I started using Life360 and man, what a difference. I haven’t dug into why Life360 seems to be so good at location services while not being a drain on my phone’s battery, but I am impressed. In my testing the various device trackers, Life360 continually notifies me that I have left a zone, or entered a zone faster than iCloud, Owntracks, or even nmap. Even when Apple’s own Find Friend’s app can’t get a lock on a family member’s location I can pull up Life360 and see not only where they are but how long they have been there. Add that I have never had a false notification on top of that, and it appears to be a pretty solid solution. The only downside is there is not native connection to Home Assistant.

If you are using smartthings to mqtt bridge then you can stop here. You can just add the presence sensors to the bridge and send that data to mqtt. The details are over on the home assistant forum. I am working on getting away from smartthings completely and don’t really care about battery or actual locations for this particular use case. I simply want to be able to know reliably when someone is at home or if we are all away. So I chose a different path.

The solution I came up with uses IFTTT to set a family status MQTT topic to home or away, and then use that topic to fire my automations. I lose some fidelity with this solution in that I don’t know who was the last to leave or arrive, but for most of my presence based automation (at least the big ones) I don’t care. I can still leverage the phones for more specific notifications that I don’t rely on.

Life360 has both a free and a premium plan. The free plan allows you two locations, which for this purpose was perfect. I really just needed one. I setup my home location, and added my family members to it. Once the app is installed and they are included in your family you are good to go.

Then I setup HTTP To MQTT . I first found HTTP To MQTT via a Home Assistant blog post, but I wanted to host my own version. Either one will work in this case. Installing it is easy. Clone the repo, install the nodejs and required libraries, setup the port forwarding, and run it. I don’t think I need to get into the weeds of walking through the actual commands, but if you get stuck hit me up. If I get a lot of interest I will add them. But if you have installed used nodejs before the process should be familiar. And if you are familiar with the blog post then you know how to finish this puzzle.

Once HTTP to MQTT is up and running, it’s time to setup the IFTTT recipe. I used the Life360 applet to trigger an event when the last family member leaves a location, and connected it to the Make a Web Request. I configured it just like the blog post.

The only difference was my topic:

{
“topic”:”myhouse/myfamily/status”,
“message”:”away”,
“key”:”somethingrandom”
}

Then I created a sensor in Home Assistant that used that topic called sensor.house_mode:


- platform: mqtt
name: “House Mode”
state_topic: “myhouse/myfamily/status”

After that I duplicated those steps and setup a Life360 trigger to fire when the first family member arrives and switches the sensor to home.

All that is left to do is update the automations to use the value of the new sensor as the trigger.

So far it appears to have made a big impact on reliability front. Home Assistant knows pretty quickly when we have all left and that makes Home Assistant way more powerful.