Decode protobuf into json

Hi everyone

I have two questions about the protobuf event type in ChirpStack.
My lora gateways send events in protobuf (which is what I want) and I want to receive these events in a Node-RED MQTT client.

  • Is there a configuration to auto-decode these events into json, when they arrive on ChirpStack? That would be useful because I’m working with device profile codec’s.
  • If there is no configuration, is there any prebuild Node-RED node for that? I just found the following package: @chirpstack/node-red-contrib-chirpstack - npm

Thanks for your help

There exists JavaScript client code for the ChirpStack protobuf packages here:

It appears that some people are doing protobuf encoding and decoding in Node-RED:

https://www.google.com/search?q=node-red+protobuf

I have not done so and cannot speak to the quality of those options, however. I normally reach for Go and an MQTT library when doing these types of tasks, but there are many ways to skin this cat.

Thanks for your help

Just so I understand.
These clients are auto-decoding the protobuf events into json?
And can I use them in the device profile codec on the ChirpStack dashboard?

I have not done so and cannot speak to the quality of those options

Ok, I will try it out.

  • Is there a configuration to auto-decode these events into json, when they arrive on ChirpStack? That would be useful because I’m working with device profile codec’s.

I’m not sure if what you are asking for is what you need. By default the Gateway <> ChirpStack communication is Protobuf over MQTT. However, the ChirpStack > Integration events are by default in JSON.

When working with codec functions in the device-profile, it does not matter if the GW <> ChirpStack communication is Protobuf or JSON.

Sorry, what do you mean by Integration events?

From my understanding I can set the event type on the gateway for Gateway <> ChirpStack communication to either Protobuf or JSON.

When I configured a gateway to Protobuf, the uplink event I got in the device-profile was also in Protobuf and same for JSON events. Maybe I just misconfigured something.

That’s why I wanted to decode the Protobuf events into JSON.

https://www.chirpstack.io/docs/chirpstack/integrations/index.html

You might want to revisit the architecture portion of the docs to get a better understanding of ChirpStack-Gateway-Device communication and how that data then leaves ChirpStack.

1 Like