Chirpsatck work with emqx mqtt broker

Hi all,
I need your help, I mount a chirpstack server in my vps and I have another vps with emqx mqtt broker, I configure teh chirpstack to send to emqx and the messages appear in emqx but with phyPayload

{“phyPayload”:“QEOV5AaARwABVFuGjcruBI25yp59OrgBdYBcJHL+ViAvO3giV8gbPGEpLA==”,“txInfo”:{“frequency”:904700000,“modulation”:“LORA”,“loRaModulationInfo”:{“bandwidth”:125,“spreadingFactor”:7,“codeRate”:“4/5”,“polarizationInversion”:false}},“rxInfo”:{“gatewayID”:“uCfr//6wBD8=”,“time”:null,“timeSinceGPSEpoch”:null,“rssi”:-31,“loRaSNR”:8.5,“channel”:4,“rfChain”:1,“board”:0,“antenna”:0,“location”:null,“fineTimestampType”:“NONE”,“context”:“US3L4w==”,“uplinkID”:“PBI2ii1fQ3ilxxP8jbAzTg==”,“crcStatus”:“CRC_OK”}} gateway/b827ebfffeb0043f/event/up 0 2020-10-28 02:54:19

I tested the LoRaWAN 1.0.x packet decoder and it works but I want to know if is posible that in the emqx broker arrives raw payload from my device, because to decode with LoRaWAN 1.0.x packet decoder I need the NwKey and AsKey and store that keys for every node is not convinient
besides that these keys can change, so please if you can help me I’ll be very greatful


That’s the job of the application-server. If you use the mqtt integration (global) and set-up a decoder you will get what you want. This has nothing to do with you deploying with emqx as your broker.

1 Like

Thanks for your fast reply, could you please explain me a litlle bit how I need to do that? How to setup the decoder, where to setup?
Please and sorry if is easy I can’t found the solition

You need to write Javascript code for decoder

You need to setup decoder in device-profile

1 Like

Thanks for your reply I did that but in the mqtt broker only receive the phyPayload

function Decode(fPort, bytes, variables) {
  var decoded = {};
  var hex  = bytes.toString();
  //hex = hex.trim();
  //hex = hex.replace(',','*');
  var hexcut = hex.split(',')
  // if (port === 1) decoded.led = bytes[0];
  for (var n = 0; n < hexcut.length; n++) {
		decoded[n] = String.fromCharCode(hexcut[n]);
  return decoded;

The decoded payload only can view en the device data on the chirpstack


I change the topic in my mqtt broker because I pnly suscribe to

`event_topic_template=“gateway/{{ .GatewayID }}/event/{{ .EventType }}”

and only receive the phyPayload but now I suscribe to

event_topic_template=application/{{ .ApplicationID }}/device/{{ .DevEUI }}/event/{{ .EventType }}

and receive the decode with javascript code and the base64 of my data

1 Like