Author Topic: Integration: Life360 Presence  (Read 418 times)

Offline jeubanks

  • Beta Testers
  • Full Member
  • *****
  • Posts: 224
  • Karma: +11/-4
Integration: Life360 Presence
« on: March 12, 2018, 12:45:27 am »
I have put together the pieces I use for Life360 presence detection and put them into my git repo.  This can be ran on either a raspberry pi, or VM or any box that can run python 3.  I'm currently using Virtual Switches.  However this may change to Virtual Sensors in the future.

https://github.com/jeubanks/vera-life360

Requirements:
 - Python3
 - Life360 user account
 - People setup in Life360
 - "Home" Geofence location defined in Life360

Setup:
Line 54: Life360 Username/email/phone number
Line 55: Life360 password
By default the Vera virtual switch name is the first name of the Life360 user.

Example:
Vera Vswitch: John
Life360 user: John

If they match everything works.  If they don't match an if/else needs to be put into place.
If have this in my setup, but I didn't know if others would need it.  If wanted open
and issue and I'll include by default

Uncoment lines 30 - 35 for basic debugging or to get your device names if unsure

Usage:
1. Install Virtual Switch plugin for Vera.  Availabe in the app store
2. Create a virtual switch for each Life360 user you want to check
3. Home geofence location MUST be setup
4. Run script from a system with Python3.  I recommend setting up a cronjob or similar

Offline ruster34

  • Sr. Newbie
  • *
  • Posts: 27
  • Karma: +0/-0
Re: Integration: Life360 Presence
« Reply #1 on: October 24, 2018, 02:44:08 pm »
#1 - THANK YOU so much for your work on development and sharing.

I have been using life360 for a while and am trying to leverage it for geofence on my VeraPlus unit. However, I'm not getting great results yet and likely due to my installation. python is completely unknown to me, but I installed it on a windows box, edited the vera-presence file to include my local IP and life login info. I run the vera-presence file and it seems that only the first person leaving launches the action to disable the virtual switch.

I have 4 family members, all with corresponding VSwitches that match name exactly (John for John, in your example). I was using tasker+phone+life360+PLEG to automate everything. I assume your python script is just turning off the VSwitches, but if it's also pushing other actions, perhaps it and PLEG are tripping over each other.

Any ideas?!
Thanks again so much,
Ryan

Offline jeubanks

  • Beta Testers
  • Full Member
  • *****
  • Posts: 224
  • Karma: +11/-4
Re: Integration: Life360 Presence
« Reply #2 on: October 24, 2018, 03:07:05 pm »
#1 - THANK YOU so much for your work on development and sharing.

I have been using life360 for a while and am trying to leverage it for geofence on my VeraPlus unit. However, I'm not getting great results yet and likely due to my installation. python is completely unknown to me, but I installed it on a windows box, edited the vera-presence file to include my local IP and life login info. I run the vera-presence file and it seems that only the first person leaving launches the action to disable the virtual switch.

I have 4 family members, all with corresponding VSwitches that match name exactly (John for John, in your example). I was using tasker+phone+life360+PLEG to automate everything. I assume your python script is just turning off the VSwitches, but if it's also pushing other actions, perhaps it and PLEG are tripping over each other.

Any ideas?!
Thanks again so much,
Ryan

This has been a long while since I worked on this.

The Python script queries the information from Life360 and parses it and then call the Vera HTTP interface to "flip" a virtual switch on/off.  I have not worked on this script for a long time and I have moved my presence detection to a new GPS service that I'm launching soon.

Offline ruster34

  • Sr. Newbie
  • *
  • Posts: 27
  • Karma: +0/-0
Re: Integration: Life360 Presence
« Reply #3 on: October 24, 2018, 03:53:37 pm »
Sorry to hear you're leaving this project as it's a perfect fit for my scenario.

Running a windows box, do I need to have task scheduler launch the vera-presence script as frequent as possible? Sorry this is new territory to me and googling is only helping but so much at this point.

Offline jeubanks

  • Beta Testers
  • Full Member
  • *****
  • Posts: 224
  • Karma: +11/-4
Re: Integration: Life360 Presence
« Reply #4 on: October 24, 2018, 04:12:40 pm »
Sorry to hear you're leaving this project as it's a perfect fit for my scenario.

Running a windows box, do I need to have task scheduler launch the vera-presence script as frequent as possible? Sorry this is new territory to me and googling is only helping but so much at this point.

Yes if you are running on Windows something will need to launch the Python script at intervals to check Life360 for status.  On Linux I just used cron.

Life360 does not update very frequently so doing updates faster than 1 minute is of no value and with the inconsistency of update intervals for Life360 which varies on phone/device/OS/version and if the phone is "in motion" and factors on the phone that make that determination I have seen it take from 1 minute and up to HOURS before Life360 ever updated.