Life360 Device Tracker Platform

Balloob mentioned this on Discord yesterday:
Just for the record, custom components won't need a manifest file, it will work without
Link is here.

Discussion if __init__.py is needed is ongoing here.

Thanks. I tried getting ready for 0.92 as best I could figure, but that clearly didnā€™t go well, and now maybe the requirements are changing even before 0.92 is released. I think from now on Iā€™ll stick to fixing things if/when they break. Trying to prevent breakage ahead of time is a lot of work, and then everything changes anyway.

Yeah I understand what you are saying. Have 2 custom components that I manage on https://github.com/custom-components.

Glad I have waited until now before doing any updates :smile:

BTW, I also try to maintain backwards compatibility, because I know many people canā€™t keep up with HA releases. Iā€™m one of those people ā€“ for many reasons my ā€œproductionā€ system is still running 0.84.6.

And then thereā€™s custom_updater, and its differing requirements from HA. E.g., in order to get multiple files installed (i.e., use the resources parameter), custom_updater requires an __init__.py, which HA may or may not require. And then custom_updater wants the REQUIREMENTS statement in __init__.py, where HA wants it in the platform file (e.g., device_tracker.py.)

It all gets a bit ridiculous. I have five custom components that I try to maintain, and Iā€™m also working on submitting major improvements to the standard amcrest component (which takes forever because it takes forever to get reviewed in the first place, then it takes a while to get through all the review comments, etc. E.g., my last PR took over a week before it was noticed ā€“ and after me prompting ā€“ and itā€™s taken days to get through the review, and now itā€™s just sitting waiting for balloob to get time to get back to giving his final blessing. Meanwhile I have multiple other enhancements I want to work on that are mostly waiting on this PR getting finished and merged.)

And now Iā€™m considering trying to submit this Life360 integration into the standard release. Just shoot me! :wink:

1 Like

If itā€™s any consolation, we appreciate your hard work. :beers:

4 Likes

If anyone would care to take a look and provide feedback, Iā€™ve staged the life360 code for possible PR. You can see it here. The main differences to the current custom component are:

  • as_time configuration variable and time_zone attribute removed (and, hence, requirement for timezonefinderL and numpy packages.)
  • Service renamed from device_tracker.life360_zones_from_places to life360.zones_from_places.
  • Added service description.

I have not yet started on the ā€œofficialā€ doc page that would go with it. Assuming I do submit a PR I may wait to do the doc stuff until I get some indication as to whether or not theyā€™ll accept the code.

3 Likes

Iā€™ve switched to your proposed PR code - all is working just fine so far. I wasnā€™t using the as_time feature, so itā€™s not anything I will miss. Itā€™s interesting though that this was removed. Was this done at the request of the PR reviewers because of the dependency size or what?

Since this staged PR code isnā€™t tracked by custom_updater, whatā€™s the best way to follow any updates to it?

I noticed that the API token is hardcoded in the device_tracker.py code. Since this token is subject to change (which thankfullly, it hasnā€™t ever yet), might it be better to have it installed separately as a .life360_token file or in secrets? That way, if it ever does change, we can update it quickly and easily without waiting on the next release or rebuilding it as a custom component.

Lastly - itā€™s great that youā€™re making this effort to get this component into the official fold. It is greatly appreciated!

I havenā€™t created a PR yet. Iā€™m not even 100% sure I will (although Iā€™m definitely leaning that way.) I removed it because I predicted it wouldnā€™t be looked at kindly. I assume it will be a rough road getting this through in the first place, and didnā€™t think this feature was worth it. I still have it in my custom composite tracker, so itā€™s still available that way.

I suppose you can go to the repo and at the top click on Watch and select the Watching option. Not 100% sure what this does. Just an FYI, though ā€¦ I might make significant changes before submitting a PR. Youā€™re, of course, welcome to use this, but Iā€™m not going to be focusing on keeping it working, or worrying about ā€œbreaking changesā€, because the focus is getting it ready as best I can for submission. If you do follow along, however, and run into any unexpected problems, by all means, let me know.

Well this touches on the shakiest part of this whole effort. This API is not officially documented, or even supported, to my knowledge, by Life360. It was reversed Engineered by someone in the open source community, which is what this is all based on. Yes, that key can change, or the whole API might change significantly, or become completely unavailable, at any time. Iā€™m certainly not in a position to do anything about that. And Iā€™m afraid to even try, because if I bring this to their attention, they might decide to not only not support it, but shut it down instead. Who knows. Maybe balloob will consider talking to Life360 since he represents this entire project, which might mean more to Life360.

custom_updater is working really weirdly for me. Not only is it failing to track the Life360 component (but it OCCASIONALLY shows up following a reboot), but I canā€™t click the ā€œcheckā€ or ā€œupdateā€ buttons!

Hi, since last update to 0.92 Life360 is no longer working. I am getting an error:
Integration life360 not found when trying to verify its device_tracker platform
Anyone have an idea why?

Trying to keep up with all the structural changes is bad enough, but trying to keep up with custom_updaterā€™s unique and different requirements is worse.

Please try making sure you have the latest custom_updater, and restart HA.

Then manually run the custom_updater.install service specifying:

{"element": "device_tracker.life360"}

Then afterwards run the custom_updater.check_all service. (You may even have to restart HA before sensor.custom_component_tracker is updated correctly.)

That should work. Let me know how that goes.

Please make sure youā€™re using at least version 2.9.5 (the latest is actually 2.9.6.)

The (hopefully) good news is, Iā€™m forging ahead with submitting this as a new standard integration. I havenā€™t made the PRs yet, but I hope to soon. Then hopefully the review process wonā€™t be too bad, and maybe we can see this in the 0.94 release. :crossed_fingers:

5 Likes

@daneboom @ericlamer

I just tried with 0.92.0. I removed custom_components/life360 to start clean. I made sure I had the latest custom_updater (4.2.19.) Then I used custom_updater.install to install element ā€œdevice_tracker.life360ā€. That worked fine. Then I restarted HA and life360 seemed to work fine.

FWIW, the ā€œIntegration life360 not foundā€ error probably means youā€™re not using the latest & greatest version of life360.

1 Like

how do you get the latest custom_updater

You donā€™t have to use custom_updater to use the life360 custom component/integration. That is just one option. See these installation instructions for how to install life360 either via custom_updater (which links to instructions on how to install custom_updater) or manually.

1 Like

Thanks for this, Phil. I get:-

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 183, 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

Thank you for your input, re-loaded Hassio .92 and so far all good with life360

Thanks - I rebooted hass and now - inexplicably - it works.

(Prior to rebooting Iā€™d deleted all trace of Life360 from my system, and was planning on calling the install service again once it came back up. Weirdly, I didnā€™t need to - when it came back up somehow custom updater knew I wanted the life360 component and had it ready!)

1 Like

I just followed [pnbruckner] instructions