Python Plugin: Life 360 Presence Detection (deprecated)

Python and python framework

Moderator: leecollings

Post Reply
febalci
Posts: 331
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Python Plugin: Life 360 Presence Detection (deprecated)

Post by febalci »

UPDATE: 20.02.2024

!!!DEPRECATED!!!

Use the plugin GPSLogger as an alternative https://www.domoticz.com/forum/viewtopi ... 65&t=42045

UPDATE: V2.3.1 - 22.02.2019
Fix: Error in Tomtom Api response
New Feature: Added a locations.txt file to name your frequent use locations according to the lat,lon and radius.

Hi All,

As i have been using Life360 geofence presence detection for some time; i find it pretty stable. For those of you don't know about Life360; it is a smartphone application to follow the whereabouts about your friends, family, kids etc. It has its own notification system, and whenever a family members goes home or work etc. it can notify you from your smartphone without any delay. You can also see on map about where your circle members are or have been at a given time.

Image

The API of Life360 is not open, but with the help of other codes i found on the web, you can get simple jsons.

So, the steps are as follows:
1. Install Life360 on your smartphone (Together with the family members)
2. Create a Circle in Life360 and add your family members to this circle, and make sure this circle is the very first circle in the list (Everyone in the circle can see where you are from now on!...)
3. Mark your Domoticz installation site as 'Home' (This is important since the plugin presence depends on if you are iin the geofence of marked location 'Home')
4. Donwload the plugin below and copy plugin.py and life360.py to 'Life360' folder in your plugins folder.
5. Restart Domoticz
6. Select 'Life 360 Presence' in your plugins list and fill in Life360 username and password, as well as 'Poll Period'. Make sure the poll period is not lower than 60 secs.
7. For each member you have 3 devices: Presence, Location and Smartphone battery percentage.
8. In order to get Locations, you have to name special places in Life360, like work, school etc.

And that's it, hope you will like it. Please do not hesitate to ask your questions or problems here...
Life 360 Plugin: https://github.com/febalci/DomoticzLife360
Last edited by febalci on Tuesday 26 February 2019 9:13, edited 7 times in total.
febalci
Posts: 331
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by febalci »

Handled the "Error: hardware thread seems to have ended unexpectedly" messages thanks to @Dnpwwo. Poll period is now in minutes instead of seconds and the minimum poll period is 1 min. Now planning to add reverse geocoding from Google maps so that the Location device will show current address instead of Life360 predefined locations.
msvds
Posts: 5
Joined: Sunday 08 October 2017 12:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by msvds »

Thanks for the work on this, it works really great. I use Life360 for some years now and with your plugin it is very easy to get it working in Domoticz. Great job! So far the best presence detection I've tested.
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by EdwinK »

When i installed the plugin and restarted Domoticz, I couldn't connect to domoticz anymore, just had to remove the plugin :(
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by Derik »

can i use the free version of 360?
And is ther perhaps a option to use the mapspage in a personal Domoticz page??
So whe can see where the Kids are?

And a great Plugin dear!!!

Cannot test because i have a lot work @ home
Only when i have time...:-)
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
febalci
Posts: 331
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by febalci »

EdwinK wrote: Tuesday 21 November 2017 22:55 When i installed the plugin and restarted Domoticz, I couldn't connect to domoticz anymore, just had to remove the plugin :(
I believe you copied both files life360.py and plugin.py to plugins/life360. Maybe you can send me the Domoticz Logfile after a failed domoticz start? Do you have any other installed-working python plugins?
febalci
Posts: 331
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by febalci »

Derik wrote: Wednesday 22 November 2017 7:23 can i use the free version of 360?
And is ther perhaps a option to use the mapspage in a personal Domoticz page??
So whe can see where the Kids are?

And a great Plugin dear!!!

Cannot test because i have a lot work @ home
Only when i have time...:-)
Dear Derik, i also use the free version of life360, so basically Yes, you can...
About the mapspage, my first target is to fix location device, so that it can show not only the saved places of lifee360, but also the reverse geocoding for current addresses (By using google maps or foursquare). For the custom map page, actually it's a great idea. I will try my best.
febalci
Posts: 331
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by febalci »

EdwinK wrote: Tuesday 21 November 2017 22:57 I got the following:
2017-11-21 22:53:50.833 Error: (Life360) failed to load 'plugin.py', Python Path used was ':/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
Same happend with Buienrader plugin from G3rard.
Edwin, do you have something like this error in the beginning of your logfile?

Code: Select all

PluginSystem: Failed dynamic library load, install the latest libpython3.x library that is available for your platform.
If you already have any working python plugin at the moment, than it's a fault on my code side, otherwise there's something wrong on your python or domoticz installation. If you also have a problem with the Buienradar, maybe it is possible that you do not have python plugins enabled on you Domoticz Beta? And also i believe you already have life360 account and set your username etc. Also, in the error of your Python path, there's no "/domoticz/var/plugins/life360" folder, that sounds like plugin support in your installation is flawed?
febalci
Posts: 331
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by febalci »

Added new icons for presence and reverse geocoding to reflect the current address of a member if the location is not marked down in Life360. So you can also check the log of the Location device :D
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by EdwinK »

febalci wrote: Wednesday 22 November 2017 8:13
Edwin, do you have something like this error in the beginning of your logfile?

Code: Select all

PluginSystem: Failed dynamic library load, install the latest libpython3.x library that is available for your platform.
If you already have any working python plugin at the moment, than it's a fault on my code side, otherwise there's something wrong on your python or domoticz installation. If you also have a problem with the Buienradar, maybe it is possible that you do not have python plugins enabled on you Domoticz Beta? And also i believe you already have life360 account and set your username etc. Also, in the error of your Python path, there's no "/domoticz/var/plugins/life360" folder, that sounds like plugin support in your installation is flawed?

I can't check it at the moment. The second I activate one of the mentioned scripts, Domoticz stops working and will not continue before removing the plugins again.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by EdwinK »

Code: Select all

2017-11-23 18:05:20.211 PluginSystem: Started, Python version '3.5.3'.
2017-11-23 18:05:22.621 Python EventSystem: Initalizing event module.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by EdwinK »

Giving up for now.
Error message AFTER activating python scripts
Error message AFTER activating python scripts
Screen Shot 2017-11-23 at 18.25.39.png (52.01 KiB) Viewed 10202 times
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
GCB2016
Posts: 33
Joined: Thursday 10 November 2016 22:13
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.9208
Location: Rotterdam
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by GCB2016 »

Hi Febalci,

I have a circle called Family with my wife. I just installed the plugin and can see the different 'devices'. However there is a couple of weird things:
  • I can not see my wife's Presence (but I do see her battery & location) There is no Presence under Switches for her (however mine is there)
  • The battery percentages are not working. Mine says 0%, but it is e.g. 10%
I also attached a screenshot. Any idea what's wrong?

Thanks a lot!
Attachments
Screen Shot 2017-11-28 at 21.51.10.png
Screen Shot 2017-11-28 at 21.51.10.png (241.01 KiB) Viewed 10111 times
febalci
Posts: 331
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by febalci »

GCB2016 wrote: Tuesday 28 November 2017 21:55 Hi Febalci,

I have a circle called Family with my wife. I just installed the plugin and can see the different 'devices'. However there is a couple of weird things:
  • I can not see my wife's Presence (but I do see her battery & location) There is no Presence under Switches for her (however mine is there)
  • The battery percentages are not working. Mine says 0%, but it is e.g. 10%
I also attached a screenshot. Any idea what's wrong?

Thanks a lot!
Hi GCB,
First of all are you using Version 1.0.3? You can check it from the plugin.py's first line:

Code: Select all

<plugin key="Life360" name="Life 360 Presence" author="febalci" version="1.0.3">
If it is an older version, you should download the new one, delete the old one from Domoticz/Setup/Hardware, restart Domoticz, and add the plugin from Hardware page again.

If it is the latest version, please delete the plugin from Domoticz/Setup/Hardware again, While adding please select "True" for "Debug" and let it run for about 4-5 minutes. Then please sned me the Domoticz.log file so i can see what's wrong and correct it. In my case everything works fine.
GCB2016
Posts: 33
Joined: Thursday 10 November 2016 22:13
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.9208
Location: Rotterdam
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by GCB2016 »

Thanks for your reply,

I downloaded it yesterday from your Git and I checked: it is 1.0.3 for sure.

I deleted the hardware and re-added it again with debug on TRUE. I am at work and unable to SSH the RaspberryPi remotely but I copied some text from the Domoticz Log (I can reach Domoticz remotely). Also I have hidden some info from the log. I am sorry for the Word-doc, for some reason I am can't upload a plain text file.

What I find strange is when it comes to Marcella Battery is just says:
  • 2017-11-29 09:35:01.207 (Life360) Update 88:'88' (Life360 - Marcella Battery)
But for my device it says:
  • 2017-11-29 09:35:01.187 (Life360 - Carlo Battery) Updating device from 94:'94' to have values 1:'On'.
  • 2017-11-29 09:35:01.197 (Life360) Update 1:'On' (Life360 - Carlo Battery)
Is this helpful?
Attachments
log.docx
(9.47 KiB) Downloaded 155 times
febalci
Posts: 331
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by febalci »

OK, think i got the problem, will inform you.
febalci
Posts: 331
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by febalci »

GCB2016 wrote: Wednesday 29 November 2017 9:52 I downloaded it yesterday from your Git and I checked: it is 1.0.3 for sure.
A very stupid mathematical error, calculated according to my family count :oops: . Corrected on 1.0.4 and already on github. Could you please use the new 1.0.4 plugin.py? And yeah, you have to remove and add again from the Setup/Hardware. And could you please inform me if this works?
GCB2016
Posts: 33
Joined: Thursday 10 November 2016 22:13
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.9208
Location: Rotterdam
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by GCB2016 »

Haha no problem, will let you know tonight when I am back home. Thanks!
GCB2016
Posts: 33
Joined: Thursday 10 November 2016 22:13
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.9208
Location: Rotterdam
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by GCB2016 »

Hi Febalci, I just checked everything and it seems to be working properly with 1.0.4! Thanks a lot for your quick response.
febalci
Posts: 331
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by febalci »

Glad that it is sorted out Carlo, the other solution was to have a baby so to make your family 3 person, why the hell i tought every family is of 3? :lol:
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest