Decoding node messages in ttn backend

(Toomany Secrets) #21

Ok this is the test with a real sensor.

The data im sending to ttn is this 000A34 this is Temperature: 26.12

Can anyone help me decode it in ttn backend ?

This code is what i am using.


use the following Payload Function to decode it in console:

function Decoder(bytes) {
var temp = (((bytes[1] << 8) | bytes[2])/100 ).toFixed(2);
return {
Temp : (temp),

(Toomany Secrets) #23

Thx man. Worked perfectly. If you have time can you explain the code so i know how to do it myself in the future.


search for "payload function" in forum, there is for example: which even has a nice youtube video explaining exactly what you need : decoding payload

(Arjan) #25

That won't work for negative values.

See Is there any documentation on payload functions? for some references.

(Toomany Secrets) #26

How would i make this work for negative values?
Anyone can help out with code?

(Arjan) #27

Well, I just gave you a link which you don't seem to have clicked, and it is also explained in the first link in the answer before mine.

(Toomany Secrets) #28

I did click it, but i have no idea on were to start. I never worked around with javascript. Im asking for the code outright if anyone can help.

I managed to do the arduino code but is is just way over me. Im just looking to set up some sensors at my weekend house and lake.

(Nidaros) #29

add +100 to your value in the arduino script and -100 in your decoder. Should do, unless you want to monitor hotter things lol