Base64 to hex function

Hi.
I have a problem with a base 64 conversion. This is the original message AwAE+wABILI= in base64. This message in hex looks 030004FB000120B2. I would like to bulid this is node-red. From this code i need the 04FB it's a temperature and the last four character 20B2 it's a device id. I tried to use the base64 node but i got this [3,0,4,251,0,1,32,178] message. I don't know how can i use it to get from 4FB the value 1275? Thank you in advice.


Hi, the buffer parser node can help with converting that data into something useble.

e.g...

[{"id":"6b79e972.fada28","type":"inject","z":"1062d7f9.08a808","name":"base64 string","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"AwAE+wABILI=","payloadType":"str","x":850,"y":80,"wires":[["c0639572.9f2e18"]]},{"id":"c0639572.9f2e18","type":"base64","z":"1062d7f9.08a808","name":"","action":"","property":"payload","x":1020,"y":80,"wires":[["9723eb14.4e0dc8"]]},{"id":"9723eb14.4e0dc8","type":"buffer-parser","z":"1062d7f9.08a808","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int16be","name":"item1","offset":0,"length":1,"offsetbit":0,"scale":1,"mask":""},{"type":"int16be","name":"item2","offset":2,"length":1,"offsetbit":0,"scale":1,"mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"setTopic":true,"x":860,"y":140,"wires":[["796e3a62.84cab4"]]},{"id":"796e3a62.84cab4","type":"debug","z":"1062d7f9.08a808","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1040,"y":140,"wires":[]}]

Hi. Thank for your relpy. Unfortunately in my node red the buffer-parser not the same as your buffer parser.

How can i configure this node?

What version of node-red is that? Looks like it's either very old or broken. The byteswap boxes should be typed inputs and the bottom area should have an editable list.

The version is v0.18.1.

That is very very old. Is it possible you can update? What is node-red running on?

The node-red is runnung on a Kerlink Wirnet™ iFemtoCell SPN LoRa gateway. Maybe it not possible to upgrade.

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