Life360 Device Tracker Platform


#342

Hi,

Great work on this. much better than Owntracks. just a question, how do i pull the battery % out to display on the frontend. sorry for the stupid question, but still new.


#343

Use a Template Sensor.

sensor:
  - platform: template
    sensors:
      dev_battery:
        friendly_name: My Device Battery
        value_template: "{{ state_attr('device_tracker.ME', 'battery') }}"
        unit_of_measurement: '%'
        device_class: battery

#344

Hi, thanks for the brilliant platform! when installing i’m getting this error

SyntaxError: invalid syntax
Fatal error while loading config: invalid syntax (life360.py, line 7)
Failed config
  General Errors: 
- invalid syntax (life360.py, line 7)
Successful config (partial)

Thank you


#345

My guess is you didn’t copy the file correctly from the github page. If you haven’t done this before, make sure you click the “Raw” button to get the raw text of the file. I’m guessing you copied the HTML page source instead.


#346

Hi

Thank you so much. Work 100%.


#347

Thank you that was the issue. I had initially right clicked the files and saved them to the directory but saving as raw worked!


#348

Released 2.2.0

Low level communications module (i.e., custom_components/life360.py) moved to the official Python Package Index (PyPI.)

If you’ve already been using this custom component, after upgrading, you can remove custom_components/life360.py. If you haven’t used this custom component before, then installation is a bit simpler than before (since there is now only one file to install – specifically, custom_components/device_tracker/life360.py.)

@DrZzs, I had been planning to move the one file to PyPI for a while. If I had known you were creating that excellent video, I would have expedited the move. (I hadn’t ever published to PyPI before, so I had to get through those details.) :blush:

If anyone runs into any trouble using this new version (and indirectly the module from PyPI), by all means, let me know ASAP!


#349

Hi @pnbruckner thanks for the great work. I knew about your component in @DrZzs 's video.

Just a question, I followed his video before I found this thread, so I put life360.py also outside device_tracker folder. It seems everything is working, but should I remove that file and keep just the “device_tracker” one? Many thanks!


#350

HI @pnbruckner - thanks for the work and dedication with this project!

I’ve just tried the new install - installed the life360 communications component from PyPI with a
sudo -H pip install "life360"
Then added the device_tracker section to my configuration.yaml file, but when I check the config in the web ui, I get " Configuration invalid Platform not found: device_tracker.life360" - my device tracker section looks like this:

device_tracker
  - platform: life360
    username: valid username
    password: valid password
    prefix: life360
    show_as_state: driving, moving, places
    driving_speed: 20
    max_gps_accuracy: 200
    max_update_wait:
      minutes: 30

Any ideas on what I might try?


#351

There used to be two different files named life360.py, one that went in custom_components, and the other went in custom_components/device_tracker. Now there’s only the one that goes in custom_components/device_tracker. You no longer need the one that went directly in custom_components, so you can delete it (although leaving it there won’t hurt anything.)


#352

You do not need to manually install the package from PyPI. Home Assistant will take care of that automatically. And, FWIW, as I understand it, you should never install with pip using sudo. You may want to run the same command (stop HomeAssistant first), the same way (i.e., with sudo), but change install to uninstall.

Next you need to install my life360.py custom platform (from my github repo) into your HA config folder (in additional folders inside the config folder that you will probably have to manually create, namely custom_components/device_tracker) per the instructions on my github page. Then when you start Home Assistant it should work. Although, I generally recommend using the Custom Updater custom component rather than manually installing my custom component. Once you get Custom Updater installed and working, you can use it to install my custom component. Again, see my github repo for instructions.


#353

I’m getting this error:

“get_circles: ReadTimeout: HTTPSConnectionPool(host=‘api.life360.com’, port=443): Read timed out. (read timeout=11.0)”

Any tip?


#354

Comm errors are not uncommon. If you get a zillion of them, and the device_trackers aren’t updating, then you might have a problem. Even when there are a lot of comm errors, usually it’s working just fine between the errors. If there are too many errors in a row, then you’ll see this: Suppressing further errors until OK: .... If you’re not seeing that, then it is working between the other errors.


#355

Hi, im using your component and its working very well but i have 2 thing I wonder. The post is so long that i don’t know if it was anwered already.

First, when i look at my tracker info, i see that the “address” is null even if it shows correctly on life360 app.
Second the data for “at loc since” and “last seen” on the tracker are not following my timezone, can we change that ? It shows as —> 2018-11-23T15:45:35+00:100:

Thank you in advance.


#356

Hi, i don’t know if this is mentioned already but other people in my circle don’t show up if there away from home ? there only showing up when there home otherwise the dissapear.

******* problem Dissapeared??? ******


#357

This is part Home Assistant’s generic device tracker behavior. Mainly it’s for device tracker implementations that can only show “home” and “not home” like various wifi device trackers. You’ll need to edit your known_devices.yaml file to change that.


#358

Thanks Phil, I’ve uninstalled the life360 comms component per your instruction - I already had (but neglected to mention that in my previous post) the life360.ph within the custom_components/device_tracker directory in place.

I am still getting the “Configuration invalid, Platform not found: device_tracker.life360” message when I check the config in the HA UI.


#359

Trying to install this and following the instructions in the post #333 above by @stratplayer.

I’ve installed the custom_updater.py in the custom_components directory, added the config for custom_updater per phil’s github repo, restarted HA and the custom_updater.install service is then available in the drop down.

Then I run that service with service data = {“element”:“life360”} then run the same with {“element”:“device_tracker.life360”}

I get the following errors in the log:

2018-11-25 15:41:58 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall custom_updater.install (c:f51af2dc5e404ce6b2a1a481a5c03d1e): element=life360>
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/core.py", line 1185, in _event_to_service_call
    await self._hass.async_add_executor_job(execute_service)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/core.py", line 1182, in execute_service
    service_handler.func(service_call)
  File "/config/custom_components/custom_updater.py", line 104, in install_service
    card_controller.install(element)
NameError: free variable 'card_controller' referenced before assignment in enclosing scope
2018-11-25 15:42:23 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall custom_updater.install (c:32a496bdb58f4b588c12bf82fe6e25dc): element=device_tracker.life360>
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/core.py", line 1185, in _event_to_service_call
    await self._hass.async_add_executor_job(execute_service)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/core.py", line 1182, in execute_service
    service_handler.func(service_call)
  File "/config/custom_components/custom_updater.py", line 104, in install_service
    card_controller.install(element)
NameError: free variable 'card_controller' referenced before assignment in enclosing scope

What am I missing?


#360

First, those instructions are old (believe it or not! :slight_smile:) The first “element” (life360) does not need to be installed manually/directly. You just need to install element device_tracker.life360. The other part should be installed automatically from the PyPI by HA when you restart (or I think the custom updater will do install it prior to restarting HA. Either way you shouldn’t have to.)

Next, that error is an issue with the custom updater. You should go to its issues page for help with that.


#361

Unfortunately it can only show what the Life360 server provides. If address is null it’s because the server isn’t providing an address.

Like most components in HA, datetimes are shown in UTC. But, as long as they are timezone “aware” datetimes, it really shouldn’t matter which timezone they are shown in. I suppose I could add an optional feature to show datetimes in the local timezone. See issue #69.