RAK 3172 decode payload

hello everyone, currently I have a RAK3172 which sends raw data to the chirpstack server in this form: frm_payload: “6c61743a34382e38353636206c6f6e673a322e33353232” which corresponds to: lat:48.8566 long:2.3522 when we convert from HEX to ASCII , I would like know if I need to put a CODEC in place and which one? or do it as part of the integration? and how please, the doc talks about a single probe (temperature, humidity), I just want to send the decoded data to my server, thank you in advance.

I am not sure how you did this payload formatting, but maybe looking on this example might give clarity as well as on how it is decoded on the LoRaWAN Network Server side.

Of course you can also use CayenneLPP. This is where the RAK standard payload decoder is based - GitHub - RAKWireless/RAKwireless_Standardized_Payload: Payload description, payload decoder and example code for RAKwireless LoRaWAN devices

hello, thank you for the info, I applied the data formatting rules, it works, I get the same format as him, however one thing intrigues me my data is in frm_payload: “09000774764e00005be245” I wonder if is this normal? because I have an error with the codec provided.

Hi @fanfan6966 ,

It is hard to troubleshoot on looking the frm_payload. With the decoder error, what do you see? Maybe we can get some insights from there.

hello, I don’t see anything special just “error”

I had this error on Chirpstack V4 before.
Could be one of two problems:
(1) Your javascript has errors
(2) You use functions in the javascript that are not supported. CS V4 users QuickJS, which is not a full Javascript implementation.

hello, that’s some information, I didn’t know about quickjs, the problem is that in the log there is nothing concerning the error, it will be hard to debug the script, otherwise there is there is a way to send the raw data to my site, I will see if a PHP is created to process it if I cannot find a solution.

Please share your decoder, I can have a look.
ZIP it and you should be able to attach it to a reply.

impossible ZIP format is not supported

I post in image

Strange ZIP files should work, I used it before.

For the decoder code, that will not work on CS V4.

(1) function Decode(fport, bytes) is from CS V3. In CS V4 it is function decodeUplink(input)
(2) fPort and bytes are part of input


The result is returned as an object:

  function decodeUplink(input) {
    return {
      data: {
        temp: 22.5

Better check the CS V4 documentation about decoders.

it’s good like that

function decodeUplink(input) {
  var bytes = input.bytes;
  var fport = input.fPort;
  var longitude_int, latitude_int;
  var decoded = {"latitude":"","longitude":""};
  if (fport === 2)
    if(bytes[0]==9) // check if the header byte is 9.
      latitude_int = (bytes[1] << 24) | (bytes[2] << 16) | (bytes[3] << 8) | (bytes[4]);
      decoded.latitude = latitude_int / 100000;
      longitude_int = (bytes[6] << 24) | (bytes[7] << 16) | (bytes[8] << 8) | (bytes[9]);
      decoded.longitude = longitude_int / 100000;
      return { data: decoded };

Thanks for the helping hand, I no longer have any errors and my server receives the data but the problem is that it is the entirety of the data and not just the coordinates?
(it happens HEX which I decode here to better understand)


The decoder is just adding the results as “object”.

LoRaWAN server is just an application to receive data.
The decoder in the LoRaWAN server is just a helper.
Processing of the data should be in an integration, e.g. influxDB + Grafana or Datacake.
If you are getting the data e.g. through MQTT in an endpoint, you have to get that object for further processing.

I am using both (influxDB+Grafana and Datacake) in different scenarios.

E.g. this influxDB integration in CS V4 sends the data to an influxDB data base

In inlfuxDB I can then get the data through a query (here I am looking for the TDS values of a hydroponic system water tank)

Then I connected a Grafana installation to that influxDB data base and get the values for visualization using the same query:

Long way to go from getting the values to actually being able to use them :grin:

In Grafana I was using Geomap in the past to show device locations. It is empty now, as there are no devices active.

1 Like

ok, I did an http integration because I prefer to receive the data directly on my site endpoint, it’s more practical for me since I am in the prototype phase. If I want to only receive the data, what should I configure?

You can’t configure that in CS V4. You have to do it on your endpoint.

1 Like

thank you, you were of great help, I will try!!! to do that, I will come back for other questions.