Adeunis - Codec Decoder

Hi All,

Recently i am working with a Adeunis Node, Dry Contact.
Adeunis offers a good online Tool for payload decoding:
Also it allows the users to download the library and install it, so that payloads can be decoded via shell.

Since i am not really strong in Javascript i was wondering if anyone has experience in how to implement the decoding best.

My Setup is the following:

Adeunis=> Gateway=>TTN=>Node Red=>Influx DB=> Grafana

i would like to use the TTN Decoder to push the whole decoded payload to Node Red and Influx.
Can anyone give me a hint how to build a decode for ttn using the material provided by adeunis ?

Thanky a lot for you help

bits and pieces :wink:

Thanks Borroz, i already found these links ;-).
Unfortunatly they concern the Field tester, and it seems someboady wrote them by his own.
It would be great if you could use the files already provided by adeunis.
I also contacted them :wink:

oops… my mistake sorry … If i see ADEUNIS I read fieldtester :rofl:

Hi there,

Since the codec itself is available from Adeunis, and you have a node-red already in place, you can install the codec on the host running the node-red and make an exec to system to call the codec and make the decoding for you.
Codec installation howto can be found in the file.
Like this:node-red
Here’s to flow’s code:

[{“id”:“72c11275.1dc18c”,“type”:“tab”,“label”:“Flow 1”,“disabled”:false,“info”:""},{“id”:“d2f05f90.374e3”,“type”:“exec”,“z”:“72c11275.1dc18c”,“command”:"/home/mogyoros/Letöltések/package/bin/codec decode --json",“addpay”:true,“append”:"",“useSpawn”:“false”,“timer”:"",“oldrc”:false,“name”:“Exec Adeunis decoder”,“x”:280,“y”:900,“wires”:[[“3474df97.2367e”],[],[]]},{“id”:“8a05bef8.463a2”,“type”:“inject”,“z”:“72c11275.1dc18c”,“name”:“Input from TTN”,“topic”:"",“payload”:“43400100F40200F1”,“payloadType”:“str”,“repeat”:“10”,“crontab”:"",“once”:true,“onceDelay”:0.1,“x”:180,“y”:800,“wires”:[[“d2f05f90.374e3”,“4f931dc1.fb4564”]]},{“id”:“4f931dc1.fb4564”,“type”:“debug”,“z”:“72c11275.1dc18c”,“name”:"",“active”:true,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“false”,“x”:650,“y”:800,“wires”:[]},{“id”:“3474df97.2367e”,“type”:“json”,“z”:“72c11275.1dc18c”,“name”:"",“property”:“payload”,“action”:"",“pretty”:false,“x”:490,“y”:880,“wires”:[[“4f931dc1.fb4564”]]}]


1 Like

Hi Tamas

Thanks a lot for your help and your idea.
I think this would be a great solution. I already installed the Codec and implemented the node red model.
When I run the injection I get a PID but now debugging message from the exec side. I will keep on tring. Thank you for your help

Even if i try just to call a echo function in the exec and append 00000. The Result is not transmitted to the Debugging Box. Sorry Maybe it is just a simple mistake, but i am not very experienced with node-red.
Do you have any idea ?

You have connected the exec node 2nd output pin (on right side) to the debug node. Which will show the standard error output of the exec process, if any. The 1st pin stands for standard output of the exec process, so you have to connect that to the debug node to see the result of the codec.
You can see it on my picture, that I have connected the 1st output pin of exec node.

Thanks a lot, sorry for the trouble :smiley:

I would like to know how you installed the codec, I can not even follow the readme,
I use node-red in Docker,
Can you help me please

From my perspective it was easy, because I already had the npm package installed on the host.
First I have downloaded the adeunis codec:


Then extracted it:

tar xvzf adeunis-codecs-1.0.0.tgz

Change directory to the extracted codec source:

cd package/

As per run npm install, which installed the depedencies:

npm install

After completion of install, tested the codec operation:

bin/codec decode --json 43400100F40200F1

Result is a json formatted output of the codec operation:

{“type”:“0x43 Temperature data”,“frame_counter”:2,“hardware_error”:false,“low_battery”:false,“configuration_done”:false,“ambient_probe_alarm”:false,“remote_probe_alarm”:false,“ambient_probe_id”:0,“ambient_temperature_celsius_degrees”:24.4,“remote_probe_id”:0,“remote_temperature_celsius_degrees”:24.1}

Hope this helps.

I am quite happy about this solution :slight_smile:
Could you help me with one more thing:
I only would like the Adeunis Decoder to process the Raw Payload:

I dont know how to extract the single fields of the msg.payload recieved from the TTN Input.
Probably i have to use a function to convert the 11 Bytes Buffer to a string, that then is the input for the function ?

Any help also tutorials or documentation will be great.

Thank you a lot!

it works ,
Thank you a lot for your help

In order to process the bytes, you can either use ttn or node-red to perform this task.
I’ll describe you the ttn way.
On ttn console, under Application -> [App name] -> Payload Formats add a custom payload decoder. This will convert hex bytes to a string containing the hex values.

function Decoder(bytes, port) {
var result = “”;
for (var i = 0; i < bytes.length; i++) {
if (bytes[i] < 16) {
result += “0” + bytes[i].toString(16);
} else {
result += bytes[i].toString(16);
return {
payload: result,
Then on the node-red side you connect the ttn-uplink node and you filter on payload Field, as seen on the picture.


Hope this helps.

Thank you a lot for your solution Tamas,

i was working on in for a very long time now and i cant get it working.
Either way i allways receive a buffer instead of a string.

First i tried to use a change node and set the msg.payload to $string(payload.payload.raw)
As a result i receive the Buffer as a String. Using another Change not i replaced every “,” with “” and every 0 with 00. This is a very dirty solution.

Then i tried your solution and changed the decoder in TTN. Doing this i also only receive the buffer and cant use it as an input for the Adeunis Decoder Node.2019-08-07%2014_21_20-Node-RED 2019-08-07%2014_21_46-Node-RED

I would really like to use a method that uses a node to extract the raw payload and converts it into a string, that i can paste into the adeunis decoder.

Probably this is a basic problem , but i am happy for any hint.

Thank you

Would you mind to share the TTN decoder you are using?

Hi, I am using the decoder you provided in the last post. That is why I am a little confused.

Hi Simon,

Well it works for me… :slight_smile:
Can you please add me as a collaborator to your TTN account, so I can drop an eye on it. Would ease helping to resolve your problem.
Regards, Tamas

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