Life360 Device Tracker Platform

Do you mean custom_updater?

Sorry yes thatā€™s what I meant

1 Like

that is exactly what I experienced, didnā€™t have debug settings low enough to see errors in the log, but did see inspector errors of that sort, not being able to load resources. If it happens again, I will do so and check the logs for details.

Would it be possible to create a Persistant Notification if this happens? That would make it easier to notice and you would know the cause of the problem.

I havenā€™t noticed the problem myself.

And thanks for a great component!

Good news (well for you @pnbruckner), the docker container restarted again after 12h with custom_updater and life360 disabled.
Iā€™ll look elsewhere. Thanks though for looking into it

Thanks for the info. Glad it wasnā€™t me! :slight_smile: Hope you figure it out soon.

1 Like

I suppose it would be possible for the platform to fire an event if this happened. Then you could use that to create a persistent notification if you liked. However, looking at other device_tracker platforms, I donā€™t see any evidence of any of the others doing anything like this. Nor do I see any of them retrying. (Although Iā€™ll admit, I only looked at a dozen or so.) And, for example, I see the google_maps platform doing the same as life360 if a comm error happened during startup ā€“ i.e., aborting.

The problem is that the device_tracker component-level code has no provisions for retrying a platform setup if it fails like pretty much all other components do.

On the other hand, I suppose I could ignore errors at startup, with the theory being, if theyā€™re intermittent, then eventually things will start working. Maybe I could treat a login error specially, since thatā€™s not likely to get resolved just by time. Let me think some more on thisā€¦

1 Like

@MikeA, @Mariusthvdb

I havenā€™t checked any of this in yet, but Iā€™m testing some slight improvements in the error handling in the life360 PyPI package, the main thing being differentiating a login error. Then in the life360 HA custom platform, Iā€™m only aborting the setup if I get that login error. Otherwise I log any other errors as warnings and continue, with the hope that any error in talking to the Life360 server during startup, other than a login error, is temporary and will eventually clear like errors that happen after startup. Iā€™ll test this for a while, and if it looks promising, Iā€™ll release the changes.

1 Like

@pnbruckner

Great!

I like the way you think and how you write down your thought process. And your desire to improve your code.

2 Likes

@MikeA, @Mariusthvdb, et al,

Beta 2.7.0b1 is available that treats errors (other than login errors) as warnings during setup and continues. As usual, if anyone gives it a try Iā€™d appreciate any feedback.

Hey thanks for your work ! Beta [Beta 2.7.0b1] works for me as HA docker install.

1 Like

Iā€™m not sure were I have gone wrong. Setting up for the first time and I keep getting:
image

Upgraded to the Beta 2.7.0b1, restarted HA a few time and still the same errors. Is there some where I can find error logs to see whats causing this? Do I need to use my phone number for the username?

Here is whatā€™s in my config:

  - platform: life360
    username: myusername
    password: mypassword
    add_zones: all
    # MPH, assuming imperial units.
    # If using metric (KPH), equivalent would be 29
    driving_speed: 18
    filename: life360.conf
    home_place: Home
    interval_seconds: 10
    max_gps_accuracy: 200
    max_update_wait:
      minutes: 45
    members:
      - Dave
    prefix: life360
    show_as_state: driving, moving
    time_as: device_or_local
    zone_interval:
      minutes: 15
    # Set comm error thresholds so first is not logged,
    # second is logged as a WARNING, and third and fourth
    # are logged as ERRORs.
    warning_threshold: 1
    error_threshold: 2

Iā€™ve always used e-mail address for username, which is what I always use to log into the Life360 app and website. Iā€™ve never used phone number. If youā€™ve only ever used your phone number, then I honestly donā€™t know if that will work here, and if so, how to format the number.

Okay. I figured the email was good to use. Not sure why it will not connect. Do I need a port open to the Life360 server?

I suppose there are network configurations that could get in the way, but I would say, in general, if you can log into www.life360.com from the same machine, or at least another machine on the same network, (using the same e-mail address and password) then that shouldnā€™t be a problem.

FWIW, the error you are seeing is coming from the server, so communication seems to be working both ways. And that error is definitely the one youā€™ll see if the server is rejecting your credentials.

Got it working. I fat fingered the comma instead of the period in my user name.
Thankyou

1 Like

I finally had time to test Beta 2.7.0b1.

I loaded your component in a new virtual environment and it loaded and connect just fine. The two people in my circle were found and the locations shown.

I tried restarting the virtual environment with the network down. Home Assistant paused its loading and eventually started up once I restored the network. Your component worked again.

I then disabled the network while HA was running and then restored it again. Your component seem to survive.

Still running on 84.6

1 Like

hmmm - has it always behaved like this?
Just got a notification on my phone ā€œ[Wife] has arrived home!ā€ - this, from the iOS Life 360 app.
So I got to Home Assistantā€™s web front end on my desktop at work to see if HA knows.
Home Assistant does not know. My wife is still ā€˜awayā€™.
So I click the ā€œrefreshā€ button on the Life360 app on my phone and instantly Home Assistant knows where my wife is.
Any way to change/improve this? Or perhaps a limitation of the unofficial API?
Thanks!! :slight_smile: :slight_smile:

HA can only know what the Life360 server tells it. And it only knows that when it polls. So at the very least the polling interval introduces a delay from zero up to the interval you set (which, by default, is 12 seconds.)

But my guess is that the difference in the status between the Life360 app and HA is due to the situation discussed above. I.e., Life360 determines if someone is ā€œHomeā€ by using the Place you define for home, whereas HA uses its own zone.home. If those two are not the same, then the two systems can disagree. (They wonā€™t disagree with the personā€™s GPS coordinates ā€“ except for the polling delay I mentioned ā€“ but they can disagree about whether or not those coordinates indicate the person is in a Life360 Place and/or a HA zone.)

For more details and recommendations, see Home - Home Assistant vs Life360.

1 Like