Owntracks as my Location Companion
I use Owntracks to track the places I visit. It is very interesting to look back and see on a map, where I spent my time in the last week/month/year :-) However, Owntracks gets even more interesting if you share your location with family and friends:
A lot of applications already exists which doing the same or provide even more functionality (to only name a few):
- Google+ Location Sharing
- Find My Friends on iPhone
- Life360 Family Locator
However, for me the past locations and the current location are very sensible data and thus should not be accessible by any third party. This is were Owntracks comes in place, as the Android app and iOS app can be used with your own server. And even better: Owntracks does not need any proprietary software on the server-side as it connects to any MQTT-compliant broker.
As I’m quite amazed by Owntracks simplicity and flexibility, I want to give a short overview on my setup. I focus on ‘what’ I have done and ‘why’. For ‘how’ see the link at the end of this post. Let’s have a look at my setup:
In my installation, I use Mosquitto as the MQTT broker on a server accessible from the internet where all the mobile devices connect to and publish their locations. This is the minimal setup for sharing the current position with friends using the Android or iPhone app. Keep in mind to secure the Mosquitto instance with password for each user and encrypt communication using SSL/TLS. Let’s Encrypt provides free certificates which are accepeted by Android and iOS. To configure access rights (e.g. Jane can see my location but should not see the location of John), Mosquitto’s native access control list (ACL) can be used.
Besides the current position, no past locations are stored by Mosquitto. What sounds dissappointing at first place is a security benefit: Remember that the server is accessible from the internet and you can never be 100% certain that nobody can break into it. In that case, it is best to have as little data as possible on the server. But as mentioned at the beginning of this post, I want to be my own big brother and track myself. For this use case, the Owntracks Team provides the application Recorder. It connects to your MQTT broker and stores all location updates on harddisk. As the connection is established from the Recorder, the application can run on a computer behind a firewall in your local network. Collecting data is not as half as fun if it is not visualised. Therefore, Owntracks Recorder has a build in webserver which can be used to query your location data and visualise the result in a browser. As map source OpenStreetMap is used as default and Google Maps can be used if a personal API Key is provided:
However, I already have a MQTT broker running in my local network which is used for home automation and I might want to use my location data also within my automation rules. And again, Owntracks can show its strength based on its simplicity: the underlying MQTT supports bridging between different instances. Thus, I let the second Mosquitto instance in my local network connect to the MQTT broker on my server and configured the bridge to just subscribe to my location updates and not the updates of my friends (I care a lot about privacy!). To permanently store my location history I use the Owntracks Recorder on my local computer connected to the local MQTT broker.
If my post has made you curious and you want to setup your own location companion, have a look at a good article on linux.com with a detailed tutorial and more background information.
This post was originally published at Diaspora on a discontinued pod.