"Fields" not being populated by decoder?

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.

image

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!!

OK problem found, the “converter” script had some condition which was not met, so there was no output.

1 Like

Note that in V3, which is due somewhere this year, Converter and Validator will be dropped. So you might want to add whatever code is there to the Decoder while you’re still developing that.

1 Like