This platform allows you to detect presence using Life360.
See Installing and Updating to use Custom Updater.
NOTE: Don't forget to also install
life360
.
Alternatively, place a copy of:
life360.py at <config>/custom_components/life360.py
and
device_tracker/life360.py at <config>/custom_components/device_tracker/life360.py
where <config>
is your Home Assistant configuration directory.
Then add the desired configuration. Here is an example of a typical configuration:
device_tracker:
- platform: life360
username: !secret life360_username
password: !secret life360_password
prefix: life360
show_as_state: driving, moving, places
driving_speed: 18
max_gps_accuracy: 200
max_update_wait:
minutes: 45
- username: Your Life360 username.
- password: Your Life360 password.
- prefix (Optional): Default is to name entities
device_tracker.<first_name>_<last_name>
, where<first_name>
and<last_name>
are specified by Life360. If a prefix is specified, then entity will be nameddevice_tracker.<prefix>_<first_name>_<last_name>
. If the member only has a first or last name in Life360, then the underscore that would normally separate the names is left out. - show_as_state (Optional): One or more of:
driving
,moving
andplaces
. Default is for Device Tracker Component to determine entity state as normal. When specified these can cause the entity's state to show other statuses according to the States chart below. - driving_speed (MPH or KPH, depending on HA's unit system configuration, Optional): The minimum speed at which the device is considered to be "driving" (and which will also set the
driving
attribute to True. See alsoDriving
state in chart below.) - max_gps_accuracy (Meters, Optional): If specified, and reported GPS accuracy is larger (i.e., less accurate), then update is ignored.
- max_update_wait (Optional): If you specify it, then if Life360 does not provide an update for a member within that maximum time window, the life360 platform will fire an event named
life360_update_overdue
with the entity_id of the corresponding member's device_tracker entity. Once an update does come it will fire an event namedlife360_update_restored
with the entity_id of the corresponding member's device_tracker entity and another data item namedwait
that will indicate the amount of time spent waiting for the update. You can use these events in automations to be notified when they occur. See example automations below.
Note: If you set the entity to not be tracked via known_devices.yaml then the entity_id will not exist in the state machine. In this case it might be better to exclude the member via the members parameter (see below.)
- members (Optional): Default is to track all Life360 Members in all Circles. If you'd rather only track a specific set of members, then list them with each member specified as
first,last
, or if they only have one name, thenname
. Names are case insensitive, and extra spaces are ignored (except within a name, likevan Gogh
.) For backwards compatibility, a member with a single name can also be entered asname,
or,name
. - interval_seconds (Optional): The default is 12. This defines how often the Life360 server will be queried. The resulting device_tracker entities will actually only be updated when the Life360 server provides new location information for each member.
- filename (Optional): The default is life360.conf. The platform will get an authorization token from the Life360 server using your username and password, and it will save the token in a file in the HA config directory (with limited permissions) so that it can reuse it after restarts (and not have to get a new token every time.) If the token eventually expires, a new one will be acquired as needed.
show_as_state | State | Conditions |
---|---|---|
places |
home |
Place or check-in name (see below) is any form of the word 'home'. |
places |
Place or check-in name | Member is in a Life360 defined "Place" or member has "checked in" via the Life360 app (and name is not any form of the word 'home'.) |
N/A | home |
Device GSP coordinates are located in the HA defined home zone. |
N/A | HA zone name | Device GPS coordinates are located in a HA defined zone (other than home.) |
driving |
Driving |
The Life360 server indicates the device "isDriving", or if driving_speed (see above) has been specified and the speed derived from the value provided by the Life360 server is at or above that value. |
moving |
Moving |
The Life360 server indicates the device is "inTransit". |
N/A | not_home |
None of the above are true. |
Order of precedence is from higher to lower.
Attribute | Description |
---|---|
address | Address of current location, or None. |
at_loc_since | Date and time when first at current location (in UTC.) |
charging | Device is charging (True/False.) |
driving | Device movement indicates driving (True/False.) |
entity_picture | Member's "avatar" if one is provided by Life360. |
last_seen | Date and time when Life360 last updated your location (in UTC.) |
moving | Device is moving (True/False.) |
raw_speed | "Raw" speed value provided by Life360 server. (Units unknown.) |
speed | Estimated speed of device (in MPH or KPH depending on HA's unit system configuration.) |
wifi_on | Device WiFi is turned on (True/False.) |
device_tracker:
- platform: life360
username: !secret life360_username
password: !secret life360_password
prefix: life360
show_as_state: driving, moving, places
driving_speed: 18
max_gps_accuracy: 200
max_update_wait:
minutes: 45
members:
- mike, smith
- Joe
- Jones
interval_seconds: 10
filename: life360.conf
- alias: Life360 Overdue Update
trigger:
platform: event
event_type: life360_update_overdue
action:
service: notify.email_me
data_template:
title: Life360 update overdue
message: >
Update for {{
state_attr(trigger.event.data.entity_id, 'friendly_name') or
trigger.event.data.entity_id
}} is overdue.
- alias: Life360 Update Restored
trigger:
platform: event
event_type: life360_update_restored
action:
service: notify.email_me
data_template:
title: Life360 update restored
message: >
Update for {{
state_attr(trigger.event.data.entity_id, 'friendly_name') or
trigger.event.data.entity_id
}} restored after {{ trigger.event.data.wait }}.
Life360 does not apparently officially support its REST API for use with other than its own apps. This integration is based on reverse engineering that has been done by the open source community, and an API token that was somehow discovered by the same community. At any time Life360 could disable that token or otherwise change its REST API such that this custom component would no longer work.
Date | Version | Notes |
---|---|---|
20180907 | 1.0.0 | Initial support for Custom Updater. |
20180910 | 1.1.0 | Add address attribute. |
20180912 | 1.2.0 | Filter excessive errors. |
20180912 | 1.3.0 | Allow entries in members configuration variable that only have one name to be entered without comma. |
20180918 | 1.4.0 | Handle members that don't share their location in one or more circles. |
20180928 | 1.5.0 | Add raw_speed and speed attributes and driving_speed config option. Derive driving attribute from speed if possible. |
20181002 | 1.5.1 | Limit speed attribute to non-negative values. |
20181016 | 1.6.0 | Update as soon as initialization is complete. |
20181025 | 1.6.1 | BREAKING CHANGE: Event names were too long. Shorten them by removing device_tracker. prefixes. |