Python Plugin: Life 360 Presence Detection (deprecated)
Moderator: leecollings
- heggink
- Posts: 972
- 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
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.
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 :-)
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
-
- Posts: 6
- Joined: Sunday 17 December 2017 16:08
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.9208
- Location: Italy
- Contact:
Re: Python Plugin: Life 360 Presence Detection
Hello people.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
First of all thanks for your great work.
me too have the same problem.
May be there is some solution?
thanks from Italy
-
- Posts: 331
- Joined: Monday 03 July 2017 19:58
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Python Plugin: Life 360 Presence Detection
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.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
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...
- heggink
- Posts: 972
- 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
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
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
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 :-)
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
-
- Posts: 331
- Joined: Monday 03 July 2017 19:58
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Python Plugin: Life 360 Presence Detection
Dear @heggink, thank you very much for the suggestion. Actually it is a very good idea...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
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
- heggink
- Posts: 972
- 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
That was the idea: rather than trying to deal with multiple different systems, split functionality.
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 :-)
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
-
- Posts: 5
- Joined: Tuesday 20 November 2018 15:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.1
- Location: UK
- Contact:
Re: Python Plugin: Life 360 Presence Detection
At the moment my default update time (from pihole logs) seems to be 130 seconds. How do I lower it please?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.
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?
-
- Posts: 331
- Joined: Monday 03 July 2017 19:58
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Python Plugin: Life 360 Presence Detection
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.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?
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.
-
- Posts: 5
- Joined: Tuesday 20 November 2018 15:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.1
- Location: UK
- Contact:
Re: Python Plugin: Life 360 Presence Detection
Thanks for the reply and your good work on this project.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.
1 minute poll has sorted it.
I'll try and find out if the open street maps part is working.
-
- Posts: 25
- Joined: Tuesday 07 October 2014 17:43
- Target OS: Linux
- Domoticz version: 3.8275
- Location: Genoa Italy
- Contact:
Re: Python Plugin: Life 360 Presence Detection
Here the log after adding the maps api keys and enabling debug:febalci wrote: ↑Monday 22 October 2018 9:33Looks 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.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
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...
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
Server Domoticz 3.7243 (usually the last beta) on Debian Linux (Jessie) - Hw homemade with Atom CPU/4 GB RAM
RFXCom and ZWave Stick (Aeon)
RFXCom and ZWave Stick (Aeon)
-
- 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
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 .grumpazoid wrote: ↑Saturday 05 January 2019 17:14 I'll try and find out if the open street maps part is working.
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.
- capman
- Posts: 153
- Joined: Friday 12 July 2013 20:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Belgium
- Contact:
Re: Python Plugin: Life 360 Presence Detection
I have also error messages in my log. The version is with open street map.
- Spoiler: show
-
- Posts: 331
- Joined: Monday 03 July 2017 19:58
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Python Plugin: Life 360 Presence Detection
Working on fixes and OSM version; Please bear with me for 1-2 days...
-
- Posts: 331
- Joined: Monday 03 July 2017 19:58
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Python Plugin: Life 360 Presence Detection
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.
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.
-
- Posts: 331
- Joined: Monday 03 July 2017 19:58
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Python Plugin: Life 360 Presence Detection
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...
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...
-
- Posts: 5
- Joined: Tuesday 20 November 2018 15:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.1
- Location: UK
- Contact:
Re: Python Plugin: Life 360 Presence Detection
@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.
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.
-
- Posts: 331
- Joined: Monday 03 July 2017 19:58
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Python Plugin: Life 360 Presence Detection
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.
#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.
- capman
- Posts: 153
- Joined: Friday 12 July 2013 20:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Belgium
- Contact:
Re: Python Plugin: Life 360 Presence Detection
Great !! Working like charm ! Now I have location and distance.
Thanks 4 this great plugin !!!
Thanks 4 this great plugin !!!
- capman
- Posts: 153
- Joined: Friday 12 July 2013 20:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Belgium
- Contact:
Re: Python Plugin: Life 360 Presence Detection
Still the same error in my log. viewtopic.php?f=65&t=20392&p=204237&hil ... 60#p203831
Probably a python issue
Probably a python issue
-
- Posts: 331
- Joined: Monday 03 July 2017 19:58
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Python Plugin: Life 360 Presence Detection
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.capman wrote: ↑Monday 21 January 2019 11:35 Still the same error in my log. viewtopic.php?f=65&t=20392&p=204237&hil ... 60#p203831
Probably a python issue
Who is online
Users browsing this forum: No registered users and 1 guest