Using gRPC API in python to get device data

Dear all,

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:

Any hint or example would be much appreciated!

Sincerely,
Chao

@cw86

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.

Thanks!
Chao

I just saw the python support updated in the chirpstack-api repo and the following: https://pypi.org/project/chirpstack-api/
Thanks for all the effort!

3 Likes