Tracking your Android phone with MQTT

pete_c

Guru
Typically shut off the phone when home and last few years have been using VPN to my PFSense box when using the Laptop / Tablet / phone away from home.
 
Recently installed NextTracks on my current Android 10.X phone.
 
NextTracks

A tracking app that doesn't compromise privacy.
NextTracks is a fork of OwnTracks which doesn't use Google Play Services.

It allows you to track the locations of your devices.

Supported Protocols: HTTP and MQTT

Features:

* You can use your own server.
* Map that shows your markers with your devices in it.
* Set waypoints to get a notification when a device leaves or joins a region (Geofencing).
* Friend List (each friend is a device, can be multiple per person) with their current address.
* Configurable to only publish manually or on significant movements.


So via VPN configured it to connect to my home MQTT broker.

The MQTT message looks like this:

{"_type":"location","acc":10,"alt":179,"batt":92,"bs":1,"conn":"w","created_at":1619369079,"lat":4x,xxx"lon":-8x.xxx,"t":"u","tid":"01","tst":1619369080,"vac":3,"vel":0}


With HA  / NextTracks plugin it creates an overlay of mobile devices over the maps present in HA.

 

 
 

pete_c

Guru
Had an opportunity to test Android application running talking to the MQTT broker on my home network this weekend.  Works well and not using the cloud at all.
 
Best of all its free and private using VPN.
 
Found a php page which reads the MQTT messages above but uses Google API. Wondering how to change this to using OpenStreetMaps.
 
Top