Bridge between the-things-network, Helium and the habitat network, to receive telemetry from amateur balloons using LoRaWAN.
There are 3 parts to the bridge:
- Subscription to TTN and Helium(can be either).
- Parsing and then formatting messages in Habhub format
- Sending messages to Habhub.
TTNhabbridge subscribes to TTN's hosted MQTT broker, but Helium requires an external MQTT broker to be hosted(which it will publish to). Use the docker instructions under the [Docker](#Use docker to deploy) to both host the MQTT broker and TTNhabbridge.
See https://revspace.nl/TTNHABBridge for a more detailed description of this project. See https://travis-ci.org/bertrik/ttnhabbridge for the Travis CI status
I develop this on Windows 7, in Java 8 in Eclipse.
Steps to install everything:
- download a Java 11 JDK and put it in tools/jdk
- download Eclipse and put in in the tools/eclipse directory (for example)
- install the eclipse SVN plugin, using this update site: https://dl.bintray.com/subclipse/releases/subclipse/4.2.x/
Steps to prepare the Eclipse environment:
- open a command line to the checked out project, enter the 'ttnhabbridge' directory
- type 'env.bat' to initialise the tool paths etc
- enter directory gradle
- type 'gradlew eclipse' and watch dependencies being downloaded from the internet
- start Eclipse, using the 'workspace' directory as workspace
- import sub-projects (ttnhabbridge, cayenne) into the workspace
Steps to update source code from github:
- in the top-level 'ttnhabbridge' directory, enter 'git pull'
Steps to create the executable package:
- enter the 'gradle' directory, then type './gradlew assemble' (or just 'gradlew assemble' on Windows)
- the .tar (for Linux) or .zip (for Windows) file can be found under ttnhabbridge/build/distributions
Steps to deploy the application:
- unzip the .zip or .tar file
- cd into the application directory
- start the .bat or .sh file
- edit and install the systemd service file, if desired (instructions inside the .service file)
Its a lot easier to deploy with docker.
First, you will have to generate a password and username file, which will then be copied over to the docker image. Do so by running(change the username field to your own):
mosquitto_passwd -c passwdfile <username>
You will be promped to key in a password for this user name. An example command could be:
mosquitto_passwd -c passwdfile medad
Copy the passwdfile
to docker_configs/
. You will need to add the username and password to the ttnhabbridge.yaml
file at the root of the repo. Add it under the Helium yaml section, as well as on your Helium dashboard.
---
thethingsnetwork:
url: "tcp://eu1.cloud.thethings.network"
user: "icss-lora-tracker@ttn"
pass: "NNSXS.JDUJCMUYUN90AIOZ53TN6GBTT2P74NBH5FZXYXQ.OCWSRRQ4E46M5LLSATY35GJ6OGYBH6MOWZ5QFP32DMLKSNPS6M2A"
topic: "v3/+/devices/+/up"
helium:
url: "tcp://mosquitto:1883"
user: "medad"
pass: "secret_password"
topic: "helium/+/rx"
habitat:
url: "http://habitat.habhub.org"
timeout: 60
gwCacheExpirationTime: 600
payloadEncoding: "cayenne"
Just run the following command to fire up both TTNhabbridge and the MQTT broker for Helium. This should download all dependencies, compile code and run it.
docker-compose up -d
To see the logs, run:
docker-compose logs