Life360 Device Tracker Platform

This is a great addon, and I’m glad to hear it’s slated to be a native part of HA. How do we use the information reported by Life360? For example
I want to create an automation based on battery level. Device tracking is working fine, and the battery level is reporting correctly on the entities card, but how do I actually use that information? I’ve read through all of the 1050 posts here, and I’m having a hard time believing this isn’t possible. Maybe I missed it?

sensor:
  - platform: template
    sensors:
      eryins_iphone:
        friendly_name: "Eryin's iPhone Battery"
        unit_of_measurement: "%"
        value_template: "{{ state_attr('device_tracker.eryin_morrison', 'battery') }}"

Example straight from my wife’s phone using Life360

1 Like

I guess I’m missing something, but I don’t see where this references the life360 platform at all. My device tracker for life360 is device_tracker.life360_username . Did you rename your life360 device? Thanks for the help.

Just substitute the device tracker used in the code with yours. The idea is that the device tracker has many attributes and the example provided by @atomicpapa is basically creating a sensor specifically for the attribute you’re interested in.

3 Likes

I’m trying to create an automation that notifies using notify ( service: notify.all )

I use the person component ( person.* ) for each person
I’d like it notify when anyone ( person.* )
enters/leaves any zone ( zone.* )
it would then notify.all

With a message similar to
person X has entered zone Y

ie: Bob has left school
Steve has arrived at Burger King

I’ve seen a few different way to do this, but is there a preferred way?

The automation examples at below link don’t cover automations related to entering/leaving zones.

Yes. The way that works for you and you like best. :slight_smile: But seriously, I don’t think there is a “preferred”, or even a “best” way. But, FWIW, here is “a” way that you might find useful:

How can I create an automation for situations when I’m going home?

Using the state “towards” seems not be working, and most of the time, even when I’m driving my state keeps as “stationary”.

Where exactly are you seeing “towards” and “stationary”?

I am using the information shown in the Status column, as it is displayed at http://myip:8123/dev-state


On this moment just displays “home”

If I’m completely wrong, sorry :frowning:

So I have no idea how the state of the device_tracker could be “towards” or “stationary”, unless you have zones with those names, which I doubt.

How about let’s take a step back. Can you describe exactly what you’re trying to achieve? Or if you have an automation written, even if it’s not completely working the way you want, can you post it?

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