Decrypt LoRa packet

Hi for all
I'm a newbie to node red , I'm trying to receive and send a LoRa packet to my server. I put a TCPin to listen on a port and I get a similar packet as string

01879004:ffffffcf0000005a10020100;

or as buffer

48,49,56,55,57,48,48,52,58,102,102,102,102,102,102,99,49,48,48,48,48,48,48,53,50,49,48,48,54,48,49, 48,48,59,13,10

i would like to fetch some data to put into my my sql and fetch data from my db to send it to the end node.

I receive the packet in TCPin , I have already implemented the writing and reading in mysql but I can't decipher this data.

I tried contrib nodes but they don't work.

Has anyone faced a similar problem before?

Regards

NEX

Hi, normally your message is encoded in Hexadecimal, so you have to convert Hex to String:

const buffer = Buffer.from(msg.payload, "hex");
const data = buffer.toString("base64");
return { payload: data };

thanks a lot

I test your code at soon possible

Regards

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.