Adeunis FTD TTNMAPPER java script

Hi,

I migrated my gateway TTIG and the adeunis FTP from v2 to v3 and I’m able to see the live data from the FTD.

I setup the app with the java script (not from me designed) from

adapted to V3 prerequisites for sending data to TTNmapper as I did in v2:


// TTN decoder function for the Adeunis Field Test Device LoRaWAN
// Test IoT network coverage: Sigfox, LoRaWAN | Adeunis


function decodeUplink(input,port) {
  var data = {};
  
  
  var offset = 0;
  if (offset + 1 <= input.bytes.length) {
    var status = input.bytes[offset++]; // bitmask indicating the presence of the other fields
    if (status & 0x80 && offset + 1 < input.bytes.length) {
      // Temperature information (degree Celsius)
      var temperature = input.bytes[offset];
      if (temperature > 127) {
        temperature = temperature - 256;
      }
      data.temperature = temperature;
      offset += 1;
    }
    if (status & 0x40) {
      // Transmission triggered by the accelerometer
      data.trigger = "accelerometer";
    }
    if (status & 0x20) {
      // Transmission triggered by pressing the pushbutton
      data.trigger = "pushbutton";
    }
    if (status & 0x10 && offset + 9 <= input.bytes.length) {
      // GPS information
      var latDeg10   = input.bytes[offset] >> 4;
      var latDeg1    = input.bytes[offset] & 0x0f;
      var latMin10   = input.bytes[offset + 1] >> 4;
      var latMin1    = input.bytes[offset + 1] & 0x0f;
      var latMin01   = input.bytes[offset + 2] >> 4;
      var latMin001  = input.bytes[offset + 2] & 0x0f;
      var latMin0001 = input.bytes[offset + 3] >> 4;
      var latSign    = input.bytes[offset + 3] & 0x01 ? -1 : 1;
      data.latitude = latSign * (latDeg10 * 10 + latDeg1 + (latMin10 * 10 + latMin1 + latMin01 * 0.1 + latMin001 * 0.01 + latMin0001 * 0.001) / 60);
      var lonDeg100 = input.bytes[offset + 4] >> 4;
      var lonDeg10  = input.bytes[offset + 4] & 0x0f;
      var lonDeg1   = input.bytes[offset + 5] >> 4;
      var lonMin10  = input.bytes[offset + 5] & 0x0f;
      var lonMin1   = input.bytes[offset + 6] >> 4;
      var lonMin01  = input.bytes[offset + 6] & 0x0f;
      var lonMin001 = input.bytes[offset + 7] >> 4;
      var lonSign   = input.bytes[offset + 7] & 0x01 ? -1 : 1;
      data.longitude = lonSign * (lonDeg100 * 100 + lonDeg10 * 10 + lonDeg1 + (lonMin10 * 10 + lonMin1 + lonMin01 * 0.1 + lonMin001 * 0.01) / 60);
      data.altitude = 0; // altitude information not available
      data.sats = input.bytes[offset + 8] & 0x0f; // number of satellites
      offset += 9;
    }
    if (status & 0x08 && offset + 1 <= input.bytes.length) {
      // Uplink frame counter
      data.uplink = input.bytes[offset];
      offset += 1;
    }
    if (status & 0x04 && offset + 1 <= input.bytes.length) {
      // Downlink frame counter
      data.downlink = input.bytes[offset];
      offset += 1;
    }
    if (status & 0x02 && offset + 2 <= input.bytes.length) {
      // Battery level information (mV)
      data.battery = input.bytes[offset] << 8 | input.bytes[offset + 1];
      offset += 2;
    }
    if (status & 0x01 && offset + 2 <= input.bytes.length) {
      // RSSI (dBm) and SNR (dB) information
      data.rssi = - input.bytes[offset];
      var snr = input.bytes[offset + 1];
      if (snr > 127) {
        snr = snr - 256;
      }
      data.snr = snr;
      offset += 2;
    }
  }
 return {
    data: data
  };
    
}
*************

I see then in live data the decoded payload but it is not forwarded to the webkooks.

Error msg: Failed to send to webhook, Error:undefined, undefined.

Any idea or help?Thx for any help in advance.

br AW
image

Given the Rolls Royce / premium price of the product, it would seem unusual for Adeunis not to have released an updated JS formatter along with instructions.

But now you’ve got the formatter working (which I formatted as per guidelines) it would be good to see what you have setup for your webhook - as a minimum you need to give it a working URL (ie one that works in a web browser) and click a tick against at least one of the message types.

I’ve seen only one other instance of triggering an error with a Webhook - it may be the destination server is having issues.

I just update the ADEUNIS JS formater from the version from V2. They don’t offer a new one for v3, or I was unable to found it.

Here the settings of the TTNMAP webhook.

Thx aw

image
image

Hi, I added to the TTNMAPPER webhook header and name for an experiment and now it works even when the error msg ‘failed to send to webhook, Error:undefined,undefined’ is still there in the live data. Br, AW

Not relevant to the topic and a double post - please don’t.