Great! I’ll give that a try.
Just FYI, it’s still possible that the entity won’t be updated if nothing has changed. That’s up to the device_tracker component code.
It’s working. Thanks.
For some reason I can no longer edit my original post, so the “documentation” is out of date. So I created documentation on github here.
Thanks, pnbruckner for the great addition. I’ve been using Life360 on my phone for a few days now and it seems to update quickly enough to use as a good presence tool.
I tried installing this on my HASSIO system and couldn’t get it to work. After a reboot I was able to SSH in to the system but the web GUI would not get past the login page.
According to my info page my config file is at /config
Path to configuration.yaml: /config
So, I added the two directories and files. This is what it looks like:
/config/custom_components/life360.py
/config/custom_components/device_tracker/life360.py
The contents of each “life360.py” file are from these two pages. I just copied-and-pasted with no changes made
/config/custom_components/life360.py → https://github.com/pnbruckner/homeassistant-config/blob/master/custom_components/life360.py
/config/custom_components/device_tracker/life360.py → https://github.com/pnbruckner/homeassistant-config/blob/master/custom_components/device_tracker/life360.py
In my configuration.yaml file I have this entered
#Google Location Sharing - https://www.home-assistant.io/components/device_tracker.google_maps/
device_tracker:
- platform: google_maps
username: [email protected]
password: my_password
#Bluetooth tracker https://www.home-assistant.io/components/device_tracker.bluetooth_tracker/
- platform: bluetooth_tracker
interval_seconds: 2
#Life360 tracking - https://github.com/pnbruckner/homeassistant-config/blob/master/docs/life360.md
- platform: life360
username: [email protected]
password: my_password
show_as_state: places, moving
interval_seconds: 6
max_update_wait:
minutes: 30
Can you give me some guidance on how to get this to work?
Thanks!
I don’t use hassio, so not sure what to tell you. Everything looks right. Back in June @bwdur was able to get it to work in hassio. Are there any errors in the log? You’re not able to get past the login screen? That’s weird.
Welp, as is usually the case, the 2nd or 3rd attempt usually works. I went back and added each file separately with a reboot in between and it worked.
Thanks again for making this! I’m excited to use it as a way to tell HA that we have arrived at home!
Just set this up last night with .76.2. Works great, and easy to set up. I’ve read almost all the posts, and I think these have been answered but was still not 100% sure
- So from HA these are standard Device trackers, so they will recognize any zones I have set up in HA, and I can run any automations, scripts, sensors, etc based on those zone changes?
- Just not 100% on the HA zones vs life360 zones. I do have a couple life360 zones, and they are in the same gps cordinates as my HA zones. What’s the deal with that? Ok, Duplicate, confusion? Do I have to make sure the name matches? I can delete the life 360 zones if needed, I dont really care about them?
- Might be overkill, but I have Home Cordinates, and a Home zone (same GPS cordinates), and now a life 360 Home (address based), is there anything special I need to do with Life 360 for the Home Zone.
Thanks so much for this, so far the one day I’ve used it, it has already been more accurate for reporting location changes than the native HA iOS app.
FYI, for some reason I’m locked out of editing my OP any further, so I can’t fix/add documentation there. Hopefully you saw the full, up-to-date docs on my github.
- Yes. If not, please let me know.
- I believe Life360 calls them Places. You can configure this platform to use Life360 Places (in which case, when you’re in one, the device_tracker’s state will be set to the name of the Place – Home is special, it will always be lower case ‘home’), or ignore them. If you use them, and they coincide with your HA zones, the Life360 Place takes precedence. I’m pretty sure the doc explains this. FWIW, I don’t have any Places defined in Life360 other than Home (because that’s pretty much required IIRC.)
- I have the same. It should work as-is; nothing special required.
In general, if people think HA zones should take precedence over Life360 Places, I think I could easily be convinced to change that.
Awesome and thanks, forgot one more simple question. I just use 1st name. The two device trackers were named
device_tracker.paul_
it’s not a show stopper, but any way to either add something to the end, or remove the underscore
Good idea. Will do. Of course this would be a “breaking change” for some people, but I suspect it’s worth it.
Ok, I made the change. Please test it out and let me know how it works for you.
Worked, as you’d expect I had to change my few automations I changed and the known_devices for the new name, but that was it. So far its working great. will report more when I actually leave home.
@pnbruckner, have a few automations that send me alerts. I was using this, but it does not seem to be working with the life 360. BTW, love this
- alias: "Person2Leaving Location Alert"
trigger:
- platform: state
entity_id: device_tracker.person2
to: 'not_home'
I suspect that if I have Moving enabled, that this is no longer a valid state, is that wrong? I have one that uses to "not_home’ and one that uses from: ‘not_home’. Would moving be a fair replacement? The home, away, not_home always gets me mixed up with HA, since they show differently in the UI, and history.
Thanks
‘home’ (aka Home) and ‘not_home’ (aka Away) are still valid states. However, if you have it configured, then ‘Moving’ is also another valid state. It’s possible (and likely) to go from ‘home’ to ‘Moving’ and vice versa. Your automation triggers should probably be to: 'home'
and from: 'home'
, as appropriate. This way it doesn’t matter which other state it goes to, or comes from, when leaving/returning home.
Yeah, looking closer that is what was happening. I have a few automatons that are based on leaving zones other than home, and although I like the idea of moving as a state, I dont have any ideas for automation based on that at the moment, so I think I’ll just leave that out of my configuration for the moment. BTW, I did just that, and all is working as expected, thanks again for this. For the one day I’ve been using it, it has updated location and status, significantly faster and better than the HA app.
FYI, I’ve made some changes recently to this custom platform.
- BREAKING CHANGE Remove underscore from entity_id if member only has first or last name.
- Fixed incorrectly reported gps_accuracy. Life360 reports in feet, but device_tracker expects meters, so conversion was added.
- BREAKING CHANGE To be consistent with other device_trackers changed attribute last_update to last_seen. Also made it (and at_loc_since) a UTC datetime (instead of a string) to be consistent with other entity attributes which are datetimes.
I also updated the documentation.
Let me know if any of these changes cause any problems, or if there are any other changes or enhancements you’d like to see.
@pnbruckner Thanks for the update.
Maybe it’s an idea to put the component on the Custom components page so the tracker-card can be used to see if there is a new version.
Interesting. I wasn’t even aware of that repo. I’ll look into it. Thanks!
I’ve updated to the latest, but I am not seeing the trailing underscore being removed from the entity_id for a first-name only registration.
The underscore doesn’t really bother me one way or the other, just letting you this requested tweak didn’t take effect. At least for me it didn’t.
EDIT: I double-checked the life360 settings and lastname is null. If somehow the lastname is read as a space, not null, the logic will add an underscore.
Oh, I greatly appreciate your work on this custom component. It is working great and has proven to be much more reliable than any other presence detection scheme I’ve tried (and there were many!).
Only question I have is what is involved for a custom component to become an official community add-on?