Hi, I have probably made a newbie mistake, but I am struggling to understand what is going on here.
I have a node connected to a TTN gateway, and uplink data is appearing in my application OK, but “fields” shows no values. My decoder is copied below. I should see the .t, .h values showing up in the data window, right? No data is making it to the server, and I am trying to trace the reason for that.
Decoder function:
function Decoder(bytes, port) {
var decoded = {};
// check ports and convert payload data
if (port == 1)
{
decoded.length = bytes.length;
if (bytes.length == 7) // fw v1-3
{
decoded.t = bytes[0];
decoded.h = bytes[1];
decoded.w_v = bytes[2];
decoded.t_i = bytes[3];
decoded.a_i = bytes[4];
decoded.bv = bytes[5];
decoded.s_tot = bytes[6];
decoded.long = false;
}
}
return decoded;
}
Testing the function only gives the response {} - that doesn’t seem right.
By adding a console print to the decode function I can see that the variables in the structure do hold the values, but then what happens to it… I don’t know!
Please help!!