Life360 Device Tracker Platform

Does HA know it’s a device_tracker file because of the filename ? Iow, if we’d call it random.py, it would not know what to do and give a config error?
Does HA use reserved names for this new system then?, and if yes, do you know where to read about that?

too bad would that be. Before we had several files life360.py and hue.py, which was awkward, confusing an possibly dangerous.
So I like that the devs took up on that and created a new way of handling things. Don’t like they invented a new way for identical naming… nothing solved here.

Nothing “reserved” about the names. But the names do mean something, just like they did before. It’s just where the files need to be and exactly how they need to be named has changed. Basically, nothing has changed (except for the details! :wink:)

And although I don’t like having to deal with the changes (like many people are having to do), the new structure does make a bit more sense. Remember, HA 1.0 hasn’t been released yet, so anything and everything is still vulnerable to significant change! :slight_smile:

Hi Phil,

In case you haven’t yet seen the v88.0 release notes… There is a new core component PERSON which combines the last state of multiple device trackers tied to an individual, much the same as your custom composite tracker (but much more basic). The UI even includes an integrated means to manage this component.

Interesting discussion of how this component came about can be found found in this architecture thread. There were references to related work in this area, but unfortunately your excellent custom composite tracker was not recognized. Even @balloob stated “The device tracker component should no longer be used to merge devices, this has never worked properly.”

While I think he is referring to the native merge function of the device tracker component, the fact is Person is now a core component and will even be automatically included by default for noob builds (per another new component Default_Config).

All of this circles back to the strong desire to see your premier presence detection work become official. Maybe @MartinHjelmare could work with you to incorporate your advanced composite tracker features like time zone into his Person component. Possibly this interaction could lead to someone who would willingly take over Life360, including making it an official Hassio add-on. :slight_smile:

You could still be very actively involved with developing new features and we could still continue to use Life360 as a custom component temporarily if those new features (or fixes) were needed immediately - especially if we knew they were submitted as a PR for review and eventual implementation.

1 Like

Hi,

Thanks. I am aware of the new Person component. See this post. I suspect (and hope) that my custom composite tracker platform will no longer be needed.

I e-mailed him directly to tell him about my custom composite tracker platform and said he should feel free to leverage any of my work. I have not heard back from him.

1 Like

I’m a very recent convert to Home Assistant (from Vera) and have been trying to get this Life360 integration working because I’ve been using it with my family for a number of years and seems like this integration works well…when it’s functioning, which is my issue.

I’ve installed custom_components/life360/device_tracker.py (previously using the old configuration, but changed today although the same issue either way.) I’ve added the following to my configuration.yaml:

#Life360 Tracker
device_tracker:
  - platform: life360
    username: !secret life360_username
    password: !secret life360_password
    add_zones: all
    driving_speed: 20
    home_place: Home
    interval_seconds: 10
    max_gps_accuracy: 200
    max_update_wait:
      minutes: 45
    prefix: life360
    show_as_state: driving, moving, places
    time_as: device_or_local
    zone_interval:
      minutes: 15
    warning_threshold: 1
    error_threshold: 2
    new_device_defaults:
      track_new_devices: true

When I restart I get the following error:

2019-02-21 18:29:37 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform life360
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/device_tracker/__init__.py", line 189, in async_setup_platform
    raise HomeAssistantError("Invalid device_tracker platform.")
homeassistant.exceptions.HomeAssistantError: Invalid device_tracker platform.

I’ve read through this thread and have tried a number of things on my own to try to resolve this, but to no avail. Help? :slightly_smiling_face:

You might not have copied the file correctly from github. Did you use the Raw button?

As has been discussed, starting with HA 0.86, the folder layout in custom_components has changed. I’ve recently updated the installation instructions. custom_components.json (which is used by Custom Updater) has also been updated to be compatible with the new layout.

If you are installing this custom platform for the first time:

Then just follow the recently updated installation instructions

If you do not use Custom Updater, and are updating HA from before 0.86 to 0.86 or later:

Then you need to manually move/rename the file. The following Linux commands (or similar) should make the necessary changes:

# From config folder
cd custom_components
sudo -u homeassistant mkdir life360
sudo -u homeassistant mv device_tracker/life360.py life360/device_tracker.py

If you use Custom Updater, and are on a version of HA before 0.86:

Then you’ll need to update the following line in your configuration for custom_updater. Change:

  component_urls:
    - https://raw.githubusercontent.com/pnbruckner/homeassistant-config/master/custom_components.json

to:

  component_urls:
    - https://raw.githubusercontent.com/pnbruckner/homeassistant-config/master/custom_components_old.json

Note: Once you update to HA 0.86 or later you should change it back.

If you use Custom Updater, and are on HA 0.86 or later:

Then you should be good to go. Just use the Custom Updater to install and/or update.

Note: You may need to clean up the old files after you install/update, if you care.

And just a heads up…

I was just about to post saying that the component still wasn’t being seen by the custom_updater then I thought I would try to and hit the “check” button one last time…and it popped back up.

So just in case anybody isn’t seeing the component in the list then hit that check button once more. :smiley:

Do you mean 0.88? If not then I am even more confused with this breaking change than I was before!

Starting with 0.86 the loader tried both cases, and silently accepted either. Starting with 0.88 it still accepts either but now generates a warning for the “legacy” layout.

1 Like

Thank you. I’ve got it running now. I’m on 0.88 and did have Life360 setup properly, but I had failed to setup the custom_updater configuration. Now if I can just learn how to use it!

I’m confused. The custom Life360 platform does not require custom updater in any way. You can use custom updater to install/update life360, but that’s not required. But as long as you’re good now, then I’m happy.

Releases 2.8.0

Delay firing events at startup so automations have a chance to get ready.

If i will use custom_updater to update the component, will this follow the latest news about platform path? Or we must always rename it to device_tracker.yaml ?

Did you see this post above?

Yes, but actually running the update_all gives me a failed call to that service…

Well then you should ask @ludeeus (who wrote Custom Updater) for help with that.

1 Like

I just updated to 0.88.1 and I am now getting this error:

Validate your configuration if you recently made some changes to your configuration and want to make sure that it is all valid
Configuration invalid
Platform not found: device_tracker.life360

Any suggestions?

Did you see this post above?

1 Like

Dear pnbruckner,
i have this error on hassio startup and life360 doesn’t work.

2019-02-26 02:14:10 ERROR (MainThread) [homeassistant.components.sensor.yr] Retrying in 17 minutes: Cannot connect to host aa015h6buqvih86i1.api.met.no:443 ssl:None [Try again]
2019-02-26 02:15:04 ERROR (SyncWorker_8) [homeassistant.util.package] Unable to install package life360==2.2.0: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x758a7930>: Failed to establish a new connection: [Errno -3] Try again')': /simple/life360/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x758a78b0>: Failed to establish a new connection: [Errno -3] Try again')': /simple/life360/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x758a7990>: Failed to establish a new connection: [Errno -3] Try again')': /simple/life360/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x758a7890>: Failed to establish a new connection: [Errno -3] Try again')': /simple/life360/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x758a7850>: Failed to establish a new connection: [Errno -3] Try again')': /simple/life360/
  Could not find a version that satisfies the requirement life360==2.2.0 (from versions: )
No matching distribution found for life360==2.2.0
You are using pip version 19.0.2, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
2019-02-26 02:15:04 ERROR (MainThread) [homeassistant.requirements] Not initializing life360.device_tracker because could not install requirement life360==2.2.0
2019-02-26 02:15:04 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform life360.device_tracker: Could not install all requirements.
2019-02-26 02:19:24 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/real_ip.py", line 34, in real_ip_middleware
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/ban.py", line 67, in ban_middleware
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/auth.py", line 99, in auth_middleware
    return await handler(request)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/view.py", line 118, in handle
    result = await result
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/http/data_validator.py", line 47, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/hassio/auth.py", line 55, in post
    await self._check_login(data[ATTR_USERNAME], data[ATTR_PASSWORD])
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/hassio/auth.py", line 72, in _check_login
    await provider.async_validate_login(username, password)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/auth/providers/homeassistant.py", line 229, in async_validate_login
    self.data.validate_login, username, password)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/auth/providers/homeassistant.py", line 126, in validate_login
    for user in self.users:
  File "/usr/local/lib/python3.7/site-packages/homeassistant/auth/providers/homeassistant.py", line 114, in users
    return self._data['users']  # type: ignore
TypeError: 'NoneType' object is not subscriptable

How can I solve this problem?