Frm_payload data within Node Red

Hi, I am attempting to receive GPS coordinates from Lorawan sensors within node red.

I have subscribed to the topic “application/+/device/+/event/+”

Within chirpstack I can see the data string I want within the application event viewer:

When I look in the LoRaWAN frames within Chirpstack the frm_payload field contains the data I need.

However, the data that is recieved within node red does not contain this field, or if it does, it appears to be encrypted. This is the same message I have shown above within Chirpstack:


How would I go about getting this into the correct format for me get the data into SQL?

Many thanks

Try setting json=true in your chirpstack.toml under [integration.mqtt].
Also looks like Base64 to me, perhaps try converting it to Hex.

1 Like

Hi, thank you for the suggestion. I did some more reading and and then saw your comment it appears the data I get in node red is base64 as you suggested. Converting it to hex and going from there appears to be give me the data I am looking for.


Hi Mike!

The data is in format base64 as @le_on suggested. You might need to convert it to HEX, BIN, DEC, Time Series Predix or whatever format the data needs for your application.

I suggest you to use a “function” node to decode and transform the data properly before reaching final destination.

Here is mine solution for a Temp + Hum sensor from Milesight:

See I decode and transform my base64 data in the node called “Time Series Predix Generator” (because I need to send data to a SCADA, which expects the data to income in this format).

Also note that the nodes “device Filter” can help you to differ the owner of the messages arriving (the device).

Hope to help you!


1 Like

Thank you for the detailed reply, I am currently looking at how to write a script to convert the base64 to hex.

I can provide you with a proper script for this transformation… But I would thing first if you really need the data in HEX format, thought.

Where are you planning to send the data to? Are you sure HEX is the format required?
This is something you may get sure about it before start typing a script.

Nevertheless, I give you the code you need (in Javascript, which is the default language for the vast majority of devices and servers).

//Base64 to hexadecimal converter

function base64ToHex(str) {
const raw = atob(str);
let result = ‘’;
for (let i = 0; i < raw.length; i++) {
const hex = raw.charCodeAt(i).toString(16);
result += (hex.length === 2 ? hex : ‘0’ + hex);
return result.toUpperCase();

If you are planning to implement it on Node-RED, you should create a function node and call it this way:

hex_data = base64ToHex(msg.payload);
return hex_data;

If you enter this two lines in a function node in your Node-RED flow, then you got your base64 data converted to hex (msg.payload is the way you tell the node you want to transform the data incoming).

1 Like

Hi Nicolas, many thanks for providing that.

In hindsight I was initially asking for hex as we have a test system in the office that requires hex input. Going forwards decimal would be more appropriate.


I am not sure which configuration setting does this, but I receive decimal data in Nodered. No need to convert anything.

Perhaps Chirpstack converts to decimal once you enable

json = true

in Chirpstack.toml.

It depends on the device from which the packets are coming, and the way they communicate with the server, it is not the same Modbus TCP/RTU than LoRaWAN, or pulses (analogic) devices.

For example LoRaWAN devices send uplinks in base64 or HEX format, whereas

I just realized that I assumed they were using a decoder function inside Chirpstack.

If not it makes sense that everything is passed on as base64 or hex.

This topic was automatically closed after 90 days. New replies are no longer allowed.