Life360 Device Tracker Platform

device_tracker:

Ok, thanks.

So you might be seeing the same behavior as @rossmatt06 did (see posts just above.) I.e., your Life360 Home Place may not agree with your HA zone.home. Even if their centers are the same, their sizes might be different.

By default, your HA Life360 device_tracker entityā€™s state will be set to 'home' when the circle defined by the GPS coordinates & accuracy reported by Life360 overlaps with HAā€™s zone.home. Whereas Life360 decides if youā€™re home based on how you defined the Home Place in Life360. So, again, if HAā€™s zone.home does not agree with your Life360ā€™s Home Place, then HA and Life360 may not agree as to when youā€™re ā€œHome.ā€

If this is what is happening, then Iā€™ll make the same recommendations as I did to @rossmatt06:

So, really, the easiest way to resolve this (assuming this is your problem) is to add the following to your HA life360 configuration:

    show_as_state: places

This will cause your HA device_tracker entityā€™s state to be set to 'home' whenever Life360 reports you are in your Life360 Home Place. (BTW, this assumes the actual name of this Life360 Place is ā€œHomeā€. If not, you should also add the HA life360 configuration variable home_place.)

Based on recent feedback and discussion, Iā€™m considering adding a new choice for add_zones that would update HAā€™s zone.home to match Life360ā€™s Home Place (or, more accurately, any Life360 Place whose name matches the home_place configuration variable.) This would override HAā€™s zone.home (as described here.)

Currently the add_zones feature purposely ignores Life360 Places whose name matches the value of the home_place configuration variable. However this can lead to the situation discussed above ā€“ HA and Life360 not agreeing if youā€™re home, due to differing definitions of the home area.

The new option would be add_zones: include_home_place.

Before I look into implementing this Iā€™d appreciate feedback on what you think about it.

Iā€™m also considering adding a service that will run the zones_from_places function so that you can manually update the HA zones created from Life360 Places (say when you change the Places defined in Life360.) Currently youā€™d either have to restart HA, or wait until the next periodic update (specified by zone_interval.)

1 Like

I think thats a good feature.
However; After adding the config in the main post I set the lat and long in my config to 0.
But the Home/Away feature is working perfect, seems like its using the zone in Life360?

You should still make sure latitude and longitude under homeassistant in configuration.yaml (or the explicit definition of HAā€™s Home zone, if you use that) is correct, since these values are used by other things such as sun.sun, etc. Of course, if/when I implement the new feature, and you choose to use it, this can be done automatically for you. :slight_smile:

And, yes, if you added show_as_state: places to your life360 configuration in HA, then when Life360 reports that you are in its ā€œHome Placeā€, then your HA device_tracker entity will be set to home. In this case it doesnā€™t matter (for the most part) how HAā€™s zone.home is defined.

Released 2.5.0

Add new configuration variables warning_threshold and error_threshold to filter inconsequential communication errors.

I am having serious problems after upgrading to 2.4.0. Home Assistant refuses to start without giving me any error. It just stops the process of runningā€¦ After downgrading again to 2.3.1 the issue is solved. What do you think about it? What i did was only to download the 2.4.0 and adding the ā€˜time_as: device_or_localā€™ option to the configuration. Did i miss something? @pnbruckner

2.4.0 (and later) has a new Python Package requirement, specifically timezonefinderL (which itself requires numpy.) The first time you start after upgrading the Life360 custom platform, HA will need to download and install these (from PyPI.) This can take a while. Even though the GUI may not respond during this time, you should see activity in home-assistant.log (try using ā€œtail -f home-assistant.logā€ to see if events are being logged.) These are both somewhat large packages (relative to other packages used by HA and its components.) So, even though this is the same thing that would happen whenever any new package (or new version of a package) is required, the size may make it take longer than usual.

Ok, so i donā€™t need to install manually any new package? It will all automatic made by HA?
During the start process i was using this command to check the activity: ā€˜sudo journalctl -fu [email protected]ā€™ but nothing appeared about what you writeā€¦ I expected also more than 20 minutes to see what was happening butā€¦ nothingā€¦

No, you should not need to install those packages manually. HAā€™s module loader will do that automatically when it loads my module.

The command you used to see activity during startup should work as well.

So you say you waited 20 minutes and nothing. Do you mean there were no logged events that had to do with my component, or there was no output at all?

If you like, you can try manually installing it via these commands (which you may have to adjust, depending on how you installed HA):

sudo -u homeassistant -H -s
source /srv/homeassistant/bin/activate
pip3 install timezonefinderL
deactivate
exit

Then restart HA and see if it makes any difference.

numpy can use a good 30min on a RPi with little to no activity in the log :frowning:

Not sure how long it took the first time it was downloaded and installed on my RPi. I probably would not have added this feature, and its requirement to use timezonefinderL (which needs numpy), due to this reason (and their size) if there werenā€™t standard HA components that also use numpy.

During the 20 and more minutes there were no output at all. All it seemed blockedā€¦

Well, not sure what to tell you. I know it has worked for me and at least a few others. Maybe you can try manually installing timezonefinderL (which will also install numpy) using the instructions I provided above. Then when you restart HA, it wonā€™t have to install them so it should be able to start up normally. (If youā€™re on a RPi, and want to use the time zone feature, donā€™t forget to also install libatlas per the instructions on my life360 doc page.)

Or, you can use the Custom Updater, which also will install requirements when you use it to install or upgrade custom components such as life360.

Does it means that if i donā€™t want to use the zone features i can also donā€™t need to install timezonefinderL ? Does it means i can not use the option time_as so to not need to install timezonefinderL and numpy?
I already use custom updater, so if i do an update_all from the frontend it will install all requirements together with the latest version of life360.py ?
EDIT: i already installed libatlas.

You can use time_as with utc or local, and it will not need timezonefinderL (and numpy.) However, the way the system works, if a package might be used, it needs to be listed in the REQUIREMENTS variable, and that will cause it to be installed, even if it isnā€™t going to be used. The system is not based on the configuration, only what the configuration might need.

There was discussion above about trying to find a way to have these packages installed only if the configuration actually needed them. But that turned out to be fairly complicated, so I gave up on it.

If you use custom updater, and if you updated life360 using its update_all service, then in theory, the packages should have been installed at that time (as opposed to when you restarted HA.) So, if that worked, then your problem should not be caused by HA taking a long time to install those packages.

Bottom line is, I guess we still donā€™t really know whatā€™s causing you problems. Weā€™ve only guessed that it might be the long download/install time.

As an experiment, you could edit life360.py to remove timezonefinderL from the REQUIREMENTS list. Then, if you donā€™t use time_as, or you set it to utc or local, then everything should work. If it does, then it would seem the problem does has something to do with installing these extra packages. But if not, then there is probably another issue causing the problem.

Ok, tomorrow iā€™ll try again with custom updater and see what happensā€¦ will let you knowā€¦
So i can use time_as option with local instead device_or_local ?
EDIT: I updated life360.py manually as with custom updater i got often failed to call that serviceā€¦

Yes.

Were there any error messages, or any debug messages in the log (related to custom updater, or anything I guess) that might be helpful to provide some insight into the problems youā€™re having?

No error in logsā€¦ only get ā€˜failed call service update_allā€™ or something similar on the frontend.