Just follow the installation instructions.
So. All seems to have gone well. Hassio is all back and working with life360 not complaining at all.
However:
I installed the
custom_updater so next time I can just use the ācustom_updater.update_allā service.
But a word of caution to othersā¦ it too is a custom component and as such may lead to issues. as of right now itās still supported and will track updates of other custom components for you and allow you to use the service ācustom_updater.update_allā
Now I have this error.
19-05-02 16:47:28 ERROR (MainThread) [hassio.api.proxy] Client error on WebSocket API Cannot connect to host 172.30.32.1:8123 ssl:False [Connection refused].
Iām not sure where in my system I need to set ssl to ātrueā?
So this feature (being able to list a subset of members to include) has been around since July 2018 (and this custom component has only itself been around a little longer than that.) So itās pretty much always been there.
I did find the post where the feature was requested. It has to do with Life360 Members who often turn off their phones, and donāt need to be tracked anyway. Without being able to exclude them, it causes a lot of errors in the log. I suppose that could be addressed another way, but why ping the Life360 server unnecessarily? Every member has to be updated via a separate query to the server, so trying to get updates for Members that arenāt being tracked anyway would cause a lot of unnecessary traffic.
So I think Iāll leave the feature in, with some enhancements Iāve already made to hopefully make it easier to use. Iāll also try to do a better job of making it more obvious in the documentation not to use this feature unless you need to. (E.g., I wonāt put it in the āfullā example, because people tend to just copy those examples without thinking too much about it. )
EDIT:
FWIW, this is what the config variable will look like:
members:
include:
- Joe Smith
- Jane Smith
- Child1
or
members:
exclude:
- Mr Spock
- Bones
Letās say you have two Circles, where Joe Smith, Jane Smith and Child1 are in a Circle named āMy Familyā, and Mr Spock and Bones are in another Circle named āStar Trekā. Without specifying the members
config variable, all would be tracked. However, with either of the configuration options above, only Joe Smith, Jane Smith and Child1 would be tracked.
Youād see something like this with the first option (and with DEBUG enabled):
DATE TIME DEBUG (SyncWorker_4) [homeassistant.components.life360.device_tracker] Including: life360_joe_smith, life360_jane_smith, life360_child1
Or with the second option:
DATE TIME DEBUG (SyncWorker_4) [homeassistant.components.life360.device_tracker] Excluding: life360_mr_spock, life360_bones
Followed by (in either case):
DATE TIME DEBUG (SyncWorker_4) [homeassistant.components.life360.device_tracker] Joe Smith -> life360_joe_smith: will be tracked
DATE TIME DEBUG (SyncWorker_4) [homeassistant.components.life360.device_tracker] Updating life360_joe_smith
DATE TIME DEBUG (SyncWorker_4) [homeassistant.components.life360.device_tracker] Jane Smith -> life360_jane_smith: will be tracked
DATE TIME DEBUG (SyncWorker_4) [homeassistant.components.life360.device_tracker] Updating life360_jane_smith
DATE TIME DEBUG (SyncWorker_4) [homeassistant.components.life360.device_tracker] Child1 -> life360_child1: will be tracked
DATE TIME DEBUG (SyncWorker_4) [homeassistant.components.life360.device_tracker] Updating life360_child1
DATE TIME DEBUG (SyncWorker_4) [homeassistant.components.life360.device_tracker] Mr Spock -> life360_mr_spock: will NOT be tracked
DATE TIME DEBUG (SyncWorker_4) [homeassistant.components.life360.device_tracker] Bones -> life360_bones: will NOT be tracked
DATE TIME DEBUG (SyncWorker_4) [homeassistant.components.life360.device_tracker] Setup successful!
After that youāll just see the usual āUpdating ā¦ā messages.
Iām also going to add a circles
configuration variable, which can also have include
or exclude
. So the same result could be obtained by:
circles:
include:
- My Family
Or:
circles:
exclude:
- Star Trek
circles
and members
can be used together or separately. This is similar to how the recorder
can be configured (except in its case itās domains and entity_ids.)
EDIT 2:
BTW, the nice thing about this DEBUG output is, if youāre not sure what the full names are in Life360, you can leave the members
variable out at first, and just look at the debug output to see what they are. Then you can copy and paste into the members
config variable as needed. (And then remove corresponding entries in know_devices.yaml.)
@Lima I see you just liked a post where the suggestion was to delete the life360.conf file. Since release 2.9.0 (made on 3/21/2019) that should no longer be necessary. If you change your Life360 password, and update your HA life360 configuration accordingly, the life360.conf file should be automatically deleted and regenerated with the new credentials. Just an FYI!
If thatās the case then Iād agree with leaving it. In my quick look over the code it looked like line 544 gets data for all members in the given circle and then you loop through those results, only updating the HA entities that were included in configuration.
It doesnāt matter to me either way, just trying to save you unnecessary work.
Great component @pnbruckner
Iāve been using it for quite some time without issue. I recently updated HASS to 92.1 and it unfortunately broke my Life360 integration. Iāve tried following your instructions and am trying to manually install 2.9.5 without luck. I figured I would simply delete the old files in the folder and start over, but wonder if that screwed things up. Hereās the error:
Error setting up platform life360
Traceback (most recent call last):
File ā/config/custom_components/life360/device_tracker.pyā, line 149, in setup_scanner
from life360 import life360, LoginError
ModuleNotFoundError: No module named ālife360ā
I believe this is because Iām not using the custom updater and need to install the life360 package (pip install life360) but Iām feeling helpless as I canāt figure out where/how to do that. Iām not using the custom updater as it seemed easy enough to copy the contents of the raw files and put them in the custom_components/life360 folder.
I didnāt see this error posted yet, so Iām sure itās something Iām doing wrong.
Thanks in advance!!!
Duh! Yeah, youāre right! I guess itās been a while since I concentrated on that particular detail. Yes, it does get data for all the members in a particular Circle in one query. IIRC from when I did mess with those details I could have it get individual member data one at a time, but that would probably make it worse in the general case.
Still thereās the error case that started it all, and the feature has been there so long ā¦ I might regret it, but Iāll leave the feature in for now.
Youāre right, you donāt need custom_updater. HA itself should install the package. (Generally, unless you really know what youāre doing, you donāt want to mess with that.)
Are you sure you have all three files?
/config/custom_components/life360/device_tracker.py
/config/custom_components/life360/__init__.py
/config/custom_components/life360/manifest.json
And that you copied them from github using the Raw button for each?
I am absolutely positive I have all 3 files and that they were copied from the RAW format. It also automatically created a __pycache__
folder that has 2 files:
/config/custom_components/life360/__pycache__/__init__.cpython-37.pyc
/config/custom_components/life360/__pycache__/device_tracker.cpython-37.pyc
Here is the full error:
Fri May 03 2019 06:55:23 GMT-0400 (Eastern Daylight Time)
Error setting up platform life360
Traceback (most recent call last):
File "/config/custom_components/life360/device_tracker.py", line 149, 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 177, 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 154, in setup_scanner
except LoginError as exc:
UnboundLocalError: local variable 'LoginError' referenced before assignment
The only thing I can think of is HA is having problems installing the life360 package. Here is what I see in my log (after doing a fresh install of 0.92.2):
(ha-0.92.2) phil@ha-intel:~/test/ha-0.92.2$ grep -e Attempting -e life360 ~/.homeassistant/home-assistant.log
2019-05-03 08:03:27 INFO (SyncWorker_1) [homeassistant.util.package] Attempting install of aiohttp_cors==0.7.0
2019-05-03 08:03:28 INFO (SyncWorker_7) [homeassistant.util.package] Attempting install of sqlalchemy==1.3.0
2019-05-03 08:03:30 INFO (SyncWorker_9) [homeassistant.loader] Loaded life360 from custom_components.life360
2019-05-03 08:03:30 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-05-03 08:03:30 INFO (SyncWorker_10) [homeassistant.util.package] Attempting install of restrictedpython==4.0b8
2019-05-03 08:03:31 INFO (SyncWorker_2) [homeassistant.util.package] Attempting install of pychromecast==3.2.1
2019-05-03 08:03:33 INFO (SyncWorker_1) [homeassistant.util.package] Attempting install of life360==3.0.0
2019-05-03 08:03:34 INFO (SyncWorker_11) [homeassistant.util.package] Attempting install of timezonefinderL==2.0.1
2019-05-03 08:03:38 INFO (MainThread) [homeassistant.components.device_tracker] Setting up device_tracker.life360
2019-05-03 08:03:38 INFO (SyncWorker_19) [homeassistant.util.package] Attempting install of home-assistant-frontend==20190427.0
2019-05-03 08:03:38 DEBUG (SyncWorker_8) [custom_components.life360.device_tracker] Updating life360_xxx
2019-05-03 08:03:38 DEBUG (SyncWorker_8) [custom_components.life360.device_tracker] Updating life360_yyy
2019-05-03 08:03:38 DEBUG (SyncWorker_8) [custom_components.life360.device_tracker] Updating life360_zzz
2019-05-03 08:03:38 DEBUG (SyncWorker_8) [custom_components.life360.device_tracker] Setup successful!
Can you show me a complete, recursive directory listing for /config/custom_components?
With HA stopped, do you know how to use pip to list installed packages in the environment in which HA runs?
Oddly enough, thereās not a single entry in my log file that contains āAttemptingā - so itās clearly not attempting to install anything. I did have this working at one time with an earlier version of HA, but thought Iād clear stuff out and use the 3 new files after updating to 0.92.1
Seriously thoughā¦ if this isnāt an issue that others are experiencing, I can simply backup my configs and do a fresh install of HA tonight.
Iāve never used PIP to list installed packages, but Iām happy to try it. I have SSH access, but the PIP command doesnāt seem to be installed.
Thatās not necessarily an issue. If the packages required are already installed (from a previous run), it doesnāt need to install them, and hence you wouldnāt see those messages. But, in your case, it doesnāt seem to be able to find the life360 pypi.org package, so thatās a problem.
Ok, so thatās all the files under /config/custom_components (i.e., you didnāt just show a truncated output)? If so, then it doesnāt look like a file from an older version (e.g., /config/custom_components/life360.py, or /config/custom_components/device_tracker/life360.py) is causing a problem.
Iāve only used a āvenvā install, so Iām not sure what youād need to do to get āintoā the Python environment used by HA in your scenario (again, since I assume youāre using hassio, or something like that.) So, unfortunately, if you donāt already know how to do that, Iām not going to be able to help. You may need to do a fresh install and then the first time you run it, see if it attempts to install ālife360==3.0.0ā, and ultimately, if the error goes away.
So a couple of interesting details (that may or may not mean anything):
Here is a listing from my test system:
(ha-0.92.2) phil@ha-intel:~/.homeassistant/custom_components$ ls -lR
.:
total 4
drwxrwxr-x 3 phil phil 4096 May 3 09:05 life360
./life360:
total 36
-rw-rw-r-- 1 phil phil 22196 May 3 09:05 device_tracker.py
-rw-rw-r-- 1 phil phil 53 May 3 09:05 __init__.py
-rw-rw-r-- 1 phil phil 301 May 3 09:05 manifest.json
drwxrwxr-x 2 phil phil 4096 May 3 09:06 __pycache__
./life360/__pycache__:
total 20
-rw-rw-r-- 1 phil phil 14929 May 3 09:06 device_tracker.cpython-36.pyc
-rw-rw-r-- 1 phil phil 207 May 3 09:06 __init__.cpython-36.pyc
First, notice that the file sizes of the three files in the life360 folder differ from what you get. Look in __init__.py
ā what version do you have?
Also, notice the file extensions of the files in __pycache__
. You must be using Python 3.7, whereas Iām using 3.6. That shouldnāt matter, butā¦
Released 2.10.0
Added debug output showing dev_idās (i.e., second part of device_tracker entity_idās) that will be included if members
configuration variable is used. Also, the first time data for each member is retrieved from the Life360 server, output a debug message that shows the memberās full name (which is what needs to be used in the members
configuration variable, if you choose to use it ā it is optional after all ), the corresponding dev_id, and whether or not the member will be tracked.
If you use members
, then you should see output like this:
2019-05-03 09:26:57 DEBUG (SyncWorker_14) [custom_components.life360.device_tracker] Including: life360_aaa_bbb, life360_ccc
Whether or not you use members
, you should always see output like this:
2019-05-03 09:26:57 DEBUG (SyncWorker_14) [custom_components.life360.device_tracker] Aaa Bbb -> life360_aaa_bbb: will be tracked
2019-05-03 09:26:57 DEBUG (SyncWorker_14) [custom_components.life360.device_tracker] Updating life360_aaa_bbb
2019-05-03 09:26:57 DEBUG (SyncWorker_14) [custom_components.life360.device_tracker] Ccc -> life360_ccc: will be tracked
2019-05-03 09:26:57 DEBUG (SyncWorker_14) [custom_components.life360.device_tracker] Updating life360_ccc
2019-05-03 09:26:57 DEBUG (SyncWorker_14) [custom_components.life360.device_tracker] Ddd Bbb -> life360_ddd_bbb: will NOT be tracked
2019-05-03 09:26:57 DEBUG (SyncWorker_14) [custom_components.life360.device_tracker] Setup successful!
If everything seemed to install ok, and you get no configuration errors (other than the usual warning about using a custom integration), yet you donāt see the device_tracker entities you expect, or theyāre not updating, and youāre using the members
configuration variable, then make sure debug is enabled in the logger, and look in home-assistant.log for messages like the above. Especially look at the full names shown for each member, and compare that to what youāre using in the members
configuration variable.
Iāve made the PR a āWIPā (Work-In-Progress) for now.
I just updated it with the latest changes relative the members
configuration variable, as well as adding a new circles
configuration variable. The idea is, if you donāt use these, all members from all circles will be tracked, which, I would think, would be the ānormalā case for most people.
However, you can use them to limit which members are tracked. First you can specify which circles to include or exclude. Second you can specify which members to include or exclude (from the set of members that are in the circles that are included, or not excluded.) This is similar to how the recorder component is configured (except with domains and entity_idās.) To be clear, you can use circles
, or members
, or both.
Anyway, if anyone would like to take a look and provide feedback, and maybe even try it out as it is now, Iād appreciate it! If you do try it, note that youāll need to adjust you configuration accordingly. On that note, I still have to update the proposed documentationā¦
Lastly, I plan to add one more configuration variable: places
, which will also be an exclude
or include
list type of variable. This will impact show_as_state: places
and add_zones
(and be ignored if neither of those are used.) Again, the idea is being able to limit which Places are used in case there are some you donāt care to see in HA (or if there are only a few you do. And, now that I think of it, add_zones
can be simplified, since places
can be used to include or exclude the āHome Placeā when it comes to updating ā or not updating ā zone.home
.)
iāve got a problem , iām always appear home and my battery is still 100% and always battery chargingā¦
i try the debug but all seems ok
019-05-03 19:56:12 DEBUG (SyncWorker_17) [custom_components.life360.device_tracker] Fabrice Barthelemy -> life360_fabrice_barthelemy: will be tracked 2019-05-03 19:56:12 DEBUG (SyncWorker_17) [custom_components.life360.device_tracker] Updating life360_fabrice_barthelemy 2019-05-03 19:56:12 DEBUG (SyncWorker_17) [custom_components.life360.device_tracker] Setup successful!
Youāre a bit vague, but Iām guessing you mean that when youāre phone is not home device_tracker.life360_fabrice_barthelemy still shows as home. What does it show on the Life360 app or website? If the Life360 server doesnāt know the phone is away from your home, thereās no way for HA to know it.
Regarding the battery and charging state, itās possible the battery level is rounded to 100% even though itās still actually charging. But, again, if the Life360 server isnāt getting updates from your phone, thereās no way for HA to get updates.
If the problem is indeed that Life360 isnāt getting updates from your phone, then Iād suggest checking the Life360 FAQs.
Yes you find it , i relaunch the android app and all the info are updated !!
Hello all. I migrated to 0.92 and I had a problem with the component.
The solution was:
Open device_tracker.py and cut the 2 lines:
DEPENDENCIES = [āzoneā]
REQUIREMENTS = [ālife360==2.*ā]
Create a file custom_components\life360_init_.py and paste there the 2 lines.
Thats it!
I hope it will help someone!