Life360 Device Tracker Platform


#302

I will update and try this weekend


#303

It seemed to work for me, no errors in the log. I updated the main file and the device tracker file, I saw commits to both. I added add_zones:true and an interval of 60.

All my zones showed up. The all have the same icon, and when you click them you don’t get anything, anyway to show a label or something so you know what the area is?

I’m thinking I will disable make automations now to have Home Assistant alert when at an area instead of Life360 then all my notifications come from one place.

Not sure how to make that automation, but sure it’s a standard zone thing somewhere in HA I just haven’t looked up yet.

Awesome work!


#304

I see this page, so I assume you copied the name?

Where in HA can you list all your zones? You can see icons and circles on a map, but they are not entities, so you don’t know their names.


#305

I’m not 100% sure I’m following you.

The zone (friendly) names in HA should be the same as the Place names in Life360. When viewed on the map you should be seeing these names. The entity_id’s come from an algorithm in HA, but basically if all the Place names are unique, then the corresponding zone entity_id’s should be the Place name changed to all lower case, with spaces replaced by underscores, parentheses removed, etc. There are a few other possible transformations, but that’s the basic idea. So a Place name of “My Work” should create a zone entity_id of zone.my_work. You can see all the entity_id’s on the States page in the frontend.

For automations, you have two choices. You can use a zone trigger, or you can use device_tracker states, because when a device_tracker is in a zone, the device_tracker’s state is set to the (friendly) name of the zone. So, e.g., let’s say you had a Life360 Place named “My Work”, which creates a zone entity_id of zone.my_work, you could trigger when device_tracker.me enters that zone either of these ways:

trigger:
  platform: zone
  entity_id: device_tracker.me
  zone: zone.my_work
  event: enter

or

trigger:
  platform: state
  entity_id: device_tracker.me
  to: 'My Work'

Just remember for the latter, when a device_tracker is in the Home zone its state is ‘home’, not ‘Home’.


#306

Go it, see all the zones in the entities list now. My map for some reason has no text, just icons, wonder if that’s something I need to turn on somewhere?


#307

Hmm, interesting. When I tested this feature I was focusing on whether or not the zones showed up on the map and if they were the right size (i.e., did I get the units correct - meters vs feet.) I also saw the icon, which I chose to look like the same icon Life360 uses. But now that you mention it I can’t say for sure whether or not the names appeared on the map. (I know zones defined in HA’s config show the names on the map.) I’ll have to test again to see.


#308

Well, just checked the zone doc page, and it says this for icon:

The icon to show instead of name.

Hmm, maybe I should nix the icon. :slight_smile:


#309

I think home icon is obvious, for others, maybe no icon so we see the text


#310

I tried to make one automation to cover everything, but it randomly goes off even when the state doesn’t change. I assume some other value of the state is changing? it will just say I’m home every few minutes over and over, any ideas?

  • id: zone_change
    alias: Zone Change
    trigger:
    platform: state
    entity_id: device_tracker.phone1, device_tracker.phone2
    action:
    • service: notify.notify
      data_template:
      message: “{{ trigger.to_state.name }} has arrived at {{ trigger.to_state.state }}”

#311

You should format your YAML code using the instructions at the top of the page to make it readable.

But, yes, a state trigger without to or from will trigger for any state change, including only changes to attributes. And GPS-based device_trackers like Life360 will definitely update many times while the actual state string does not change.

You can add a condition that only lets the action run if the actual state string changed. I don’t have time right now, but I’ll edit this response in a while to show how you might do that…

EDIT: Try this:

- id: zone_change
  alias: Zone Change
    trigger:
    platform: state
    entity_id: device_tracker.phone1, device_tracker.phone2
  condition:
    condition: template
    value_template: >
      {{ trigger.to_state and trigger.from_state and
         trigger.to_state.state != trigger.from_state.state and
         trigger.to_state != 'not_home' }}
  action:
    service: notify.notify
    data_template:
      message: "{{ trigger.to_state.name }} has arrived at {{ trigger.to_state.state }}"

This will only notify if the state string changes, and it doesn’t change to ‘not_home’ (aka Away.)


#312

I just tried it without an icon and sure enough now the name shows up on the map.

One interesting result I noticed while testing. So as not to bother the members in my usual Circle, I created a temporary circle so I could add Places to it. What I realized is, Places from all circles will be added as zones in HA. So whereas in Life360 Places are unique to circles, in HA you’ll see all Places from all circles. I don’t think that’s an issue, but something to consider. If this becomes a problem I suppose I could add another option to specify which circle or circles from which to use Places.

Anyway, I’ll be checking in 2.0.0b3 soon, and before long releasing 2.0.0.


#313

Released 2.0.0 (& library 1.1.0.)

Add option to create HA zones from Life360 Places. Add optional config variables add_zones and zone_interval. If add_zones is true or zone_interval is defined, create zones at startup. If zone_interval is defined update zones periodically. Do not use Life360 Places named Home (case insensitive.)


#314

I updated and the names showed up, so it worked! Also, thanks for the automation, I added tonight and its not going crazy, so we will see how it works moving around tomorrow.


#315

This platform has been reporting the device’s charging status in an attribute named ‘charging’. However, it appears ‘battery_charging’ is more common. To be more consistent with other platforms, I’m going to change the attribute from ‘charging’ to ‘battery_charging’. Obviously this is a breaking change.

See issue #61 (and somewhat related issue #60.)

I’m willing to be convinced to leave it the way it is, though. :wink: If you feel strongly either way, please comment in my github issue #61, or here if you can’t use github.


#316

Released 2.1.0 – BREAKING CHANGE

Change charging attribute to the more common battery_charging attribute. Instead of a float, make battery attribute an int like it should have been originally.


#317

getting: ERROR (MainThread) [homeassistant.bootstrap] Error loading /config/configuration.yaml: mapping values are not allowed here

Any ideas?

device_tracker:
  - platform: life360
    username: !secret life360_username
    password: !secret life360_password
    interval_seconds: 10
    filename: life360.conf
    show_as_state: places, driving, moving
    max_update_wait:
      minutes: 30

#318

How did you add Life360 into the custom tracker? I’ve just installed the customer tracker and am not sure what to do next, I’ve forgotten how I added stuff into before I had to rebuild from scratch.


#319

Must be something basic in your configuration file(s), because I don’t see anything wrong with that snippet. If you’d like to share more details via private message I’d be happy to try and help further. Also, is there more to that error message? It usually will tell what file and give a line and column number, which can sometimes help narrow down where the problem is.


#320

Have you seen these:

My Life360 doc
My installation doc
Custom Updater installation doc

Don’t forget my Life360 implementation consists of two custom components: life360 and device_tracker.life360. You need to make sure you install both.


#321

Yes all sorted now!
Sorry was being an idiot. I’d done this before is Lovelace but never in standard UI so was looking at my old config files wondering how it ever worked! Then I realised I needed to add the additional bits under custom_updater: