Life360 Device Tracker Platform

OMG Sorry! Wrong place! “towards” and “stationary” appears on the dir_of_travel info… My bad :frowning_face:

My code-related automation:

configuration.yaml:

proximity:
      home:
        zone: home
        devices:
          - device_tracker.douglas_dall_agnol
        tolerance: 2000
        unit_of_measurement: m 

    sensor:
      # Dir of Travel Sensor
      - platform: template
        sensors:
          home_dir_of_travel:
            friendly_name: 'Dir. of Travel - Going Home'
            value_template: '{{ state_attr("proximity.home","dir_of_travel") }}'
            entity_id: proximity.home

automations.yaml:

    - id: '1560775635954'
      alias: Turn on lights when close to home
      initial_state: 'on'
      trigger:
        - platform: state
          entity_id: sensor.home_dir_of_travel
          to: 'towards'
          for: '00:00:10'
      condition:
        - condition: numeric_state
          entity_id: proximity.home
          below: 900
          above: 30
      action:
      - alias: ''
        data:
          entity_id: switch.sonoff_100046ac01_3
        service: switch.turn_on
      - alias: ''
        data:
          entity_id: switch.sonoff_100046ac01_1
        service: switch.turn_on
      - alias: ''
        data:
          entity_id: switch.sonoff_100046ab72_2
        service: switch.turn_on

Ok, so what exactly are you wanting help with? What doesn’t work or at least doesn’t work the way you want? Are you seeing any errors?

I expect to run this automation when I’m getting close to home, below 900m. It’s possible?

Just looking for some suggestions and hoping someone here has ran into it. I just recently added Life360 and it’s working great… but on my daughter’s phone (a cheap TCL Android) Life360 constantly stops updating unless I go click in the app. I have everything enabled to allow it to run in the background as far as I can tell but I’m not very familiar with Android devices. I know it’s not really a Home Assistant issue but was hoping maybe someone has had this issue as well.

What version of Android? If it’s a newer one with Doze, you may want to turn off battery optimization.

Then the trigger you have is wrong; remove it. And what you have for the condition (without the above part) should become the trigger.

What @claytonjn said. Also check Life360’s FAQs. E.g., see post #893 above.

FYI, HA release 0.95.0b0 now contains the standard life360 integration.

1 Like

@pnbruckner I just read the docs for the post 0.95 standard component, VERY COOL!! I see there will be some configuration changes needed to support the new method. How long will the legacy config continue to work? Life360 works great for me right now and I am not in a big hurry to go to make any changes. :slight_smile:

I don’t plan to delete the custom component from my github repo anytime soon. On the other hand, I don’t plan to make anymore changes to it either to keep it working with new versions of HA. How long it continues to work is anyone’s guess. :wink:

If you don’t want to be surprised someday, after 0.95.0 is released you might want to consider changing to the standard component. (Of course, you can do that now with the beta.) The config changes aren’t very extreme, and you don’t even have to change to using the UI to add the integration. Your Life360 account(s) can still exist in the YAML files, albeit with a slightly different format. And there’s a few config options that no longer exist so you’ll have to delete them. Except for the zone and time zone features, the standard component is pretty much the same as the custom component was.

2 Likes

That’s completely fair and as I would expect. I plan to update as soon as I can find the time, I have been traveling for work a ton and my G/F uses the tracker in automation’s while I travel so I wanted to know what my buffer was for adoption. Looking forward to the updates… :sunglasses:

1 Like

Was excited to try out the official integration as soon as I installed the 0.95 beta. It was a very simple and easy transition, only had to change like maybe 3 lines from my existing yaml configuration. Smooth and painless, very nice job!

Have some feedback, minor things.

  1. After first upgrading to 0.95 (and before setting up the official Life360 integration) it was printing a bunch of errors in the log, because I still had the custom_component installed. And the Life360 wasn’t showing up in the Integrations page either, just was a blank item that when clicked on did nothing. I correctly assumed what the problem was and resolved it but maybe you can print some kind of helpful user-friendly message to the log telling users to delete the custom component?

  2. On the Integrations page when I press the + button and get the “Set up a new integration” popup, Life360 is listed first above all others. Not sure if this is supposed to be the case or not. The rest are listed alphabetically.

  3. When I click on it in the integration page it says “This integration has no devices.” and there’s no icons like all my other device_trackers have. Not sure if this is intentional or not? The life360 device trackers are listed in the States page just fine.

Once again though great job, so happy right now :slight_smile:

Yes, that’s all to be expected if you change the config but don’t delete the custom component. By design custom components take precedence over standard ones. There really isn’t anything I can do to fix this, or even create any warnings, because in this situation the standard code isn’t even getting loaded. I suppose I can add a warning to the standard doc page.

Don’t know what might cause that. It could be due to running initially with the custom component still installed which did not have the config_flow.py file. That might have messed up the web page. Maybe try refreshing the browser???

I’m not sure about “intentional”, but it is the way it works in this case. Since it’s still a “legacy” device_tracker there are no devices or entities being registered in association with the config entry, so it has nothing to show. When you say “all of my other device_trackers”, what types are they?

Transition from custom to standard integration


For those that have been using this custom component/integration, when upgrading to HA 0.95.0b0 or later, you need to make some changes to avoid errors and keep your trackers working. This is a summary of the steps you should take.

Basic steps

  1. Delete <config>/custom_components/life360.
  2. Modify the life360 related configuration. (See below.)
  3. Update HA as usual.

NOTE: life360 is still a “legacy” device tracker, so it still uses known_devices.yaml. Do not modify, and do not delete known_devices.yaml.

NOTE: After you complete these steps you should see Life360 configured on the Integrations page. If you click on it it will say, “This integration has no devices.” That is normal.

Modifying your configuration

A) Life360 Account(s)

This part of your configuration:

device_tracker:
  - platform: life360
    username: LIFE360_USERNAME
    password: LIFE360_PASSWORD
    # Other life360 configuration variables...

should be changed to this:

life360:
  accounts:
    username: LIFE360_USERNAME
    password: LIFE360_PASSWORD
  # Other life360 configuration variables...

NOTE: If you have any other configuration variables besides your account credentials, make sure they are at the same indentation level as accounts:.

If you have more than one Life360 account, they should all go under the one accounts: key. E.g.:

life360:
  accounts:
    - username: LIFE360_USERNAME_1
      password: LIFE360_PASSWORD_1
    - username: LIFE360_USERNAME_2
      password: LIFE360_PASSWORD_2
  # Other life360 configuration variables...

The remainder of the configuration variables can only be specified once, which applies to all Life360 accounts. It’s no longer possible to have different settings for each account as was possible before.

B) Unsupported configuration variables

The following options are no longer supported and must be removed:

add_zones
filename
home_place
time_as
zone_interval

C) Changed configuration variables

prefix

NOTE: This is important to prevent your device_tracker entity IDs from changing.

The default “device ID” prefix is now life360, whereas it used to be none.

If you did not include prefix: in your configuration, then you need to add this to keep your device_tracker entity_id’s the same:

  prefix: ''

Any other prefix: value can be left as-is.

show_as_state

This variable now only accepts driving and moving. If you had places listed under this option, you need to remove it.

Also, if you had it entered like this:

    show_as_state: driving, moving, places

You need to change it to a true YAML list, e.g., like this:

  show_as_state: [driving, moving]

error_threshold and warning_threshold

If you were using either or both of these before, just increase them each by 1 to get the same behavior.

members

Originally this was an “include” list, with Life360 Member names specified in any of these formats: first,last name name, ,name. It can now be either an include or exclude list, with Member names specified as first last or name. So, if you specified this option, change it from:

members:
  - first, last
  - name1
  - , name2
  - name3,

to:

members:
  include:
    - first last
    - name1
    - name2
    - name3

Note that you can instead specify an exclude list for Members, and there is a new option for specifying which Life360 Circles to include/exclude. See standard integration doc for more details.

D) Zones

As noted above, the options for automatically adding/updating HA zones from Life360 Places are no longer supported. If you were using this feature, then you’ll need to add the corresponding HA zones a different way. See documentation for standard integration which talks more about this.

A final note. Life360 credentials used to be cached in a file in your <config> folder which, by default, was named life360.conf. This file is no longer used or created and you can delete it if you like. (Credentials are now stored in the HA standard .storage folder.)

10 Likes

Quick question and I may have just missed this. If we want to include every member in the circle, what do we do? Add everyone in an include list? Have an exclude list with no one in it? Don’t have an include or exclude list because that is the default? Or, any of the above will work?

Thanks!

1 Like

The default (if you don’t specify either members or circles) is to include all Members from all Circles.

2 Likes

What will be the result of removing “show_as_state” from support?

Are those old states just simply the default state for the entities now?

The device_tracker’s state will no longer be any of the values that came from that option. I.e., it won’t be Driving, Moving or any of the names of Life360 Places. It will just like be all other device_tracker entities: home, not_home or the name of a HA zone.

I should probably add that the information is still available through the attributes: driving, moving & place.

1 Like

Ok, thanks for clarifying.

Hi Phil,

forgot to think about your CC immediately, sorry for that, so posted this: Track people's( devices) presence per country?

then remembered you have the time_as feature, which shows at least the timezone the device is in. Could that be expanded in the CC to showing the country? Or, could that be added to the CC. Would really be very helpful… and a unique feature (hope this is a trigger…)

timezone eg is ‘Europe/Rome’ and the ‘Italy’ would need to be calculated? Or is this hidden and would you be able to display that.

thanks for having a look.

which is really a pity, my uses case relies a lot on the driving and moving state. It makes a prominent part of my default Home page…

Just to be sure, we still can use the CC after 0.95… I see now the time_as will be gone too, so all the more need to keep using the CC, if possible at all