Life360 Device Tracker Platform

I recently received the error “Platform not found: device_tracker.life360” after updating to 0.88.2.

-I have the folders reconfigured as custom_components/life360/device_tracker.py
-I deleted the pycache folder
-I copied the most recent code from the github page into my device_tracker.py file.

My original error went away but now I get the following error:

Error setting up platform life360
Traceback (most recent call last):
  File "/config/custom_components/life360/device_tracker.py", line 157, in setup_scanner
    from life360 import life360, LoginError
ModuleNotFoundError: No module named 'life360'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/device_tracker/__init__.py", line 184, in async_setup_platform
    disc_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 161, in setup_scanner
    except LoginError as exc:
UnboundLocalError: local variable 'LoginError' referenced before assignment

Any idea how to fix this?

Thanks!

That seems to imply the life360 python package isn’t installed. That is supposed to be installed automatically. Do you see any errors in home-assistant.log about attempting to install life360?

Try restarting and see if the errors go away. I’ve seen where some people have had issues with HA failing to install requirements (such as this), but after restarting it succeeded and the errors went away.

If that doesn’t solve the problem, and you’re comfortable with running things from the command line (and you’re not hampered by hassio), then we can try to diagnose the problem. Let me know.

I must say that i am having the same type of issue. I have removed and then reinstalled with the custom updater with no joy

Error loading custom_components.life360.device_tracker. Make sure all dependencies are installed

Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/homeassistant/loader.py", line 147, in _load_file module = importlib.import_module(path) File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 962, in _find_and_load_unlocked ModuleNotFoundError: No module named 'custom_components.life360.device_tracker'; 'custom_components.life360' is not a package

Connection lost. Reconnecting…

EDIT: So as not to cause more confusion, I’m deleting my original reply in this post. Seems @ludeeus’s comment below is more on point!

Just wanted to mention that I updated to Hassio 88.2 yesterday and am not having any issue with either life360 or composite trackers loading.

Yeah, custom_updater problems are a different story! :wink:

tip to anyone running docker/hassio and have upgraded from < 0.88.0 you are now running python 3.7, if you get import errors delete the content of the /config/deps/ folder and restart Home Assistant, and it should trigger a re-installation of external python packages.

1 Like

Ah, that would seem to definitely explain these new issues that came out of the blue. Wow, thanks for the info!! :slight_smile:

@pnbruckner Thanks for your help, back up and running. Cheers :+1:

Can you explain what you did? Did you change the folder name, or did you do as ludeeus suggested? If the former, and you’re using docker/hassio, then you should probably put it back the way it was and try ludeeus’ suggestion instead, otherwise you may get bit again in the future.

I deleted the folders that ludeeus suggested and rebooted. However still have the same issue.

I renamed the folders as you suggested and it started working.

BTW I am using Hassio.

I did just rename the folder back to normal and rebooted for sanity sake and I still have the issue.

Well, this isn’t good. If I were you I’d try to get to the bottom of it. E.g., do you see any errors in home-assistant.log about failing to install life360? (You may have to stop HA, delete that folder and try again, because the errors, if they existed, might be gone, depending on if you restarted since the first time you did that.) Or can you run pip3 list from a command line to see what packages are installed? The problem is, I don’t use hassio so I’m not sure what you can and can’t do, and how.

The problem might be due to that change in the loader I mentioned previously. If that’s the case, then maybe you can keep the temporary folder renaming until 0.89 comes out. Still, would be nice to know for sure what the problem really is.

I just created a fresh install of 0.88.2, using Python 3.7.2. I installed custom_updater (4.2.16) and used it to install element “device_tracker.life360”. After restarting (and adding a basic life360 device_tracker config) it seems to work just fine. It would appear that you have some kind of unique issue. I’m not sure what to tell you.

Thanks! A restart fixed it. I had restarted after updating the device_component.py file. I suppose an additional restart was all it needed.

Sorry for the late response, i think i can now say its working.
I stopped the HA and deleted the folders ludeeus recommended and the life360 folders. Then i restarted the server reinstalled and its now working.
Thanks for all your great help

1 Like

Just a heads up to all that use the @ludeeus custom_updater, a few days ago he has “partially deprecated” this component and is seeking input on a new direction to handle custom updates.

So no real cause for alarm, as he says it will continue to be supported until a replacement is available. Reference custom_updater issue #117 for further info and to provide comment.

I hope they can figure something out this has been working great for me

I have been trying for a few days now to get this working. Not sure if Node Red can do it. Here is what I have now. Home and not Home works but Work and leaving Work does not. Most be something with the message data.

How can you test leaving some place, instead of arriving in a place?

I imagine you have a zone defined as Work with right capitalization.

Basically I’m looking at how does Life360 know you just left Home and notify you in there own app. Can I do the same in Node Red?

When I’m at work HA’s device tracker life360 says “Dave Work”. I have tried with the space and with an underscore.

image

Can you make a screenshot of the switch in Nodered?