Life360 Device Tracker Platform

gps_accuracy is indeed an attribute of the device_tracker entity, and is saved in the database along with the rest of the entity’s state when it changes. So all the data is there.

However getting at that data is another story. The easiest way to see the history of gps_accuracy is to create a template sensor based on it. Then it’s easy. Of course, that won’t help with old data.

If you’re comfortable with doing database queries, you should be able to get at it that way.

If not, and if perchance you have debug set for at least homeassistant.core, then there are state_changed messages in the log for all state changes. And I happen to have a Python script that can extract state changes from home-assistant.log for an entity, including whichever attribute you’re interested in. :slight_smile: The output looks something like this:

$ python3 state_updates.py home-assistant.log device_tracker.me gps_accuracy
log time            | last_changed                     | state       | gps_accuracy
--------------------|----------------------------------|-------------|-------------
2019-06-12 08:11:01 | 2019-06-12T08:11:01.677325-05:00 | home        | 15
2019-06-12 08:11:01 | ===== Home Assistant Start ===== | =========== | ============
2019-06-12 08:12:06 | 2019-06-12T08:11:01.677325-05:00 | home        | 15
2019-06-12 08:12:26 | ===== Home Assistant Stop ====== | =========== | ============
2019-06-12 08:12:28 | ===== Home Assistant Close ===== | =========== | ============

Of course, if you’re restarted HA and the log has been overwritten…

Thanks Phil.

I will have a look at it tonight when I get home.

In the mean time, even with the error my Zone automations are being triggered, so it does seem like it is actually working.

Regards,
Gerrit

Yes, even if it can’t save or reload the authorization to/from the cache file, it will always get an authorization token from the server if necessary, so it will work. It’s just odd that you’re seeing this.

FWIW, the standard component will save/reload via HA’s normal storage methods (i.e., to/from <config_dir>/.storage/core.config_entries) so hopefully this type of thing won’t happen in the future.

Excuse my really silly question - I know there was a way to install the custom component using custom_updater; however, I have just installed HACS.

Is there anyway to add a repository there for the installation and maintenance of this life360 addon?

Cheers!

not really a point in making this compatible with HACS. It’s going to be an official component in .95 or .96.

1 Like

Is that official or just a hunch?

It’s official

Sweet, that’s great. For the moment I have manually installed it. Looking forward to it being official!

I agree! I’ve been using this custom component for around a year and could not be happier with it. It has always performed phenomenally.

See this post above.

And, yes, it’s currently in the dev branch and should make the 0.95 beta release. And as long as we’re on the topic, it did morph a bit on its way to becoming a standard integration. See the doc page for details.

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?