Life360 Device Tracker Platform

Released 2.3.0

Add optional home_place configuration variable as discussed above.

Released 2.3.1

Forgot to not add HA zones (if configured to do so) for Life360 Places whose name matches the new home_place configuration variable.

I donā€™t know what released I add but its was when DrZzs had his video come out on the night. were can I see what updates have been and done do I really need to update. as I see its an different away now. Thanks for all your work its works so good :slight_smile:

Life360 Release Notes

You can also use the Custom Updater to keep up to date, or at least be notified when new versions are available.

I Happy with it so better off not changing anything but hopefully home system will add you to the list for add it to HA.

Hey Phil!

This is just for letting you know your component had solved all presence issues in the core setup. After having finally convinced my 2 most reluctant siblings to install life360 on their phones, I have literally 0 false presence detections in the system leftā€¦

This has been a major pain, since many HomeAutomations rely on presence detection, especially the being Home part. Ever switching phones kept falsely triggering things and forced me to add conditions to the automation to prevent that.

All of which is now no longer necessary.
so Cool!

Thanks a zillion for this component which makes integrating Life360 easy as baking a Spekkoek. Or at least eating it.

Btw, the ones most wary of being tracked now keep telling me where they have seen me the last weekā€¦

Just Googled it. Iā€™m guessing the latter! lol! :slight_smile:

Glad to hear itā€™s working well for you. Yes, I agree, Life360 is pretty good and they deserve a lot of credit for what theyā€™ve built. Letā€™s just hope they keep the (unofficial) REST API running!

do you only need the file in device_tracker now? You use to also need the file life360.py in the base custom_components folder, but that isnā€™t in your master branch anymore on your Git repository, is that not needed anymore?

Yes, that is correct. See installation instructions (especially the notes) for more details.

Correct, it is no longer required. It has been moved to the PyPI from which HA will automatically install it. (Or, at least it should. Some people have had issues with that. Not sure why. It might require an additional restart to work correctly. Also, if youā€™re using the Custom Updater, it also should take care of getting the package installed.) Once you have the new version working you should be able to safely delete custom_components/life360.py.

Iā€™d like to add my thanks too (but I havenā€™t googled Spekkoek yet :thinking:)

I must admit to not having taken the plunge to rely solely on it yet, I am still also using Google Location but part of the reason for that is that your other component the composite tracker makes it so easy to use more than one!

And while we are giving @pnbruckner some well deserved praise, the sun custom component is great too.

The only extra thing I can think of to ask for would be to have them included in core HA :wink:

I installed following your docs the python script, added the configuration and restarted HA. life360.conf file is in /config directory, but no device_tracker entities are created. Maybe am i wrong in something? I restarted again HA but with no new entitiesā€¦
EDIT: I discovered into known_devices.yaml these two new entries:

life360_maurizio:
  hide_if_away: false
  icon:
  mac:
  name: life360 maurizio
  picture: https://www.life360.com/img/user_images/6c874b44-2c55-4afd-947f-d9ea5562d7e9/f70db63c-4881-400e-841c-e67dcd304ada.png?fd=2
  track: false

life360_fha:
  hide_if_away: false
  icon:
  mac:
  name: life360 fha
  picture:
  track: false

But i have NO device_trackers for them, HA did not created the two new device_trackersā€¦
EDIT 2: solvedā€¦ i see i had track: false. I changed to true and the entities appeared

1 Like

Sorry I wasnā€™t able to respond quickly enough to help. Itā€™s been a bit hectic lately. Glad you got it working!

When using life360 as device tracker what state to use when not at home? In my environment when i am at home the state is ā€˜casaā€™ but when not home i donā€™t have the ā€˜non a casaā€™ state but one between ā€˜movingā€™, and ā€˜drivingā€™. How to set an automation with these states?

For automation I had to do a templete. Check this out and see if it helps.

     - condition: template
       value_template: "{{ not is_state('device_tracker.kevin_lee_robinson_jr', 'home') }}"
2 Likes

I manually copy life360.py to <config>/custom_components/device_tracker/

I am getting the following error in HA log.

Unable to prepare setup for platform device_tracker.life360: Could not install all requirements.

3:20 AM setup.py (ERROR)

Not initializing device_tracker.life360 because could not install requirement life360==2.*

3:20 AM requirements.py (ERROR)

Unable to install package life360==2.*: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('&lt;pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x75935810&gt;: Failed to establish a new connection: [Errno -3] Try again',)': /simple/life360/ Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('&lt;pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x759359b0&gt;: Failed to establish a new connection: [Errno -3] Try again',)': /simple/life360/ Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('&lt;pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x759352d0&gt;: Failed to establish a new connection: [Errno -3] Try again',)': /simple/life360/ Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('&lt;pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x75935f90&gt;: Failed to establish a new connection: [Errno -3] Try again',)': /simple/life360/ Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('&lt;pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x75935430&gt;: Failed to establish a new connection: [Errno -3] Try again',)': /simple/life360/ Could not find a version that satisfies the requirement life360==2.* (from versions: ) No matching distribution found for life360==2.*

3:20 AM util/package.py (ERROR)

I manage to resolved the error. Having DNS issue with homeassistant docker.

Thanks @pnbruckner for the great work.

1 Like

I am having trouble trying to get second template to work. I need the condition to stay true for 15 minutes after I reached home.

This is my first attempt working with template, any idea how to parse the ā€˜at_loc_sinceā€™ attribute?

  #----------------------------
  # Device Tracker Automation
  #----------------------------
 - alias: Reached Home
   trigger:
    - platform: state
      entity_id: binary_sensor.main_door
      to: 'on'
   condition:
     condition: and
     conditions:
      - condition: template
        value_template: "{{ is_state('device_tracker.life360_aron_teh', 'home')}}"
      - condition: template
        value_template: "{{ (states.device_tracker.life360_aron_teh.attributes['at_loc_since']) | int  < 900}}"
      - condition: sun     
        after: sunset
        after_offset: "-00:30:00"
   action:
    - service: switch.turn_on
      entity_id: switch.frontdoor_light

Please post code using proper formatting as described in the link at the top of the page.

The at_loc_since attribute is a Python datetime object. If you want to know how many seconds have elapsed since that time, you can do this:

{{ (now() - state_attr('device_tracker.life360_aron_teh', 'at_loc_since')).total_seconds() }}

The now() function also returns a Python datetime object. Subtracting them results in a Python timedelta object, whose total_seconds() method returns the number of seconds the timedelta represents (as a float.)

So, the condition I think youā€™re looking for is:

condition: template
value_template: >
  {{ (now() - state_attr('device_tracker.life360_aron_teh', 'at_loc_since'))
     .total_seconds() > 15*60 }}

That work great. Thanks you very much.

1 Like

Is this component still working.

Iā€™m using Hass.io
I would like to use this as it does not require MQTT and is more stable.

I added just the /config/component/device_tracker/life360.py

What else needs to be done as I saw the other /config/component/life360.py file has been redacted.

Thanks in advance