Life360 Device Tracker Platform


#362

I was going to say the same thing as @jcollie - check known_devices.yaml. It contains an option to do just this called hide_if_away. Weird that it would have changed behavior on its own.


#363

Are you getting any other errors in the log? If you search home-assistant.log do you see life360 anywhere? It still sounds like you haven’t completed the installation successfully yet.


#364

Hello. Newbie questions here: I have setup Life360 and it displays my location correctly. The only problem is that my trigger is not working when I leave home. I didn’t setup places so home is the only place and it is correctly displayed. Also, how can I set my status to AWAY or NOT_HOME when I turn off my cell? I noticed that it doesn’t show away when I do so. Thank you!

  • alias: ‘LEFT_HOME’
    trigger:
    • platform: state
      entity_id: device_tracker.leo
      from: ‘HOME’
      to: ‘AWAY’
      for:
      minutes: 4
      action:
    • service: input_boolean.turn_on
      data:
      entity_id: input_boolean.set_alarms

#365

Hi! A device_tracker’s actual states are 'home' and 'not_home', not 'HOME' and 'AWAY', regardless of how they are displayed in the frontend. So your automation should be:

- alias: Left Home
  trigger:
    platform: state
    entity_id: device_tracker.leo
    from: 'home'
    to: 'not_home'
    for:
      minutes: 4
  action:
    service: input_boolean.turn_on
    entity_id: input_boolean.set_alarms

There has been quite a bit of discussion around this type of thing. The bottom line (at least to me) is, when you turn off your cell then there are no updates as to where the device is. The system, in general, then has to assume it’s where it was the last time it saw the device. It’s just as likely to be there as anywhere.

However, there are indications that you can use to take action if you choose to do so. E.g., you can look at the device_tracker’s last_seen attribute. If that becomes too old you can use that to trigger an automation to do something you find useful. Or you can use the life360_update_overdue event that can be fired depending on your configuration. (See the example in the docs.)


#366

Thank you Phil. I will try that. I changed it from home and not_home to that as it didn’t work the first time. I will change back and reboot to see if that works.


#367

Hi Phil

I am getting the error log below when starting my hassio (0.82.1) after installing the life 360 component as described here:

Do you have any solution?

Thanks a lot,

Christian

Log Details (ERROR)
Mon Nov 26 2018 22:07:51 GMT+0100 (Centraleuropæisk normaltid)

Error setting up platform life360
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/init.py”, line 184, in async_setup_platform
disc_info)
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/device_tracker/life360.py”, line 122, in setup_scanner
from life360 import life360
ModuleNotFoundError: No module named ‘life360’


#368

Does the HA server has access to internet? Because it looks like the life360 file isn’t downloaded from PyPi.

Otherwise you can try to restart HA to see if that solves the issue. I have had comparable issues with a custom component of mine which were solved after a restart :sunglasses:


#369

As best I can tell by browsing through the HA code, and per my own testing, when it tries to setup the life360 device_tracker platform for the first time, it should automatically try to install the life360 package from the PyPI. If that doesn’t work you should see errors. E.g., you should see “Not initializing device_tracker.life360 because could not install requirement life360==2.*”.

If after restarting as @gerard33 suggests you’re still seeing the same ModuleNotFoundError, let me know. I can try and do some more testing.

BTW, which method did you use to install my life360 device_tracker platform? Using Custom Updater, or manually copying life360.py from my github repo?


#370

Hi guys

Thanks for your fast replies. I did use the manual/alternative install method.

Now agter 5 or 6 reboots it suddently works.
Maybe some updater has finished meanwhile?

Anyway, thanks again - Now I Can start playing around with some presence detection


#371

It looks like it was exactly the same issue that you had reported on Oct 1st (and is now closed as fixed? :thinking:).

If I add the cards option to the tracked components then it works.

I filed another issue on this. hopefully this time it will stay fixed.


#372

I saw the issue you created. In it you say you’re using custom_updater version 3.1.0, but I believe the bug was fixed in 3.1.2, and the latest version is 3.1.8. You might want to try updating the custom updater. :slight_smile:


#373

I literally just downloaded and copied over the raw files from the custom_updater github so I’m not sure what happened. I’ll download again and see if it fixes it.

Maybe that will also actually fix the install because I was just going to post that the install didn’t actually occur even tho the custom_updater log said it did because now when I try to put in the device tracker config I get the same error as @alarmour did above (“platform not found: device_tracker.life360”).

I’ll try it again and report back.


#374

FYI, the custom_updater now has a feature whereby it checks the custom component being “installed” to see if it has any REQUIREMENTS (which is what HA also uses to determine it needs to install life360 from the PyPI.) If it does, then it tries to do the install from PyPI (which, in theory, means HA doesn’t need to do it.) It could be that that feature of the custom_updater doesn’t work with the REQUIREMENTS statement in my device_tracker.life360 custom component. Not saying it works or doesn’t - just saying it might be an issue to watch for.


#375

OK. I now have the correct version of the custom_updater and ran the install again, restarted HA, added the life360 component and I’m still getting the “platform not found” error.

Should the custom_updater be creating the device_tracker directory in custom_components directory and installing the life360.py file there? If so, it’s not.

Anything else I can check to see why it’s not installing it?

Maybe it would be easier to skip the custom_updater and install it the old fashioned way! :smiley:

EDIT:

Just installed it manually and it’s working!:smiley:

If you need any help with troubleshooting the issue with the custom_updater just let me know and I’ll help all I can. I’d like to get that working, too, since I’d like to use it for other custom components, as well.


#376

Thanks for the details. I’ll try to look into why the custom updater isn’t installing this anymore. It used to, but I haven’t really checked since I moved part of the solution to the PyPI and added the REQUIREMENTS statement to device_tracker.life360.


#377

Hi Phil. The home/not_home didn’t work for me. This is what I’m using. It’s just a trigger when me or my wife leaves home. If we’re both away it should turn on an input boolean but it’s not working. It used to work with router presence, but not with life360. Any ideas?

  • alias: ‘LEFT_HOME’
    trigger:
    • platform: state
      entity_id: device_tracker.leo
      from: ‘home’
      to: ‘not_home’
      for:
      minutes: 4
    • platform: state
      entity_id: device_tracker.tuna
      from: ‘home’
      to: ‘not_home’
      for:
      minutes: 4
      condition:
      condition: and
      conditions:
      • condition: state
        entity_id: device_tracker.tuna
        state: ‘not_home’
      • condition: state
        entity_id: device_tracker.leo
        state: ‘not_home’
        action:
    • service: input_boolean.turn_on
      data:
      entity_id: input_boolean.set_alarms

#378

You need to format that YAML code so it can be properly read. Please see instructions at the top of the page.


#379

Hey Phil. Just an FYI in case this helps someone. If you have the Life360 installed in a cellphone in another language, the state will flow in that language. state was not working until I found that it is hogar instead of home for mine.


#380

Ah, that is very helpful! I’ll have to figure a way to deal with that.

See issue #73.

@Leonardo_Del_Vecchio, I should also say, the device_tracker entity’s state should definitely be 'home' when you’re home. It’s a bug in my code that is allowing 'hogar' to “get through” as a state. Until I get this fixed you might want to remove places from the show_as_state config option.


#381

I’ve created a beta (2.3.0b1) fix for this. You can find it here. If anyone gives this a try, let me know how it works for you.

This adds a new, optional config item named home_place. It really only applies if you’re using places in show_as_state. Set this to the name of the Life360 Place that corresponds to the location of home as configured in HA. This option is case insensitive. The default is Home.

So, e.g., you might have this in your config:

device_tracker:
  - platform: life360
    username: !secret life360_username
    password: !secret life360_password
    prefix: life360
    show_as_state: driving, moving, places
    home_place: hogar
    driving_speed: 18
    max_gps_accuracy: 200
    max_update_wait:
      minutes: 45