Capture location data obtained via GPSLogger app and present in Domoticz devices.
A mobile phone is used to capture actual location data. The app used for this plugin is GPSLogger
,
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
).
Multiple mobile phones are able to have connection with Domoticz, so in fact a community circle
can be setup for logging data and processing that data into Domoticz. For instance triggers in Domoticz
can be build to switch of the lights when all mobile phone users left the house. Or switch on when one of the
mobile phone users arrive at home. Or the alarm system can be triggered (switch on when all mobile phone users
left the house and switch off when one mobile phone users arrives at home).
Next devices will be created and updated in Domoticz (in the utility tab unless otherwise specified):
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.Map
: Hyperlink to show the location on a map (separate window will be opened).RawData
: Data which is captured from the GPSLogger app. This device is hidden (only in devices tab).PuTTY
session.Plugin
folder of Domoticz.git clone https://github.com/TurnOfAFriendlyCard/Domoticz-GPSLogger-Plugin
mkdir Domoticz-GPSLogger
) in the Plugin
folder of Domoticz.cd Domoticz-GPSLogger
).chmod 755 plugin.py
).type
will be available: GPS Logger Presence
.Location
). Will be a prefix to all devices created.GPS Logger Presence
.Status
and Error
).Disabled
).Open Streetmap
or TomTom
).
TomTom
obtain an API key (see History on how-to).Open Streetmap
or Google Maps
).Idx
number in the devices tab for the RawData
devices. These are required for GPSLogger setup.RawData
devices). Rights User
and Active Menu none
. No devices need to be set.username
:password
into the text box. This the username/password defined in step B5. Also include the colon as separation between username and password.LocUser:LocPWD1234
where LocUser is the username
and LocPWD1234 is the password
.TG9jVXNlcjpMb2NQV0QxMjM0
(the example in step 4 should give the exact same result).The Android app GPSLogger
is described at https://gpslogger.app/. Installation of the app is via F-Droid
(Free and Open Source Software).
Download F-Droid
.application sources will be updated
.green search glass
in the bottom right-corner.GPSLogger
.Install
button to install the GPSLogger app.Logging details
switch on "Log to custom URL" and switch off "Log to GPX".Performance
set "Logging Interval" to for instance 15 seconds (so data is shared to Domoticz by this interval).Custom URL
switch on "Log to custom URL" (should be switched on already).URL
and enter servername
, port
and body
. Should look like this
https://example.com:443/json.htm?type=command¶m=udevice&idx=<Idx>&nvalue=0&svalue=%LAT;%LON;%SPD;%BATT
<Idx>
enter the value determined in step B5.Click on HTTP Headers and enter
Content-Type: application/json
Authorization: Basic <base64>
The value of <base64>
is the value generated in step C5.
HTTP Method
and set value to POST.Start Logging
.Idx
numbers (step D12).The plugin comes with a file locations.txt
. In this files you may define your own locations. Instead of showing the full address in the location
device the shortname will be shown. The file may look like this (first line not to be changed or removed - no empty lines in the file):
Name,Latitude,Longitude,Radius
Town Hall Rotterdam,51.922710,4.479160,50
Tower Brigde London,51.505815,-0.075255,100
Eiffel Tower Paris,48.858278,2.294470,50
Multiple lines for your own locations can be defined.
The concept is based on the Life360 Plugin
by fibalci. This plugin is not maintained anymore and also deprecated.
He thanked Harper Reed for Python implementation of Life 360 API: https://github.com/harperreed/life360-python.
The icons are downloaded from Free Vector Graphics
by www.Vecteezy.com.
TomTom API key
is not required, but if you want to get current address of a member and driving distance,
you should get a TomTom API key and copy-paste here, otherwise leave it empty.
How to get a TomTom API Key
:
My Apps
,
TomTom API Key
field.Home
, there are no API calls to TomTom.