Store TTN received data in a file


(Monclus) #1

Hi everyone,
There is any possibility to download an store the data from TTN into a excel file or similar?
Thanks in advance for your time,
Regards


(Jeff Uk) #2

One option often called out on the forum is this method (GoogleSheets rather than Excel)

…note the caution wrt security by obscurity via the web url :wink:


(Tim Everitt) #3

Hi @monclus, I store all the TTN uplink data on my applications as MQTT/JSON into txt files. Very simple as follows:

On a public cloud Linux VM I run the mosquitto_sub system to subscribe to the TTN MQTT uplink stream and simply output the JSON records into a txt log file.

You can then very simply process the JSON records in your favourite language and extract whatever matters to you. Creating a CSV file for excel import would be easy. It also creates an ongoing archive of all uplinks.

I use systemd to start/restart the mosquitto_sub MQTT subscriber automatically and use a cron job at midnight to restart via systemctl to get a datestamped file per 24hrs. This way they all run continuously, restart after errors, etc.


(Monclus) #4

Wow, thanks for the reply and I appreciate it so much; but I barely understood what are you telling me. There is some guide I can follow being a newcomer?
Regards


(Tim Everitt) #5

Hi @monclus, The best way to start is to combine reading the docs and using the system. The best documentation entry point for the way I use MQTT to get data into a file is https://www.thethingsnetwork.org/docs/applications/mqtt/api.html

Everything that I describe is just automating and securing the use of the mosquitto_sub software that is described in the TTN MQTT API documentation. For automation (on Linux) look at online tutorials on the standard system engineering tools; systemd, systemctl and cron.

If you are a real novice at system engineering then start with https://en.wikipedia.org/wiki/Systemd , https://en.wikipedia.org/wiki/Cron and https://en.wikipedia.org/wiki/Pipeline_(software) for Linux.