Python Plugin: Life 360 Presence Detection (deprecated)

Python and python framework

Moderator: leecollings

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 »

g00fy wrote: Friday 12 January 2018 9:32 How can I debug this (setting debugging on doesn't give more information in the domoticz log). I would be very pleased to be able to make use of this plugin.
Dear Emile,
I believe this 'Fatal Signal 11' error is unfortunately more of something related to Domoticz side, not the plugin itself. Please check: http://www.domoticz.com/forum/viewtopic ... 11#p165132 and https://github.com/domoticz/domoticz/issues/1891 As far as i know no solution is found yet. As i see you are using stable 3.8153, and what platform is it? Raspberry Pi? I am using the plugin on 3.8153 on Synology and Windows without problems. You can try without the google Key, leave that option empty and try again. So that we can maybe understand if it is a google api or life360 api based problem.

If the plugin is no-go and you still want to use Life360 presence, you can always use https://www.domoticz.com/forum/viewtopi ... 60#p144142 bash script of this plugin. It is missing Battery and Location options.
g00fy
Posts: 16
Joined: Friday 08 September 2017 8:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: Dordrecht, The Netherlands
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by g00fy »

Hey Febalci,

Thanks for your answer. Looking through some older posts I saw that this was more of a Domoticz problem indeed.
I was using the prebuild version for Raspberry Pi and found out that there are plenty of people with the same problem. Now I build the last development version myself and the plugin is running fine since yesterday evening.

So, thanks for making this very nice plugin and for leading me to the right answer why it was not working before.
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 »

Since I now can install all kind of Python plugins, I decided to try this again. At first it looked like it was going to work, could enter my credentials, but it couldn't create any devices, so I had to delete it completely :( I guess there still is something not working right on my install :(
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
Mace
Posts: 65
Joined: Monday 21 August 2017 19:52
Target OS: Windows
Domoticz version: 3.8153
Location: Rhoon
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by Mace »

@Edwin, happens to me to. Did a brand new install of Domoticz and this script still manages to kill it. Too bad, but I already pitched in for the Life 360 program...

Hope someone can shine a light on this.
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 »

Make sure the first created circle is called 'Home' and you and your family is in this circle (circle[0]). If you open debug option you will most probably catch the problem.
And are you sure your credentials are correct? (Username needs email adress, not username)
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 »

Yes... I am sure. When installed and after entering the details it gives something like 'problems retrieving devices' (can't remember the exact text'), and then Domoticz sort of crashes. All devices are gone and have to remove the plugin from the server is the only remedy to fix it.
Problems retrieving devices
Problems retrieving devices
Screen Shot 2018-01-20 at 23.31.14.png (24.31 KiB) Viewed 3498 times

@mace strange it's doing this for both of us. Maybe it doesn't like our beautiful city :(
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
Mace
Posts: 65
Joined: Monday 21 August 2017 19:52
Target OS: Windows
Domoticz version: 3.8153
Location: Rhoon
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by Mace »

@febalci: Exactly the same behavior at my installation as my near neighbour has...
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 had to freshly install my entire raspberry pi which means I have to reinstall Life360 plugin again. But I run into something weird and I am probably making a stupid mistake, but I have no idea what. The problem is that after restarting Domoticz the plugin is not in the Hardware list.

My Domoticz install = V3.8153.
Life360 plugin version = 1.0.4 from your github.
Running on RPi3.

I created a folder /home/pi/domoticz/plugins/life360 and copied all files inside with FileZilla. I confirmed the files in the Terminal (with nano) and they are all there.

Domoticz log says the following on Python:

Code: Select all

2018-01-26 14:49:23.903 PluginSystem: Failed dynamic library load, install the latest libpython3.x library that is available for your platform.
2018-01-26 14:49:25.996 EventSystem - Python: Failed dynamic library load, install the latest libpython3.x library that is available for your platform
But looking into /usr/lib/ I can see Python is installed. Confirmed it with both python -v and python3 -v.

I added a screenshot of the plugin.py file

Is this a known issue, or maybe you know what I am doing wrong?
Attachments
Screen Shot 2018-01-26 at 15.28.35.png
Screen Shot 2018-01-26 at 15.28.35.png (351.27 KiB) Viewed 3423 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: Friday 26 January 2018 15:29 Is this a known issue, or maybe you know what I am doing wrong?
If it is raspbian stretch, you have to install libssl1.0 from jessie for 3.8153, this is a known issue. You can search the forums for more detail. Otherwise plugin framework will not work.
Or install python3-dev.
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 »

You are my hero. After

Code: Select all

sudo apt-get install python3-dev
and restarting domoticz I finally see the plugin and everything works. Thanks a lot!
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 »

New update; Added Device for 'Driving Duration to Home from the current location'. Thanks for the suggestion @heggink ... You can find the details in the first post.
User avatar
heggink
Posts: 977
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by heggink »

Brill, thanks!
Now python framework instead of urllib.request please please, pretty please, cherry on top???
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
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 »

heggink wrote: Saturday 24 February 2018 13:56 Brill, thanks!
Now python framework instead of urllib.request please please, pretty please, cherry on top??? Image
Dear @heggink,

i did my best but it seems that the HTTP support in Plugin Framework is not mature enough to support https requests in which this plugin needs it for both life360 and google maps connections. Sorry...

I can confirm that the plugin works with Domoticz 3.8153 stable under linux and windows and Domoticz beta 3.8944 beta under Docker. Which version are you using, which OS and what error the plugin gives?
User avatar
heggink
Posts: 977
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: Python Plugin: Life 360 Presence Detection

Post by heggink »

I am on raspbian stretch beta ie the segfault crash with urllib.request.
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
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 »

I think raspbian stretch uses Python 3.5 by default which might be the culprit. Have you tried using Python 3.4 or Python 3.6 with pyenv default to these? I reccommend also to update to latest beta.
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 noticed in Pihole the life360 plugin is making 35000 api calls per day :o Multiple calls per second (!).

I am not sure on the impact on my network but is there any way to minimize the amount of calls?

Thanks!
Attachments
Screen Shot 2018-03-01 at 21.19.15.png
Screen Shot 2018-03-01 at 21.19.15.png (304.8 KiB) Viewed 3216 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: Thursday 01 March 2018 21:19 Hi Febalci,

I noticed in Pihole the life360 plugin is making 35000 api calls per day :o Multiple calls per second (!).

I am not sure on the impact on my network but is there any way to minimize the amount of calls?

Thanks!
Hi GCB,
That doesn't seem logical. The plugin makes 3 api calls every X minutes as you set in the parameters. I believe your 'Poll Period (min)' is set to a minimum of 2. If it is 2 minutes, than 30 calls to Domoticz plugin per hour x 3 life360 api calls x 24 hrs = should be 2160 life360 api calls per day. The plugin calls onHeartbeat of the plugin every 10 seconds. But it does not make a request to life360 api every 10 seconds, It simply multiplies Poll Period by 6 and counts every onHeartbeat. If it is 2 minutes, it counts up to 12 every heartbeat (12x10secs=120 secs) and then makes the api call.

I see you didn't disabled the IPv6; but since i have no knowledge on PiFace i am really not so sure if the calls are directly to life360 or the plugin itself. I have to check it with wireshark and will return to you..

UPDATE: Just checked on wireshark. 155 packets in 5 minutes. 105 packets are usual TCP ACK messages; and 50 packets are TLSv1.2 messages are like Send message and receive message. It looks like there's nothing out of ordinary (As much as i understand!). If you still want to decrease the messaging count you can increase the Poll Period. I have been using this for some months and did not had a side effect on my home network or internet connection. I have about ~35 IP clients at home network and the bandwidth of LAN and internet seems smooth.
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 quick response and diving into it. I think I know why it happens now. But I am still not sure if this is desired behaviour.

I know it's not particularly interesting for this thread, but I hate it when others don't post their 'solutions' or what they have found out ;)

After reading your reply I thought maybe it has nothing to do with the plugin, but with life360 in general. However I see all calls are coming from localhost (raspberry Pi) and not from our iPhones.

Other strange thing: the behaviour seems relatively new, see screenshot. Only after Feb 24th. Then I remembered (also because you asked about IPv6, thanks for that!) I had changed something in my network to speed things up. I followed instructions in this thread: https://discourse.pi-hole.net/t/some-we ... ow/1876/23

And especially the following instructions:

Code: Select all

I had the same experience, found this thread searching for a solution, and the above IPv6 address change appears to have resolved my issue too. (Note that /etc/setupVars.conf is actually /etc/pihole/setupVars.conf.)

So, my steps were:

SSH into the Pi Hole server
Run ifconfig to get the IPv6 address (global, not local)
sudo nano /etc/pihole/setupVars.conf
Change IPV6_ADDRESS to the address from step 2
Run pihole -g
Log into routers settings
Update the IPv6 DNS server to the new address
Restart the Pi Hole server
Restart the router
Joy
In addition, I’m using Apple’s latest AirPort/TimeCapsule, and my Pi 3 is wired to the back of it with Wi-Fi disabled, incase those details are helpful to anyone else.
I guess following these steps has caused the spike in how pihole measures the calls? Anyway, thanks again for diving into it!
Attachments
Screen Shot 2018-03-03 at 09.35.17.png
Screen Shot 2018-03-03 at 09.35.17.png (268.88 KiB) Viewed 3195 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 »

Hello GCB,
thanks for the detail. Just to make sure since you specifically mentioned Feb24th; that's the date which i commited the new version 1.1.0. Did you donwloaded and used the new version that day? Just to make sure if i am missing anything with the new version whether it's a problem with the plugin or your network settings. Also, using IPv6 as it seems doubled your network?
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 »

That's a coincidence :)

No I am still on 1.0.4. I did not update or install the newer version.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest