Proper way to view old data


#1

Hi!
When I open lora-app-server I can see only data received later.
What is the proper way to view previously received packets?
If no default way to enable this what is the easiest way to achieve that?
Thank you.


#2

There’s no persistent datastore. You’d either need to use one of the supported database integrations, or add your own.

Or for debugging, something that’s proved very handy is that I have a copy of mosquitto_sub subscribed to the ‘#’ topic (ie, everything) and simply appending to a text file which I can grep and tail - a bit crude, but the literal transcription of the MQTT feed itself means it’s easy to write programs which can either watch live data, or re-examine old data…


#3

Do you mean following:
https://www.loraserver.io/lora-app-server/integrate/sending-receiving/influxdb/
?


#4

So I implemented separate service that listens for MQTT events and store all payloads to Postgresql’s table called ‘payload’.
Then I modified ReactJS code to get additional tab with graphical representation of payload (dummy data at this moment):

So how can I retrieve data from backend to display it in my new tab?
How cat I create new endpoint at existing API?


#5

You’ll have to modify the according proto file or create your own for a new service. In the first case, just run make api; in the latter, remember to add it to gen.sh and register the service at internal/api/external, in functions setupAPI and getJSONGateway, after running make api.

After that you need to implement the logic at the correct internal/external/your-service.go file. On the UI side, just call the endpoint(s) from the proper store.