Data storage and retrieval - python?


I have the things gateway that is up and running, and is receiving traffic, however none of it is coming from my end point!

I have successfully registered it, but it appears at ‘never seen’ , with a red dot next to it

it will say last seen with a few seconds and green dot, if I upload some simulated packets, but no traffic will ever show up from this device in my gateway- is this data going somewhere else?

is there a setting I need to change.

I have read some of the docs but none describe this problem, but hint that maybe I need to do something more like write some python code or do some kind of integration?

grateful for any suggestions!

can you describe your node a bit.
is it a commercial one or did you build it yourself ?
OTAA or ABP activation, what do you see in your console when powercycling your device.

1 Like


my node is a smart metering device that transmits its data over LoRaWan, its not yet fully commercial
Am using OTAA activation

I entered the AppKey and DevEUI

hope this helps

open your TTN console in your browser and leave page open on your gateway / traffic.
now switch on your node… you should see your node (trying) connecting TTN OTAA


if that’s not happening check your firmware / keys first.

I assume you’ve created an application and added this node to that application

1 Like

That sounds like a development project. Make your node firmware print out what it is actually doing when it transmits - frequency and all other air settings, and a hexdump of the raw packet transmitted. Grab that and run it through a packet decoder and see if it makes sense.

Likely issues include wrong air settings and reversing the order of the eui or appkey bytes.

For OTAA you have the additional possibility of the node listening with the wrong air settings or at the wrong time or re-using already used dev nonces, all leading to a failure to complete the join request / join accept loop.

1 Like


thanks for your helpfull responses, its much appreciated!
I got to the bottom of my problem.

I had to use the default Application EUI of: 90DFFB0000000000
instead of the one I had generated for my specific application.

Also I had to Force my device to join, by sending a Join request from an application specific tool, the other option was to allow 5 litres of flow through the meter which would have initiated this task also.

I can now see the data being transmitted, however its only there as long as the web page is open which is not that usefull, so I believe the next step is to use some kind of integration so I can collect more of my data for longer?

any suggestions of python implementations for integrations?

Storage Integration

The Storage Integration allows you to persist data in a database. The data is stored for seven days. You can then use the API to retrieve this data.

or for example

1 Like


I have been looking into ways to gather data from my devices connected to my gateway.
And Python looks really useful so have started looking into the python/API Reference which is great

however the part I cannot find out is where I put my code to run it, does it go somewhere in the gateway itself in a special tab?
or is there a different interface thats needed?

any idea’s?, implementation suggestions also welcome…

what about a Raspberry ? … do some search pls

Hi @nat1, I use python a lot to process data from TTN.

I think that you may be mis-understanding the LoRaWAN architecture when you suggest that the python runs on the gateway. I run the python in a cloud VM and use MQTT to subscribe to the TTN MQTT broker. This receives a flow of JSON formatted messages.

The best way to start is per the TTN documentation and run the mosquitto_sub MQTT subscriber client to get experience of the messages flowing out from TTN. Then replace the mosquitto_sub MQTT subscriber with your python code.

1 Like