Page 1 of 2
Python Plugin: GPSLogger
Posted: Tuesday 20 February 2024 0:20
by Marathon2010
I've used the Life360 integration for several years with much pleasure. Unfortunately the Domoticz integration was not maintained anymore the moment the integration appeared to be broken (authentication issue by Life360, see
https://www.domoticz.com/forum/viewtopi ... 60#p310361).
So, based on this integration, I've created a new plugin (see
https://github.com/TurnOfAFriendlyCard/ ... ger-Plugin for more details). A mobile phone is used to capture actual location data. The app used for this plugin is GPSLogger (see
https://gpslogger.app), however other GPS logging apps can be used as well. In fact the most important prerequisite is that the app is able to share location data via the Domoticz API on regular basis.
Concept is that users are determined for these mobile phones (just names, no formal users in Domoticz). Besides that the home location is identified by the location setup in Domoticz. A fence around the home location determines how Home is identified. For example a circle of 100 meters around the address Coolsingel 40, Rotterdam, the Netherlands (latitude 51.922710 and longitude 4.479160).
Next devices will be created and updated in Domoticz (in the utility tab unless otherwise specified) - those devices are the same as for the Life360 integration:
Presence: This is an On/Off switch indicating the user is within the fence (in switches tab).
Location: Text describing what the actual location of the user is.
Battery: Charging percentage of the battery of the user.
Distance: Distance in minutes of the actual location to the fence (to implement in future).
Speed: Speed in kilometers / hour of the user.
RawData: Data which is captured from the GPSLogger app. This device is hidden (only in devices tab).

- Switches.jpg (10.16 KiB) Viewed 2652 times

- Utility1.jpg (18.27 KiB) Viewed 2652 times

- Utility2.jpg (19.22 KiB) Viewed 2652 times
Re: Python Plugin: GPSLogger
Posted: Tuesday 20 February 2024 9:02
by waltervl
Thanks for the alternative!
I have added your plugin to the Wiki Plugin List and modified the original start topic of the Life 360 plugin to indicate its deprecation.
Re: Python Plugin: GPSLogger
Posted: Wednesday 21 February 2024 9:30
by EdwinK
Looks great, but atm there is an error message that GPSLogger has some bugs and it won't open. .
Re: Python Plugin: GPSLogger
Posted: Wednesday 21 February 2024 9:36
by Marathon2010
Hello Edwin, please share details so I can analyse.
Re: Python Plugin: GPSLogger
Posted: Wednesday 21 February 2024 11:14
by EdwinK
It seems fixed now.
Re: Python Plugin: GPSLogger
Posted: Wednesday 21 February 2024 12:13
by HvdW
waltervl wrote: ↑Tuesday 20 February 2024 9:02
I have added your plugin to the Wiki Plugin List and modified the original start topic of the Life 360 plugin to indicate its deprecation.
Why is GPSlogger present in
the WiKi list and not present in the Python Plugin Manager?

- Plugins.jpg (21.92 KiB) Viewed 2559 times
Re: Python Plugin: GPSLogger
Posted: Wednesday 21 February 2024 12:15
by waltervl
Because the wiki list and the plugin manager(s, there are 2) are not related.
Re: Python Plugin: GPSLogger
Posted: Wednesday 21 February 2024 14:04
by EdwinK
So far I have it working on the phone, but in the log I can see a message that it couldn't upload the log. I created an user for GPSLogger and used this in the base64decode site. The output from there I entered in GPSLogger app.
Custom URL: maximum attemps failed: giving up
Custom URL: Kon het bestand niet uploaden (Coulnd't upload the file)
I can manually enter data to the devices with going directly to https://<myurl>.ddns.net/json.htm?type=command¶m=udevice&idx=429&nvalue=1&svalue=1,2,3
Re: Python Plugin: GPSLogger
Posted: Wednesday 21 February 2024 16:25
by Marathon2010
I can manually enter data to the devices with going directly to https://<myurl>.ddns.net/json.htm?type=command¶m=udevice&idx=429&nvalue=1&svalue=1,2,3
Related to the example, can you see in Domoticz the setup/devices tab the RawData device showing data received from GPSLogger? In your situation it should show "1,2,3"

- RawData.jpg (30.39 KiB) Viewed 2510 times
Custom URL: maximum attemps failed: giving up
Custom URL: Kon het bestand niet uploaden (Coulnd't upload the file)
If data is not at all in the Domoticz RawData device it should be GPSLogger cannot connect to Domoticz, did you validate the SSL certificate in GPSLogger? See
https://gpslogger.app/#customsslcertificates

- GPSLogger SSL.jpg (137.2 KiB) Viewed 2510 times
Did you enter in the "HTTP Headers" section of GPSLogger:
Content-Type: application/json
Authorization: Basic <base64>
where <base64> is the decoded base64 of <username>:<password> (including the colon).
See below setup:

- GPS Logger Custom URL2.jpg (94.78 KiB) Viewed 2510 times
Re: Python Plugin: GPSLogger
Posted: Wednesday 21 February 2024 16:42
by EdwinK
This is what I have in the raw data

- Screen Shot 2024-02-21 at 16.39.34.png (24.04 KiB) Viewed 2506 times
So that works. I already had validated the certificate, but will go through all this again.
Re: Python Plugin: GPSLogger
Posted: Wednesday 21 February 2024 16:58
by EdwinK
Seems that it is something with some security, I tried the same url on another laptop and then the result was a 401 error.
Re: Python Plugin: GPSLogger
Posted: Wednesday 21 February 2024 17:04
by waltervl
You probably have to add your user credentials to the link.
Re: Python Plugin: GPSLogger
Posted: Wednesday 21 February 2024 17:07
by Marathon2010
Perhaps try with HTTP instead of HTTPS to at least get it up and running?
Re: Python Plugin: GPSLogger
Posted: Wednesday 21 February 2024 18:05
by EdwinK
Going to try tomorrow (or the day after). Now time for some rest

Re: Python Plugin: GPSLogger
Posted: Friday 01 March 2024 16:23
by Marathon2010
Updated functionality of the plugin (v3.0.0) by adding Map device showing the actual location in either Google Maps or Open Streetmap. Map will be opened in a new window.

- Utility3.jpg (9.98 KiB) Viewed 2421 times
Re: Python Plugin: GPSLogger
Posted: Saturday 30 March 2024 11:51
by capman
A still get this error in the log
Code: Select all
2024-03-30 11:48:47.190 Error: Location: Call to function 'onHeartbeat' failed, exception details:
2024-03-30 11:48:47.190 Error: Location: Traceback (most recent call last):
2024-03-30 11:48:47.190 Error: Location: File "/home/pi/domoticz/plugins/Domoticz-GPSLogger-Plugin/plugin.py", line 313, in onHeartbeat
2024-03-30 11:48:47.190 Error: Location: _plugin.onHeartbeat()
2024-03-30 11:48:47.190 Error: Location: File "/home/pi/domoticz/plugins/Domoticz-GPSLogger-Plugin/plugin.py", line 210, in onHeartbeat
2024-03-30 11:48:47.190 Error: Location: Domoticz.Debug('Processing '+str(member)+' RawData: '+Devices[member*self.numberDevicesPerMember+self.devRawData].Name+' = "'+Devices[member*self.numberDevicesPerMember+self.devRawData].sValue+'"')
2024-03-30 11:48:47.190 Error: Location: KeyError: 27
Re: Python Plugin: GPSLogger
Posted: Saturday 30 March 2024 12:52
by Marathon2010
What version did you install (and started with an earlier version)? Please show the input fields (specific the "Users GPSLogger" entry). And please show overview of the devices created (so <user> Location, <user> RawData, ...) from the Setup/Devices menu.
Re: Python Plugin: GPSLogger
Posted: Monday 01 April 2024 10:32
by capman
Thanks 4 the reply.
Started direct with the latest version , of the moment, v3.
See screenshots.

- Schermafbeelding 2024-04-01 102433.jpg (240.55 KiB) Viewed 2269 times

- Schermafbeelding 2024-04-01 102638.jpg (52.22 KiB) Viewed 2269 times
Re: Python Plugin: GPSLogger
Posted: Monday 01 April 2024 10:45
by Marathon2010
The last semi colon after Milan should not be there. So entry should be:
Kris;Sabine;Milan
Will process this as an issue to be validated as well.
Edit:
https://github.com/TurnOfAFriendlyCard/ ... n/issues/5
Re: Python Plugin: GPSLogger
Posted: Monday 01 April 2024 20:57
by Marathon2010
Issue resolved in v3.0.1.