Life360 Device Tracker Platform

-Life360 App version 18.8.1
-Custom Components/Life360 version 2.10.1 release #148

The only file/directory in the custom components directory is Life360 (verified with samba)
The only files in the Life360 directory are…
pycache
init.py
device_tracker.py
manifest.json

Error message is a notification that says “The following components and platforms could not be set up: *device-tracker *ios Please check your config.”

I updated my Life360 files to the new release like yours and all of my errors went away but i’m not getting any data from Life360. It shows my wife and I as away and batteries are None%. I also had to delete my Life360 section in config.yaml as I got an validation error before restart.

If device_tracker cannot be set up (for reasons that don’t seem to have anything to do with life360 – e.g., could it be the ios platform???), then there’s no way life360 (or any device_tracker platform, for that matter) will work. You need to first find out why you’re getting those errors and fix them.

You might want to look at the errors in home-assistant.log (instead of wherever you’re seeing those fairly useless messages.) There might be more clues there.

You need to be more precise, and format so we can properly read these things. E.g., is the folder name life360 or Life360. The former is correct, the latter is not (assuming you’re running on a *nix type system.)

hey guys,

I have been having this issue since I upgrade to 0.94.

After reviewing the release notes i read this:

'This release also introduces a long overdue overhaul of how the device tracker works. We are introducing this overhaul piece by piece, focusing first on device tracker platforms that push their updates to Home Assistant: mobile app, OwnTracks, GeoFency, GPSLogger and Locative.'

So I removed all those elements ( in my case OwnTracks ), updated the custom components and restart.

Everything works now!

hope this helps!

Removed what elements? Were you using life360 and having problems before you did that?

FYI, life360 is still considered a “legacy” device tracker, and hence will still use known_devices.yaml. Even the version that will become a standard component (probably in 0.95) is a legacy device tracker. At some point, though, it will probably be converted to the newer “entity based” format.

Yes, I was using life360 & OwnTracks and having problems in the last HA update (0.94).

I have the feeling that having both OwnTracks (new) and life360 (legacy) at the same time was creating the issues for me. When I removed OwnTracks, life360 worked again.

When I disabled Life360 in config the ios platform worked as it should. You are correct, the directory is life360 not Life360. When I type the file names as they appear, some go bold and some characters convert to spaces. When I sat them up in HA I copied the names directly from your github files. I think this evening I will remove all life360 files and folders and start again.

@davedan @rossmatt06

Interesting. I wonder if there’s a bug in the device_tracker component code that is causing this. In theory it’s supposed to work with new and legacy trackers, but it seems in your cases when you try to use both new and legacy things break. I might try giving one of the newly formatted trackers a try and see what happens when I try to use it at the same time as life360.

Yeah please try … I was in a meeting while testing (don’t tell anybody :wink: ) I can do more tests later when at home.

@davedan @rossmatt06

I just installed Owntracks and configured it in HA. I also have version 2.10.1 of my custom life360 installed and configured. I’m running both on HA 0.94.0 and they both seem to work fine. I’ll upgrade to 0.94.1 and see if that makes any difference…

EDIT: Seems to work ok with 0.94.1, too.

life360 as also stopped working for me on 0.94.1. I’ve uploaded the new files from Github. It seems I’m getting a login error. I’m no coder so have no idea what it means.

   Traceback (most recent call last):
  File "/config/custom_components/life360/device_tracker.py", line 181, in setup_scanner
    from life360 import life360, LoginError
  File "/config/life360/__init__.py", line 7
    <!DOCTYPE html>
    ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/device_tracker/setup.py", line 76, in async_setup_legacy
    tracker.see, discovery_info)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/life360/device_tracker.py", line 186, in setup_scanner
    except LoginError as exc:
UnboundLocalError: local variable 'LoginError' referenced before assignment

any further help most appreciated. I’ve removed google and owntracks device trackers and deleted the pycache as per someones recommendation but still no luck.

You didn’t copy the files from github correctly. You got the html file instead of the raw file. Please see installation instructions, especially the note:

Do not download the file by using the link above directly. Rather, click on it, then on the page that comes up use the Raw button.

I believe I did it correctly. click on the links in the installation instructions and then Alt click on RAW and it downloads the file? transfer those 3 files to the life360 folder and we’re good to go?

looked in the actual device_tracker.py file and (init and manifest) and it was totally wrong. It should be correct now but still not working.
2019-06-11 15:48:12 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for life360 which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-06-11 15:48:15 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform legacy
Traceback (most recent call last):
File “/config/custom_components/life360/device_tracker.py”, line 181, in setup_scanner
from life360 import life360, LoginError
ImportError: cannot import name ‘life360’ from ‘life360’ (/config/life360/init.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/device_tracker/setup.py", line 76, in async_setup_legacy
    tracker.see, discovery_info)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/life360/device_tracker.py", line 186, in setup_scanner
    except LoginError as exc:
UnboundLocalError: local variable 'LoginError' referenced before assignment

im getting some wierd results with one install… ive got two accounts in the config and the first updates fine… with no " home" set in the app… it was just getting it from HA. the second account doesnt update to home in this same way and doesnt have home set in the app. How should this really work and how can i fix?

Looks like the life360 pypi.org package wasn’t installed. HA is supposed to install that automatically based on the manifest.json file. Are you seeing any errors in home-assistant.log about not being able to install that package?

EDIT: I just tried removing that package and then starting HA. I see this message in home-assistant.log:

2019-06-11 10:34:43 INFO (SyncWorker_31) [homeassistant.util.package] Attempting install of life360==3.0.0

Can you share your life360 configuration (don’t forget to redact any sensitive information)?

Also make sure logger is set to debug (at least for custom_components.life360) and look for debug messages from life360 in home-assistant.log. It should provide some clues as to what it’s seeing from the server.

here’s my life360 config
> - platform: life360

    username: !secret life360_username
    password: !secret life360_password
    add_zones: all
    # MPH, assuming imperial units.
    # If using metric (KPH), equivalent would be 29
    driving_speed: 18
    filename: life360.conf
    home_place: Home
    interval_seconds: 60
    max_gps_accuracy: 200
    max_update_wait:
      minutes: 45
    # members:
     # - Lee
     # - Joe
     # - Jones
    prefix: life360
    show_as_state: driving, moving
    time_as: device_or_local
    zone_interval:
      minutes: 15
    # Set comm error thresholds so first is not logged,
    # second is logged as a WARNING, and third and fourth
    # are logged as ERRORs.
    warning_threshold: 1
    error_threshold: 2

I don’t think your issue has anything to do with your life360 configuration.

As mentioned above, the problem seems to be that HA is not automatically installing the life360 pypi.org package. See comments above.