Page 5 of 9
Re: Python Plugin: Life 360 Presence Detection
Posted: Saturday 06 October 2018 22:28
by heggink
I haven't found the time yet but it's on the list. That said, the responsiveness may be annoying but the plugins don"t really crash.
Re: Python Plugin: Life 360 Presence Detection
Posted: Sunday 21 October 2018 19:57
by jordantheripper
aldodemi wrote: ↑Monday 01 October 2018 23:16
With current version if I put my Google Maps API Key I receive this error:
2018-10-01 23:13:34.355 Error: (Life360) 'onHeartbeat' failed 'UnboundLocalError':'local variable 'jsonr' referenced before assignment'.
2018-10-01 23:13:34.356 Error: (Life360) ----> Line 254 in '/home/domoticz/domoticz/plugins/life360/plugin.py', function onHeartbeat
2018-10-01 23:13:34.356 Error: (Life360) ----> Line 199 in '/home/domoticz/domoticz/plugins/life360/plugin.py', function onHeartbeat
2018-10-01 23:13:34.356 Error: (Life360) ----> Line 58 in '/home/domoticz/domoticz/plugins/life360/googlemapsapi.py', function getdistance
2018-10-01 23:13:34.356 Error: (Life360) ----> Line 43 in '/home/domoticz/domoticz/plugins/life360/googlemapsapi.py', function make_request
without API key no errors but also no locations info.
The API key is correct.
Any help well accepted
Hello people.
First of all thanks for your great work.
me too have the same problem.
May be there is some solution?
thanks from Italy
Re: Python Plugin: Life 360 Presence Detection
Posted: Monday 22 October 2018 9:33
by febalci
aldodemi wrote: ↑Monday 01 October 2018 23:16
With current version if I put my Google Maps API Key I receive this error:
2018-10-01 23:13:34.355 Error: (Life360) 'onHeartbeat' failed 'UnboundLocalError':'local variable 'jsonr' referenced before assignment'.
2018-10-01 23:13:34.356 Error: (Life360) ----> Line 254 in '/home/domoticz/domoticz/plugins/life360/plugin.py', function onHeartbeat
2018-10-01 23:13:34.356 Error: (Life360) ----> Line 199 in '/home/domoticz/domoticz/plugins/life360/plugin.py', function onHeartbeat
2018-10-01 23:13:34.356 Error: (Life360) ----> Line 58 in '/home/domoticz/domoticz/plugins/life360/googlemapsapi.py', function getdistance
2018-10-01 23:13:34.356 Error: (Life360) ----> Line 43 in '/home/domoticz/domoticz/plugins/life360/googlemapsapi.py', function make_request
without API key no errors but also no locations info.
The API key is correct.
Any help well accepted
Looks like there is a problem with getting the distance. I tried to add all possible errors that might occur during this api call but it looks like i missed handling some api error. Would you please make Debug as True and find the line that says 'URL: http://..." just before the error occuring. Entering that address directly to chrome or firefox address line might give us the reason of the problem.
It is highly possible that because of the google maps api is now pay per call, it might be giving the "monthly free api calls expired, please enter a credit card number" like something...
Re: Python Plugin: Life 360 Presence Detection
Posted: Monday 22 October 2018 10:05
by heggink
Hi @febalci,
If I can make a suggestion, instead of combining this functionality into 1 plugin, split this out and let people handle it themselves? You have both the domoticz lat/long as well as the lat/long of the life360 devices so you can easily calculate distance (using the python vincenty libs which I already did adapting your plugin) or you could create a text device that stores lat/long so people can calculate whatever they want themselves (dzvents, lua, blockly, ..). Much easier to maintain IMHO.
Let me know if you want the vincenty calls.
H
Re: Python Plugin: Life 360 Presence Detection
Posted: Monday 22 October 2018 10:17
by febalci
heggink wrote: ↑Monday 22 October 2018 10:05
Hi @febalci,
If I can make a suggestion, instead of combining this functionality into 1 plugin, split this out and let people handle it themselves? You have both the domoticz lat/long as well as the lat/long of the life360 devices so you can easily calculate distance (using the python vincenty libs which I already did adapting your plugin) or you could create a text device that stores lat/long so people can calculate whatever they want themselves (dzvents, lua, blockly, ..). Much easier to maintain IMHO.
Let me know if you want the vincenty calls.
H
Dear @heggink, thank you very much for the suggestion. Actually it is a very good idea...
The calculation of distance between two points geographically is not a big problem. However my intent was to find the distance and time according to traffic on road, not geographically. Thats why i insist on using google maps api. But as you suggested, splitting out the plugin might be a good solution or using an alternative to google maps api, if i can find any time to do it
Re: Python Plugin: Life 360 Presence Detection
Posted: Monday 22 October 2018 10:26
by heggink
That was the idea: rather than trying to deal with multiple different systems, split functionality.
Re: Python Plugin: Life 360 Presence Detection
Posted: Friday 04 January 2019 14:32
by grumpazoid
l00pz wrote: ↑Tuesday 05 June 2018 20:32
I'm really happy with this Plug-in as its way more stable then the Geofencing from the Domoticz App or Domofence
But is it possible to increase the poll period to something lower then 60 seconds? I don't want to make the Life360 Circle to big, but when I make the Circle like 500M the time from opening the door and the time that Domoticz Updates the Life360 plug-in sometimes gives me false alarms. Making the Circle bigger is one solution of course, but if it's possible the lower the poll period to like 30 seconds that would be great.
At the moment my default update time (from pihole logs) seems to be 130 seconds. How do I lower it please?
EDIT: Ok having looked at the code I relize this can be lowered from within Domoticz.
Another question then: Distance always shows 0 minutes. Is this because I am not using the Google API?
Re: Python Plugin: Life 360 Presence Detection
Posted: Friday 04 January 2019 16:02
by febalci
grumpazoid wrote: ↑Friday 04 January 2019 14:32
At the moment my default update time (from pihole logs) seems to be 130 seconds. How do I lower it please?
EDIT: Ok having looked at the code I relize this can be lowered from within Domoticz.
Another question then: Distance always shows 0 minutes. Is this because I am not using the Google API?
Have you tried poll period=1 for checking every 60 secs? Lowering than 60 sec might keep domoticz and life360 api very busy and might have spme problems.
As for distance 0 min is definitely google maps api issue. I gave up using this plugin, so sorry but no support from me anymore. But you can make the necessary changes in the code anytime you like. Also there was an open street maps version in the pull requests part.
Re: Python Plugin: Life 360 Presence Detection
Posted: Saturday 05 January 2019 17:14
by grumpazoid
febalci wrote: ↑Friday 04 January 2019 16:02
Have you tried poll period=1 for checking every 60 secs? Lowering than 60 sec might keep domoticz and life360 api very busy and might have spme problems.
As for distance 0 min is definitely google maps api issue. I gave up using this plugin, so sorry but no support from me anymore. But you can make the necessary changes in the code anytime you like. Also there was an open street maps version in the pull requests part.
Thanks for the reply and your good work on this project.
1 minute poll has sorted it.
I'll try and find out if the open street maps part is working.
Re: Python Plugin: Life 360 Presence Detection
Posted: Wednesday 16 January 2019 8:10
by aldodemi
febalci wrote: ↑Monday 22 October 2018 9:33
aldodemi wrote: ↑Monday 01 October 2018 23:16
With current version if I put my Google Maps API Key I receive this error:
2018-10-01 23:13:34.355 Error: (Life360) 'onHeartbeat' failed 'UnboundLocalError':'local variable 'jsonr' referenced before assignment'.
2018-10-01 23:13:34.356 Error: (Life360) ----> Line 254 in '/home/domoticz/domoticz/plugins/life360/plugin.py', function onHeartbeat
2018-10-01 23:13:34.356 Error: (Life360) ----> Line 199 in '/home/domoticz/domoticz/plugins/life360/plugin.py', function onHeartbeat
2018-10-01 23:13:34.356 Error: (Life360) ----> Line 58 in '/home/domoticz/domoticz/plugins/life360/googlemapsapi.py', function getdistance
2018-10-01 23:13:34.356 Error: (Life360) ----> Line 43 in '/home/domoticz/domoticz/plugins/life360/googlemapsapi.py', function make_request
without API key no errors but also no locations info.
The API key is correct.
Any help well accepted
Looks like there is a problem with getting the distance. I tried to add all possible errors that might occur during this api call but it looks like i missed handling some api error. Would you please make Debug as True and find the line that says 'URL: http://..." just before the error occuring. Entering that address directly to chrome or firefox address line might give us the reason of the problem.
It is highly possible that because of the google maps api is now pay per call, it might be giving the "monthly free api calls expired, please enter a credit card number" like something...
Here the log after adding the maps api keys and enabling debug:
2019-01-16 08:08:59.246 Error: (Life360) 'onHeartbeat' failed 'UnboundLocalError':'local variable 'jsonr' referenced before assignment'.
2019-01-16 08:08:59.246 Error: (Life360) ----> Line 254 in '/home/domoticz/domoticz/plugins/life360/plugin.py', function onHeartbeat
2019-01-16 08:08:59.246 Error: (Life360) ----> Line 199 in '/home/domoticz/domoticz/plugins/life360/plugin.py', function onHeartbeat
2019-01-16 08:08:59.246 Error: (Life360) ----> Line 58 in '/home/domoticz/domoticz/plugins/life360/googlemapsapi.py', function getdistance
2019-01-16 08:08:59.246 Error: (Life360) ----> Line 43 in '/home/domoticz/domoticz/plugins/life360/googlemapsapi.py', function make_request
2019-01-16 08:09:10.657 Error: (Life360) 'onHeartbeat' failed 'UnboundLocalError':'local variable 'jsonr' referenced before assignment'.
2019-01-16 08:09:10.657 Error: (Life360) ----> Line 254 in '/home/domoticz/domoticz/plugins/life360/plugin.py', function onHeartbeat
2019-01-16 08:09:10.657 Error: (Life360) ----> Line 199 in '/home/domoticz/domoticz/plugins/life360/plugin.py', function onHeartbeat
2019-01-16 08:09:10.657 Error: (Life360) ----> Line 58 in '/home/domoticz/domoticz/plugins/life360/googlemapsapi.py', function getdistance
2019-01-16 08:09:10.657 Error: (Life360) ----> Line 43 in '/home/domoticz/domoticz/plugins/life360/googlemapsapi.py', function make_request
Thanks
Aldo
Re: Python Plugin: Life 360 Presence Detection
Posted: Wednesday 16 January 2019 10:38
by g00fy
grumpazoid wrote: ↑Saturday 05 January 2019 17:14
I'll try and find out if the open street maps part is working.
It is working for me a long time already with version 1.1.0. Febalci asked me before to rewrite it for version 2.0.0 of his plugin, but unfortunately I did never find the time for it yet. Would like to hear it if it is working for version 2.0.0 also
.
Edit 16-1-2019 14:07: Finally made some time to make the changes. All seem to work well (I use it myself right now), but I did not did very much testing.
Re: Python Plugin: Life 360 Presence Detection
Posted: Wednesday 16 January 2019 21:01
by capman
I have also error messages in my log. The version is with open street map.
- Spoiler: show
- 2019-01-16 19:24:05.630 Error: (Life 360) 'onHeartbeat' failed 'timeout'.
2019-01-16 19:24:05.630 Error: (Life 360) ----> Line 271 in '/home/domoticz/plugins/Domoticz-Life360-Plugin-master/plugin.py', function onHeartbeat
2019-01-16 19:24:05.630 Error: (Life 360) ----> Line 170 in '/home/domoticz/plugins/Domoticz-Life360-Plugin-master/plugin.py', function onHeartbeat
2019-01-16 19:24:05.630 Error: (Life 360) ----> Line 73 in '/home/domoticz/plugins/Domoticz-Life360-Plugin-master/life360.py', function get_circle
2019-01-16 19:24:05.630 Error: (Life 360) ----> Line 38 in '/home/domoticz/plugins/Domoticz-Life360-Plugin-master/life360.py', function make_request
2019-01-16 19:24:05.630 Error: (Life 360) ----> Line 163 in '/usr/lib/python3.5/urllib/request.py', function urlopen
2019-01-16 19:24:05.630 Error: (Life 360) ----> Line 466 in '/usr/lib/python3.5/urllib/request.py', function open
2019-01-16 19:24:05.630 Error: (Life 360) ----> Line 484 in '/usr/lib/python3.5/urllib/request.py', function _open
2019-01-16 19:24:05.631 Error: (Life 360) ----> Line 444 in '/usr/lib/python3.5/urllib/request.py', function _call_chain
2019-01-16 19:24:05.631 Error: (Life 360) ----> Line 1297 in '/usr/lib/python3.5/urllib/request.py', function https_open
2019-01-16 19:24:05.631 Error: (Life 360) ----> Line 1260 in '/usr/lib/python3.5/urllib/request.py', function do_open
2019-01-16 19:24:05.631 Error: (Life 360) ----> Line 1215 in '/usr/lib/python3.5/http/client.py', function getresponse
2019-01-16 19:24:05.631 Error: (Life 360) ----> Line 297 in '/usr/lib/python3.5/http/client.py', function begin
2019-01-16 19:24:05.631 Error: (Life 360) ----> Line 258 in '/usr/lib/python3.5/http/client.py', function _read_status
2019-01-16 19:24:05.631 Error: (Life 360) ----> Line 579 in '/usr/lib/python3.5/socket.py', function readinto
2019-01-16 19:24:05.631 Error: (Life 360) ----> Line 937 in '/usr/lib/python3.5/ssl.py', function recv_into
2019-01-16 19:24:05.631 Error: (Life 360) ----> Line 807 in '/usr/lib/python3.5/ssl.py', function read
2019-01-16 19:24:05.631 Error: (Life 360) ----> Line 583 in '/usr/lib/python3.5/ssl.py', function read
2019-01-16 19:57:00.603 Error: (Life 360) 'onHeartbeat' failed 'timeout'.
2019-01-16 19:57:00.603 Error: (Life 360) ----> Line 271 in '/home/domoticz/plugins/Domoticz-Life360-Plugin-master/plugin.py', function onHeartbeat
2019-01-16 19:57:00.603 Error: (Life 360) ----> Line 167 in '/home/domoticz/plugins/Domoticz-Life360-Plugin-master/plugin.py', function onHeartbeat
2019-01-16 19:57:00.603 Error: (Life 360) ----> Line 51 in '/home/domoticz/plugins/Domoticz-Life360-Plugin-master/life360.py', function authenticate
2019-01-16 19:57:00.603 Error: (Life 360) ----> Line 38 in '/home/domoticz/plugins/Domoticz-Life360-Plugin-master/life360.py', function make_request
2019-01-16 19:57:00.603 Error: (Life 360) ----> Line 163 in '/usr/lib/python3.5/urllib/request.py', function urlopen
2019-01-16 19:57:00.603 Error: (Life 360) ----> Line 466 in '/usr/lib/python3.5/urllib/request.py', function open
2019-01-16 19:57:00.603 Error: (Life 360) ----> Line 484 in '/usr/lib/python3.5/urllib/request.py', function _open
2019-01-16 19:57:00.603 Error: (Life 360) ----> Line 444 in '/usr/lib/python3.5/urllib/request.py', function _call_chain
2019-01-16 19:57:00.603 Error: (Life 360) ----> Line 1297 in '/usr/lib/python3.5/urllib/request.py', function https_open
2019-01-16 19:57:00.604 Error: (Life 360) ----> Line 1260 in '/usr/lib/python3.5/urllib/request.py', function do_open
2019-01-16 19:57:00.604 Error: (Life 360) ----> Line 1215 in '/usr/lib/python3.5/http/client.py', function getresponse
2019-01-16 19:57:00.604 Error: (Life 360) ----> Line 297 in '/usr/lib/python3.5/http/client.py', function begin
2019-01-16 19:57:00.604 Error: (Life 360) ----> Line 258 in '/usr/lib/python3.5/http/client.py', function _read_status
2019-01-16 19:57:00.604 Error: (Life 360) ----> Line 579 in '/usr/lib/python3.5/socket.py', function readinto
2019-01-16 19:57:00.604 Error: (Life 360) ----> Line 937 in '/usr/lib/python3.5/ssl.py', function recv_into
2019-01-16 19:57:00.604 Error: (Life 360) ----> Line 807 in '/usr/lib/python3.5/ssl.py', function read
2019-01-16 19:57:00.604 Error: (Life 360) ----> Line 583 in '/usr/lib/python3.5/ssl.py', function read
Re: Python Plugin: Life 360 Presence Detection
Posted: Wednesday 16 January 2019 22:01
by febalci
Working on fixes and OSM version; Please bear with me for 1-2 days...
Re: Python Plugin: Life 360 Presence Detection
Posted: Thursday 17 January 2019 13:41
by febalci
v.2.1.0
Incorporated Emile Spaanbroek's OpenStreet Maps API alternative. Now you can select either OSM or Google maps API. Please note that OSM doesnot have distance in mins info. Tried to use router.project-osrm.org for that purpose but the demo server is much too picky for consecutive calls. Maybe next time...
Ther might still be a lot of bugs; please inform me accordingly. For those who have UnboundLocalError':'local variable 'jsonr' referenced before assignment error with this new version; i need to know the last 2 lines on debug logs before this error line. It generally happens when there is an http error on google maps or OSM api.
Re: Python Plugin: Life 360 Presence Detection
Posted: Friday 18 January 2019 16:51
by febalci
Dear Friends;
As i have been looking for some stable alternative to Google Maps API, I've stumbled upon TomTom Maps API
https://developer.tomtom.com/. It gives 2.500 transactions daily for free and honestly the best and most professional API I come so far. It also includes driving times according to traffic which we lost during the pass to OpenStreet Maps. So, my intention now is to get rid of Google Maps completely and use TomTom and OpenStreet Maps selectively. As i still don't know if any of you guys still use Google Maps, I was wondering to keep Google Maps besides the other two for selection or completely take it out of the plugin? Waiting for your comments...
Re: Python Plugin: Life 360 Presence Detection
Posted: Saturday 19 January 2019 11:19
by grumpazoid
@febalci
Thanks for your hard work. I have just installed V 2.1.0.
I have selected the new openstreetmap option in Hardware. We are all Home at the moment, so will maybe see a difference when somebody goes out?
The Tom Tom API sounds interesting. Would be good to have some extra information.
edit: Its working well...I am getting a location displayed including postcode...and that is getting logged. Awesome.
Re: Python Plugin: Life 360 Presence Detection
Posted: Sunday 20 January 2019 14:01
by febalci
v2.2.0 is out...
#New:Added TomTom Maps API Selection
#Fixed: Removed Google Maps API
TomTom gives away 2.500 fro free API calls per day. For calculating your API call needs:
Every Life360 member needs 2 API calls per time (1 for current address, 1 for getting traffic distance in minutes) every Poll Period time. So suppose you have 3 family members besides you; a total of 4 members. Your Poll Period is 5 minutes. Every 5 minutes, the plugin will make 2x4=8 API calls that makes 8x12=96 API calls per hour. For 24 hrs in the day, that will make 24x96=2.304 API calls, which is under the free 2.500 and that means there are no restrictions. When calculating your API call needs, please note that when you are at Life360
'Home' tag, there are no API calls made; so you can deduct those hours from the calculation. So, if you are at home about 10 hrs every day; instead of 24x96=2.304, you will have 14x96=1.344 API calls...
How to get a TomTom API Key:
Go to
https://developer.tomtom.com/user/register page. Create a new User Account. Login to your account and from 'My Apps', press 'Add a new app' to add a new app and select at least 'Routing API' and 'Search API', you can select all APIs here if you want. Then from the 'Keys' page, copy the 'Consumer API Key' of your app to Life360 plugin setting page - 'TomTom API Key' field. Remember, you have 2.500 daily API calls limit fro free... When you are at 'Home', there are no API calls to TomTom.
Re: Python Plugin: Life 360 Presence Detection
Posted: Sunday 20 January 2019 14:31
by capman
Great !! Working like charm ! Now I have location and distance.
Thanks 4 this great plugin !!!
Re: Python Plugin: Life 360 Presence Detection
Posted: Monday 21 January 2019 11:35
by capman
Still the same error in my log.
viewtopic.php?f=65&t=20392&p=204237&hil ... 60#p203831
Probably a python issue
Re: Python Plugin: Life 360 Presence Detection
Posted: Monday 21 January 2019 11:58
by febalci
I highly doubt it is a python issue, think there might be a problem with your life360 connection. If you can send me your Debug:True log , i can have a look. Getting Life360 token might have an issue.