This is a Flask app served via Gunicorn and Nginx using docker containers orchestrated by docker-compose.
For use with TTN Mapper nodes such as kizniche/ttgo-tbeam-ttnmapper for the T-Beam TTGO (tracker node), which transmits data to The Things Network (TTN) for TTN Mapper.
This app pulls coordinate data acquired from the tracker node that's been stored on TTN. It stores these coordinates in an SQLite database and displays the coordinates on a leaflet map in your web browser. This is useful for testing the signal range from LoRaWAN gateways while driving, so you can see when and where your signal was able to reach a gateway.
This is very similar to the TTN Mapper frontend, however TTN Mapper takes a long time to update the data points on its map. This software runs locally on your own hardware and responds instantly to new data on TTN when the browser page is refreshed, making it a good companion in your vehicle if you want to get instant updates as to whether your tracker node successfully transmitted its coordinates or not.
Web browser view of TTN Tracker with the gateway (blue marker) and points where the tracking node successfully transmitted to the gateway (red marks).
Successfully built this on the Raspberry Pi (Raspbian Buster) and a desktop PC (64-bit Ubuntu 18.04.2). However, since this is docker, it should run on a variety of other platforms.
- Multiple map layers, including topology, streets, and satellite (Bing API key required for satellite)
- Automatically acquires new data and adds markers to the map
- Tracking tool to use device GPS to place marker of current position (and direction) on map
- Scale bar at edge of map
- SSL/HTTPS (required for location tracking)
- Measuring tool for measure distances between points
- Map stays focused on the same point across page refreshes
- Clicking gateway or data point markers pops up information about them
- Toggle visibility of markers of each device on map
- Select age of markers to show on map
- Add user-configurable auto-refresh
Make sure you have your application set up on The Things Network with the integration "Data Storage". The integration "TTN Mapper" is optional but is recommended to be able to provide signal data to the public.
sudo apt-get install -y libffi-dev libssl-dev
curl -sSL https://get.docker.com | sh
sudo apt-get install -y python3 python3-pip
sudo pip3 install docker-compose
sudo usermod -a -G docker $USER
Then log out and back in again.
git clone https://github.com/kizniche/ttn-tracker.git
cd ttn-tracker
Edit ttn-tracker/flask_app/config.py
with your application API Key, application ID, Device ID(s), gateway location(s), and Bing map API key (optional) before building the docker images. If you need to edit this file after the images are created, you can rebuild the image (destroying data) or copy the new config file over the old file while the flask_app container is running (see Notes, below).
nano flask_app/config.py
make build
Open a web browser to the address, below, replacing IP_ADDRESS with the IP address of the system running the docker containers.
https://IP_ADDRESS/map
Note: there is no security preventing someone from viewing this page if they happen to request "/map" on the server (however, knowing this is the page is unlikely). Therefore, make sure you are comfortable with this or implement your own security measures such as not allowing port 443 to be publicly accessible (connect to your home network via VPN to access the app) or add a login system such as Flask-Login.
docker-compose stop
docker-compose start
docker-compose down
docker-compose rm -fs
docker ps
docker logs flask_app
docker exec -i -t CONTAINER_ID /bin/bash
docker cp ./foo.txt CONTAINER_ID:/foo.txt
docker cp CONTAINER_ID:/foo.txt ./foo.txt