I’m trying to create a python program to print my end device data via ChirpStack. I can see the uplink data from Application Server’s web interface (under the tab ‘device data’), but I’m not sure how to use the gRPC API for my python program to get the data.
My setting:
The end device is a Raspberry Pi 3 Model B+ with Dragino LoRa/GPS HAT.
The gateway is a Raspberry Pi 4 Model B with RAK 2245 Pi HAT.
The Network Server, Application Server, and my python program are all within one single PC running Ubuntu Linux.
The gateway communicates with the PC using ChirpStack’s built-in MQTT mosquitto broker, and on my PC I can use mosquitto_sub utility to receive device data.
For my external python program, I saw in the ChirpStack documentation that I may use the UplinkEvent protobuf message to receive device data : https://www.chirpstack.io/application-server/integrate/sending-receiving/
but I’m not sure how to begin using that message in my python program,
as I looked at the integration.proto but there is no service definition in it:
I looked at the as.proto and there is an ApplicationServerService but it did not use UplinkEvent message:
I looked at the application.proto but also did not see where it uses the UplinkEvent message:
Currently, there is an issue in chirpstack-api repo that exposes the use of python to grab information from the gRPC chirpstack api.
I’m not sure how long this will be ready in the official repository, however, you can start to take a closer look at. In other instance, you can check the javascript read documentation to have a feeling of how you would start to communicate with the api, it will be very similar in python.
That being said, you have another option and is using the HTTP integration. For that you will require to add the integration from the application server to the specific application you want to use. In python you must implement your endpoint that will then receive the data events.
Thanks for pointers, @sophiekovalevsky!
Now I see the issue and the on-going effort in the repo. I’ll begin by studying the javascript doc to learn the use of the API.
I am also working to use the ChirpStack API (python) to be able to receive device data.
In the solution you have build is the device data actually pushed to you?
I haven’t used the recent python support yet, because for our project’s current direction I need to build a C++ support for the ChirpStack API instead. Nevertheless, I think the procedure would be very similar: here are two examples, where the code can be found in the sub-folders here:
exampleStreaming: this one leverages a debugging feature (the StreamEventLogs rpc defined in service DeviceService in device.proto) to stream the events of the device with the given device EUI.
Our goal is to have a customized C++ application to receive event data and work with the application server, and the above code works for that purpose.