Decoder library

For your uplinks to appear on the map, GPS coordinates must be present as latitude / longitude in the decoded payload. Here you find ready-made payload formatters to paste into the TTS Console: End Devices → [Device] → Payload formatters → Uplink → Custom Javascript.

Dragino LGT-92 (GPS-Tracker)

Classic asset-tracking device. Payload contains position, altitude, battery and acceleration.
function decodeUplink(input) {
 var b = input.bytes;
 var data = {};

 // Lat / Lon (signed int32, /1e6)
 var lat = (b[0]<<24) | (b[1]<<16) | (b[2]<<8) | b[3];
 if (lat & 0x80000000) lat -= 0x100000000;
 var lon = (b[4]<<24) | (b[5]<<16) | (b[6]<<8) | b[7];
 if (lon & 0x80000000) lon -= 0x100000000;
 data.latitude = lat / 1e6;
 data.longitude = lon / 1e6;

 // Battery (10-bit, in volt)
 data.battery = (((b[8] & 0x3F) << 8) | b[9]) / 1000;
 data.alarm = (b[8] & 0x40) ? true : false;

 // Optional: roll / pitch / hdop / altitude (only when GPS valid & full payload)
 if (b.length >= 11) {
 data.motion = ["Disable","Move","Collide","User"][(b[10] >> 6) & 0x03];
 }
 if (b.length >= 19) {
 var roll = (b[11]<<8) | b[12]; if (roll & 0x8000) roll -= 0x10000;
 var pitch = (b[13]<<8) | b[14]; if (pitch & 0x8000) pitch -= 0x10000;
 var alt = (b[17]<<8) | b[18]; if (alt & 0x8000) alt -= 0x10000;
 data.roll = roll / 100;
 data.pitch = pitch / 100;
 data.altitude = alt;
 data.hdop = ((b[15]<<8) | b[16]) / 100;
 }
 return { data: data };
}

Dragino LHT65 (Temperatur & Luftfeuchte)

Classic indoor/outdoor sensor with built-in SHT sensor plus optional external port. Outputs TempC_SHT and Hum_SHT — automatically recognised by the server.
// Dragino LHT65 — Temperatur + Feuchte (intern) plus externer Sensor.
// Standard-FPort: 2. 11 Byte Payload.

function decodeUplink(input) {
  var b = input.bytes;
  if (b.length < 7) return { data: {} };

  // Battery (14-bit) + status (2-bit)
  var batValue   = ((b[0] & 0x3F) << 8) | b[1];
  var batV       = batValue / 1000;
  var batStatus  = (b[0] >> 6) & 0x03;
  var batLabel   = ["Ultra Low","Low","OK","Good"][batStatus];

  // Internal SHT temperature (int16 / 100)
  var t   = (b[2] << 8) | b[3];
  if (t & 0x8000) t -= 0x10000;
  var TempC_SHT = t / 100;

  // Internal humidity (uint16 / 10)
  var Hum_SHT = (((b[4] << 8) | b[5])) / 10;

  // External sensor type
  var extId    = b[6] & 0x7F;
  var extLabel = {
    1: "Temperature Sensor", 4: "Interrupt Sensor", 5: "ADC + Interrupt",
    6: "Temp DS18B20 + Counter", 7: "Counter", 8: "Liquid Level",
    9: "Temperature + Counter"
  }[extId] || "Unknown";

  var data = {
    BatV:       batV,
    Bat_status: batStatus,
    Bat_label:  batLabel,
    TempC_SHT:  TempC_SHT,
    Hum_SHT:    Hum_SHT,
    Ext:        extId,
    Ext_sensor: extLabel,
  };

  // External temperature (DS18B20) if ext = 1 or 6 or 9
  if (extId === 1 || extId === 6 || extId === 9) {
    var ext = (b[7] << 8) | b[8];
    if (ext & 0x8000) ext -= 0x10000;
    var TempC_DS = ext / 100;
    if (TempC_DS !== 327.67) data.TempC_DS = TempC_DS; // 327.67 = "no sensor"
  }

  // Canonical aliases — so the Coverage-Map kann nach Temperatur /
  // Luftfeuchte färben ohne weitere Konfiguration.
  data.temperature = TempC_SHT;
  data.humidity    = Hum_SHT;
  data.battery     = batV;

  return { data: data };
}

If your existing formatter already outputs TempC_SHT and Hum_SHT, you don't need to change anything — the server recognises these keys automatically and colours the map accordingly.

RAK7200 / RAK7201 (WisTrio Tracker)

RAK Wireless tracker with GPS, accelerometer & magnetometer. Sends Cayenne-LPP (see below) — you can also use the Cayenne decoder.
// Vereinfachter Decoder für RAK7200 GPS-Frames (FPort 8)
function decodeUplink(input) {
 var b = input.bytes;
 if (input.fPort !== 8 || b.length < 11) return { data: {} };

 var data = {};
 data.gps_valid = (b[0] === 0x09);

 var lat = (b[1]<<24) | (b[2]<<16) | (b[3]<<8) | b[4];
 if (lat & 0x80000000) lat -= 0x100000000;
 var lon = (b[5]<<24) | (b[6]<<16) | (b[7]<<8) | b[8];
 if (lon & 0x80000000) lon -= 0x100000000;

 data.latitude = lat / 1e4 / 100; // RAK uses 0.0001 deg per LSB
 data.longitude = lon / 1e4 / 100;

 // Speed (km/h) and direction (deg)
 if (b.length >= 13) {
 data.speed = (b[9]<<8 | b[10]) / 100;
 data.heading = (b[11]<<8 | b[12]) / 100;
 }
 return { data: data };
}

Seeed SenseCAP T1000 (Asset-Tracker)

Compact multi-mode tracker (GPS + WiFi + BLE). Payload is TLV-based. Works for the LoRaWAN variants T1000-A / T1000-B / T1000-C. The T1000-E is a Meshtastic device and does not send via TTN.
// Seeed SenseCAP T1000 — vereinfachter Decoder.
// Extrahiert GPS-Position, Batterie, Temperatur und Motion-Status.
// Für vollständige Sensor-Decoder siehe
// https://github.com/Seeed-Solution/SenseCAP-Decoder

function decodeUplink(input) {
 var b = input.bytes;
 var data = {};
 if (b.length < 1) return { data: data };

 // Frame-Header: erstes Byte enthält Event-Mask & Power-Type
 var header = b[0];
 data.battery_event = !!(header & 0x80);
 data.motion = !!(header & 0x40);

 // Ab Byte 1: aneinandergereihte TLV-Blöcke [type(1)][value(varlen)]
 var i = 1;
 function s16(o) { var v=(b[o]<<8)|b[o+1]; return v&0x8000 ? v-0x10000 : v; }
 function s32(o) {
 var v = (b[o]<<24)|(b[o+1]<<16)|(b[o+2]<<8)|b[o+3];
 return v >> 0; // signed in JS
 }

 while (i < b.length) {
 var t = b[i++];
 switch (t) {
 case 0x01: { // GPS: lat(4) + lon(4) + acc(1)
 if (i + 9 > b.length) return { data: data };
 data.latitude = s32(i) / 1e7;
 data.longitude = s32(i + 4) / 1e7;
 data.accuracy = b[i + 8];
 i += 9; break;
 }
 case 0x02: { // WiFi MAC list (3-4 BSSIDs à 6+1 Byte) — skip
 var count = b[i++];
 i += count * 7;
 break;
 }
 case 0x03: { // BLE MAC list
 var n = b[i++];
 i += n * 7;
 break;
 }
 case 0x04: { // Battery in %
 data.battery = b[i++]; break;
 }
 case 0x05: { // Temperature × 10 (signed int16)
 data.temperature = s16(i) / 10; i += 2; break;
 }
 case 0x06: { // Humidity × 10 (uint16)
 data.humidity = ((b[i]<<8) | b[i+1]) / 10; i += 2; break;
 }
 case 0x07: { // Light (uint16)
 data.light = (b[i]<<8) | b[i+1]; i += 2; break;
 }
 case 0x08: { // Air pressure / 10
 data.pressure = ((b[i]<<8) | b[i+1]) / 10; i += 2; break;
 }
 default: return { data: data, warnings: ["unknown TLV 0x" + t.toString(16) + " at " + (i-1)] };
 }
 }
 return { data: data };
}

Switch the tracker to Plain LoRaWAN mode in the SenseCAP app (not "SenseCAP Cloud"), otherwise uplinks won't reach your TTS app.

Seeed SenseCAP T2000 (Asset-Tracker)

Industrial asset tracker (T1000 successor) with GNSS, WiFi and BLE positioning. Payload is a multi-frame TLV format with its own frame IDs instead of a fixed byte layout.
// Seeed SenseCAP T2000 (Asset-Tracker A/B/C) — vereinfachter Decoder.
// Deckt die GPS-tragenden Frame-Typen ab: 0x2E (periodischer Location-Report)
// und 0x2B (Motion+Location). Reine Settings-/Heartbeat-Frames (0x27, 0x2A,
// 0x31, 0x32) liefern nur Batterie. WiFi/BLE-Scan-Frames (0x2C/0x2D/0x2F/0x30)
// haben variable Länge und keine direkten Koordinaten (brauchen einen
// externen Geolocation-Service) — werden übersprungen. Vollständiger
// offizieller Decoder (alle Frame-Typen inkl. Settings, Firmware-Version):
// https://github.com/TheThingsNetwork/lorawan-devices/blob/master/vendor/sensecap/sensecapt2000-tracker-abc-decoder.js

function decodeUplink(input) {
 var b = input.bytes;
 var data = {};
 var i = 0;

 function u32(o) { return ((b[o]<<24)|(b[o+1]<<16)|(b[o+2]<<8)|b[o+3]) >>> 0; }
 function s32(o) { return u32(o) | 0; } // reinterpret as two's complement

 while (i < b.length) {
 var id = b[i];
 if (id === 0x0c) {
 i += 1; // Time-Sync-Ping, kein Payload
 } else if (id === 0x0d && i + 5 <= b.length) {
 i += 5; // GNSS-Fehlercode, keine Position
 } else if (id === 0x2e && i + 17 <= b.length) {
 // Event(2) MotionId(1) Timestamp(4) Lon(4) Lat(4) Battery(1)
 data.timestamp = u32(i + 4) * 1000;
 data.longitude = s32(i + 8) / 1e6;
 data.latitude = s32(i + 12) / 1e6;
 data.battery = b[i + 16];
 i += 17;
 } else if (id === 0x2b && i + 23 <= b.length) {
 // Event(2) MotionId(1) Timestamp(4) Accel-xyz(6) Lon(4) Lat(4) Battery(1)
 data.timestamp = u32(i + 4) * 1000;
 data.longitude = s32(i + 14) / 1e6;
 data.latitude = s32(i + 18) / 1e6;
 data.battery = b[i + 22];
 i += 23;
 } else if (id === 0x27 && i + 46 <= b.length) {
 data.battery = b[i + 1]; // Registrierungs-/Settings-Frame, keine GPS-Daten
 i += 46;
 } else if (id === 0x2a && i + 6 <= b.length) {
 data.battery = b[i + 1];
 i += 6;
 } else if (id === 0x31 && i + 15 <= b.length) {
 data.battery = b[i + 14];
 i += 15;
 } else if (id === 0x32 && i + 9 <= b.length) {
 data.battery = b[i + 8];
 i += 9;
 } else {
 break; // WiFi/BLE-Scan oder unbekannter Frame-Typ
 }
 }
 return { data: data };
}

Only covers the two GPS-bearing frame types (0x2E periodic, 0x2B on motion). WiFi/BLE scan frames have no direct coordinates (need an external geolocation service) and are skipped — see the link in the code comment for the full official decoder.

RAK7200 v2 (WisTrio Tracker, neue Firmware)

The new firmware sends an extended frame with GPS, acceleration, temperature and battery. Default FPort: 8.
// RAK7200 v2 — neuer Frame mit GPS + Temp + Bat (FPort 8).
function decodeUplink(input) {
  var b = input.bytes;
  if (input.fPort !== 8 || b.length < 11) return { data: {} };

  var data = { gps_valid: (b[0] === 0x09) };

  // Lat / Lon — int32, /1e7 (neue Firmware)
  var lat = (b[1]<<24) | (b[2]<<16) | (b[3]<<8) | b[4];
  if (lat & 0x80000000) lat -= 0x100000000;
  var lon = (b[5]<<24) | (b[6]<<16) | (b[7]<<8) | b[8];
  if (lon & 0x80000000) lon -= 0x100000000;
  data.latitude  = lat / 1e7;
  data.longitude = lon / 1e7;

  // Battery (uint16 mV)
  if (b.length >= 11) data.battery = ((b[9]<<8) | b[10]) / 1000;

  // Optional: temperature (int16 / 10) + accelerometer
  if (b.length >= 13) {
    var t = (b[11]<<8) | b[12];
    if (t & 0x8000) t -= 0x10000;
    data.temperature = t / 10;
  }
  return { data: data };
}

Browan TBHV110 (Healthy Home Sensor)

Indoor sensor with temperature, humidity, VOC, light and motion counter. No GPS — position comes from the receiving gateways.
// Browan TBHV110 (Healthy Home Sensor).
// Payload: 10 byte fix. FPort: 103.
function decodeUplink(input) {
  var b = input.bytes;
  if (b.length < 10) return { data: {} };

  // Byte 0: status — Bit 0..3 base-ID, Bit 4..7 battery (×0.1V + 1.8)
  var batRaw = (b[0] >> 4) & 0x0F;
  var batV   = 1.8 + batRaw * 0.1;

  // Byte 1..2: temperature, signed int16 / 10
  var t = (b[1]<<8) | b[2];
  if (t & 0x8000) t -= 0x10000;

  // Byte 3: humidity 0..100 %
  var hum = b[3];

  // Byte 4..5: VOC index (uint16)
  var voc = (b[4]<<8) | b[5];

  // Byte 6..7: IAQ index (uint16)
  var iaq = (b[6]<<8) | b[7];

  // Byte 8..9: light / brightness lux (uint16)
  var light = (b[8]<<8) | b[9];

  return {
    data: {
      battery:     batV,
      temperature: t / 10,
      humidity:    hum,
      voc:         voc,
      iaq:         iaq,
      light:       light,
    },
  };
}

Adeunis Field Test Device (FTD)

Classic coverage-measurement tool. Sends status, temperature and GPS position (BCD-encoded). FPort 1 or 2.
// Adeunis FTD (Field Test Device).
// Status byte am Anfang sagt, welche Felder folgen.
function decodeUplink(input) {
  var b = input.bytes;
  if (b.length < 1) return { data: {} };
  var status = b[0];
  var i = 1;
  var data = {
    has_temp: !!(status & 0x80),
    has_gps:  !!(status & 0x40),
    trigger_acc:    !!(status & 0x20),
    trigger_push:   !!(status & 0x10),
    has_uplink_cnt: !!(status & 0x08),
    has_downlink_cnt: !!(status & 0x04),
    has_battery:    !!(status & 0x02),
    has_rssi_snr:   !!(status & 0x01),
  };

  if (data.has_temp && i < b.length) {
    var t = b[i++];
    if (t & 0x80) t -= 0x100;
    data.temperature = t;
  }

  if (data.has_gps && i + 8 <= b.length) {
    // Lat / Lon in BCD: ddmmmmmmh (degrees, decimal-minutes ×1e4, hemisphere)
    function bcd(o, len) {
      var s = "";
      for (var k = 0; k < len; k++) {
        s += ((b[o + k] >> 4) & 0x0F).toString() + (b[o + k] & 0x0F).toString();
      }
      return s;
    }
    var latStr = bcd(i, 4);
    var lonStr = bcd(i + 4, 4);
    // Format: DDMMmmmmH — degrees + minutes.fraction + N/S, E/W hemisphere
    var latDeg = parseInt(latStr.substr(0, 2), 10);
    var latMin = parseFloat(latStr.substr(2, 2) + "." + latStr.substr(4, 4));
    var latHem = latStr.substr(8, 1) === "0" ? 1 : -1; // 0=N, 1=S
    var lonDeg = parseInt(lonStr.substr(0, 3), 10);
    var lonMin = parseFloat(lonStr.substr(3, 2) + "." + lonStr.substr(5, 3));
    var lonHem = lonStr.substr(8, 1) === "0" ? 1 : -1; // 0=E, 1=W
    data.latitude  = latHem * (latDeg + latMin / 60);
    data.longitude = lonHem * (lonDeg + lonMin / 60);
    i += 8;
    if (i < b.length) data.gps_quality = b[i++];
  }

  if (data.has_uplink_cnt && i < b.length)   data.uplink_count   = b[i++];
  if (data.has_downlink_cnt && i < b.length) data.downlink_count = b[i++];
  if (data.has_battery && i + 2 <= b.length) {
    data.battery = ((b[i]<<8) | b[i + 1]) / 1000;
    i += 2;
  }
  if (data.has_rssi_snr && i + 2 <= b.length) {
    data.rssi = -b[i]; data.snr = b[i + 1];
    if (data.snr & 0x80) data.snr -= 0x100;
    i += 2;
  }
  return { data: data };
}

Adeunis FTD also works without GPS fix (status-only frames). These won't appear on the map — that's expected.

ELSYS (ERS / EMS / ELT generisch)

ELSYS sensors use TLV format. Decoder recognises temperature, humidity, light, motion, CO₂, battery and GPS.
// ELSYS generic — TLV-Decoder für ERS, ELT, EMS Familie.
function decodeUplink(input) {
  var b = input.bytes, i = 0, data = {};
  function u16(o) { return (b[o]<<8) | b[o + 1]; }
  function s16(o) { var v = u16(o); return v & 0x8000 ? v - 0x10000 : v; }
  function u32(o) {
    return (b[o]<<24 >>> 0) + (b[o + 1]<<16) + (b[o + 2]<<8) + b[o + 3];
  }

  while (i < b.length) {
    var t = b[i++];
    switch (t) {
      case 0x01: data.temperature = s16(i) / 10;        i += 2; break; // °C
      case 0x02: data.humidity    = b[i++];                     break; // %
      case 0x03: { // accelerometer: x, y, z (int8)
        var x = b[i] & 0x80 ? b[i] - 256 : b[i];
        var y = b[i + 1] & 0x80 ? b[i + 1] - 256 : b[i + 1];
        var z = b[i + 2] & 0x80 ? b[i + 2] - 256 : b[i + 2];
        data.accel = { x: x, y: y, z: z }; i += 3; break;
      }
      case 0x04: data.light       = u16(i);             i += 2; break; // lux
      case 0x05: data.motion      = b[i++];                     break; // PIR count
      case 0x06: data.co2         = u16(i);             i += 2; break; // ppm
      case 0x07: data.battery     = u16(i) / 1000;      i += 2; break; // V
      case 0x08: data.analog1     = u16(i);             i += 2; break;
      case 0x09: { // GPS: lat int32 / 10000, lon int32 / 10000
        var lat = u32(i); if (lat & 0x80000000) lat -= 0x100000000;
        var lon = u32(i + 4); if (lon & 0x80000000) lon -= 0x100000000;
        data.latitude  = lat / 10000;
        data.longitude = lon / 10000;
        i += 8; break;
      }
      case 0x0A: data.pulse1      = u16(i);             i += 2; break;
      case 0x0B: data.pulse1_abs  = u32(i);             i += 4; break;
      case 0x0E: data.temp_ext    = s16(i) / 10;        i += 2; break;
      case 0x0F: data.occupancy   = b[i++];                     break;
      case 0x14: data.pressure    = u32(i) / 1000;      i += 4; break; // hPa
      default:
        return {
          data: data,
          warnings: ["unknown ELSYS type 0x" + t.toString(16)],
        };
    }
  }
  return { data: data };
}

Dragino TrackerD / TrackerD-LS (GPS-Tracker)

Successor of the LGT-92 with GPS, WiFi, BLE, temperature/humidity and an alarm button — the TrackerD-LS adds a solar panel. The decoder handles both the classic payload layout and the extended one of newer firmware.
// Dragino TrackerD / TrackerD-LS (successor of the LGT-92).
// FPort 2 = GNSS + temperature/humidity, FPort 3 = GNSS only (default),
// FPort 5 = device status, FPort 7 = alarm. Handles both the classic layout
// (11 / 15 bytes) and the extended one of firmware 1.5.4 / LS 1.0.5 and newer
// (speed + course inserted after the position, 19 / 23 bytes).
// FPort 4 (stored history fixes) is reported as history_latitude /
// history_longitude on purpose: the device was somewhere else when it took
// that fix, so it must not end up on a coverage map.

function decodeUplink(input) {
  var b = input.bytes;
  var p = input.fPort;
  var data = {};

  function s32(o) { return (b[o] << 24) | (b[o + 1] << 16) | (b[o + 2] << 8) | b[o + 3]; }
  function u16(o) { return (b[o] << 8) | b[o + 1]; }
  function s16(o) { var v = u16(o); return v & 0x8000 ? v - 0x10000 : v; }
  function battery(o) {
    data.battery = (u16(o) & 0x3FFF) / 1000; // volt
    data.alarm = !!(b[o] & 0x40);
  }
  // No fix: 0 / 0 after a GPS timeout, 0x0FFFFFFF (268.4) on low battery.
  function hasFix(lat, lon) {
    return (lat !== 0 || lon !== 0) && Math.abs(lat) <= 90 && Math.abs(lon) <= 180;
  }

  if ((p === 2 || p === 3) && b.length >= 11) {
    var lat = s32(0) / 1e6;
    var lon = s32(4) / 1e6;
    if (hasFix(lat, lon)) {
      data.latitude = lat;
      data.longitude = lon;
    }
    if (b.length >= 19) {
      battery(16);
      data.motion = !!(b[18] & 0x10);
      if (p === 2 && b.length >= 23 && !(b[18] & 0x08)) {
        data.humidity = u16(19) / 10;
        data.temperature = s16(21) / 10;
      }
    } else {
      battery(8);
      data.motion = !!(b[10] & 0x10);
      if (p === 2 && b.length >= 15) {
        data.humidity = u16(11) / 10;
        data.temperature = s16(13) / 10;
      }
    }
  } else if (p === 4 && b.length >= 15) {
    var hlat = s32(0) / 1e6;
    var hlon = s32(4) / 1e6;
    if (hasFix(hlat, hlon)) {
      data.history_latitude = hlat;
      data.history_longitude = hlon;
    }
  } else if (p === 5 && b.length >= 7) {
    data.model = b[0] === 0x13 ? "TrackerD" : "TrackerD-LS";
    data.firmware = (b[1] & 0x0F) + "." + (b[2] >> 4) + "." + (b[2] & 0x0F);
    data.battery = u16(5) / 1000;
  } else if (p === 7 && b.length >= 2) {
    battery(0);
  }
  return { data: data };
}

The server recognises the standard uplinks (FPort 2 and 3) even without a formatter. Stored history fixes (FPort 4) are deliberately kept off the map — the device was somewhere else when it took the fix.

LilyGO T-Beam (TTN-Mapper-Firmware)

The classic DIY mapper: LilyGO/TTGO T-Beam running a TTN mapper firmware. Covers the 10-byte format of kizniche/ttgo-tbeam-ttn-tracker (and its forks) and the 11-byte format of the Max-Plastix mapper.
// LilyGO / TTGO T-Beam with a TTN-mapper firmware.
//  - kizniche/ttgo-tbeam-ttn-tracker and forks: 10 bytes (default FPort 10)
//      lat(3) lon(3) altitude(2) hdop*10(1) sats(1)
//  - Max-Plastix/tbeam-helium-mapper: FPort 2, 11 bytes
//      lat(3) lon(3) altitude(2) speed(1) battery(1) sats(1)
//    (FPort 5 = status, FPort 6 = GPS lost: last known position only)
// Latitude / longitude are 24-bit values scaled over the full +-90 / +-180
// range. Both firmwares only transmit a position once they have a fix.

function decodeUplink(input) {
  var b = input.bytes;
  var p = input.fPort;
  var data = {};
  if (b.length < 10) return { data: data };

  var lat = ((b[0] << 16) | (b[1] << 8) | b[2]) / 16777215 * 180 - 90;
  var lon = ((b[3] << 16) | (b[4] << 8) | b[5]) / 16777215 * 360 - 180;
  function altitude() {
    var a = (b[6] << 8) | b[7];
    return a & 0x8000 ? a - 0x10000 : a;
  }

  if (b.length === 11 && (p === 5 || p === 6)) {
    // Max-Plastix status / "GPS lost" frame: no current position
    data.battery = b[6] / 100 + 2;
    data.gps_lost = p === 6;
  } else if (b.length === 11) {
    // Max-Plastix mapper frame
    data.latitude = lat;
    data.longitude = lon;
    data.altitude = altitude();
    data.speed = b[8]; // km/h
    data.battery = b[9] / 100 + 2; // volt
    data.sats = b[10];
  } else if (b.length === 10) {
    // kizniche frame
    data.altitude = altitude();
    data.hdop = b[8] / 10;
    data.sats = b[9];
    if (data.sats > 0) {
      data.latitude = lat;
      data.longitude = lon;
    }
  }
  return { data: data };
}

The server recognises the kizniche format on its default FPort 10 even without a formatter. For the Max-Plastix firmware (FPort 2) the formatter is required — on the server that format cannot be told apart safely from other sensors.

RAK10701 Field Tester

Ready-made field tester for coverage surveys (RAK10701-L / -P / -Plus). Sends position, altitude, HDOP and satellite count on FPort 1; the disk91 Wio field tester uses the same format.
// RAK10701 Field Tester (L / P / Plus) - also valid for the disk91
// "Wio LoRaWAN Field Tester", which defined this frame format.
// FPort 1, 10 bytes: packed position(6) altitude+1000(2) hdop*10(1) sats(1).
// Position decoding adapted from the official RAKwireless decoder
// (MIT licence, Copyright (c) RAKwireless):
// https://github.com/RAKWireless/RAKwireless_Standardized_Payload
// Like the official decoder, a position is only reported with HDOP < 2 and
// at least 5 satellites. Without a fix the frame is all zero.

function decodeUplink(input) {
  var b = input.bytes;
  var data = {};
  if (input.fPort !== 1 || b.length < 10) return { data: data };

  var lonSign = (b[0] >> 7) & 0x01 ? -1 : 1;
  var latSign = (b[0] >> 6) & 0x01 ? -1 : 1;
  var encLat = ((b[0] & 0x3f) << 17) + (b[1] << 9) + (b[2] << 1) + (b[3] >> 7);
  var encLon = ((b[3] & 0x7f) << 16) + (b[4] << 8) + b[5];

  data.hdop = b[8] / 10;
  data.sats = b[9];
  if (data.hdop > 0 && data.hdop < 2 && data.sats >= 5) {
    data.latitude = latSign * (encLat * 108 + 53) / 10000000;
    data.longitude = lonSign * (encLon * 215 + 107) / 10000000;
    data.altitude = ((b[6] << 8) + b[7]) - 1000;
    data.accuracy = (data.hdop * 5 + 5) / 10;
  }
  return { data: data };
}

Like the official decoder, the position is only reported for a good fix (HDOP < 2 and at least 5 satellites). The server recognises this format even without a formatter.

ELV-LW-GPS1 (LoRaWAN GPS Tracker 1)

GPS tracker by ELV for vehicles (5–40 V supply). Sends position, altitude, HDOP, supply voltage and the reason for transmission on FPort 10.
// ELV-LW-GPS1 (LoRaWAN GPS Tracker 1). FPort 10.
// Header: [0] header length, [1] TX reason (low nibble), [2..3] supply
// voltage in mV. Data blocks start at index header length + 1:
//   0x01 position: lat(4) lon(4) altitude(4) hdop(2), little-endian
//   0x02 input state (1)

function decodeUplink(input) {
  var b = input.bytes;
  var data = {};
  if (input.fPort !== 10 || b.length < 4) return { data: data };

  var reasons = ["reserved", "timer", "button", "gnss_timeout", "heartbeat",
    "input_one_shot", "input_cyclic", "motion_start", "motion_cyclic", "motion_stop"];
  data.tx_reason = reasons[b[1] & 0x0F] || "unknown";
  data.battery = ((b[2] << 8) | b[3]) / 1000; // supply voltage in volt

  function s32le(o) { return b[o] | (b[o + 1] << 8) | (b[o + 2] << 16) | (b[o + 3] << 24); }

  var i = b[0] + 1;
  while (i < b.length) {
    var t = b[i++];
    if (t === 0x01 && i + 14 <= b.length) {
      var lat = s32le(i) / 1e6;
      var lon = s32le(i + 4) / 1e6;
      if (lat !== 0 || lon !== 0) {
        data.latitude = lat;
        data.longitude = lon;
        data.altitude = s32le(i + 8) / 10000;
        data.hdop = b[i + 12] + b[i + 13] * 4 / 100;
      }
      i += 14;
    } else if (t === 0x02 && i < b.length) {
      data.input = b[i++];
    } else {
      return { data: data, warnings: ["unknown data type 0x" + t.toString(16)] };
    }
  }
  return { data: data };
}

ELV-LW-GPS2 (LoRaWAN GPS Tracker 2)

Battery-powered GPS tracker by ELV. The payload is a sequence of type/value blocks (firmware version, transmit reason, voltage, position) on FPort 10.
// ELV-LW-GPS2 (LoRaWAN GPS Tracker 2). FPort 10.
// Plain sequence of [type][value] blocks:
//   0x01 application version (3)   0x02 bootloader version (3)
//   0x03 TX reason (1)             0x04 supply voltage in mV (2, big-endian)
//   0x0A position: lat(4) lon(4) altitude(4) hdop(2), little-endian

function decodeUplink(input) {
  var b = input.bytes;
  var data = {};
  if (input.fPort !== 10) return { data: data };

  var reasons = ["undefined", "timer", "button", "gnss_timeout", "heartbeat",
    "input_one_shot", "input_cyclic", "motion_start", "motion_cyclic", "motion_stop"];
  function s32le(o) { return b[o] | (b[o + 1] << 8) | (b[o + 2] << 16) | (b[o + 3] << 24); }

  var i = 0;
  while (i < b.length) {
    var t = b[i++];
    if ((t === 0x01 || t === 0x02) && i + 3 <= b.length) {
      var v = "V" + b[i] + "." + b[i + 1] + "." + b[i + 2];
      if (t === 0x01) data.app_version = v; else data.bl_version = v;
      i += 3;
    } else if (t === 0x03 && i < b.length) {
      data.tx_reason = reasons[b[i++]] || "unknown";
    } else if (t === 0x04 && i + 2 <= b.length) {
      data.battery = ((b[i] << 8) | b[i + 1]) / 1000; // supply voltage in volt
      i += 2;
    } else if (t === 0x0A && i + 14 <= b.length) {
      var lat = s32le(i) / 1e6;
      var lon = s32le(i + 4) / 1e6;
      if (lat !== 0 || lon !== 0) {
        data.latitude = lat;
        data.longitude = lon;
        data.altitude = s32le(i + 8) / 10000;
        data.hdop = b[i + 12] + b[i + 13] * 4 / 100;
      }
      i += 14;
    } else {
      return { data: data, warnings: ["unknown data type 0x" + t.toString(16)] };
    }
  }
  return { data: data };
}

Digital Matter Oyster3 / Yabby3

Rugged asset trackers with their own GNSS receiver. The decoder covers the position uplinks on FPort 1, 4, 33 and 37 and also reports battery voltage, speed and trip status.
// Digital Matter Oyster3 / Yabby3 (LoRaWAN, on-board GNSS); FPort 1 and 4
// also match the original Oyster. All values little-endian.
//   FPort 1  GNSS record:        lat(4) lon(4) in 1e-7 deg, flags, speed, battery
//   FPort 4  extended record:    lat(3) lon(3) in 256e-7 deg, ..., flags
//   FPort 33 position + inactivity timer: 23-bit lat, 24-bit lon
//   FPort 37 same position header as FPort 33
// When the "last fix failed" flag is set the frame repeats the previous
// position - it is reported as cached_latitude / cached_longitude only.

function decodeUplink(input) {
  var b = input.bytes;
  var p = input.fPort;
  var data = {};
  var lat, lon, failed;

  function u24le(o) { return b[o] | (b[o + 1] << 8) | (b[o + 2] << 16); }
  function s24le(o) { var v = u24le(o); return v & 0x800000 ? v - 0x1000000 : v; }
  function s32le(o) { return b[o] | (b[o + 1] << 8) | (b[o + 2] << 16) | (b[o + 3] << 24); }

  if (p === 1 && b.length >= 11) {
    lat = s32le(0) / 1e7;
    lon = s32le(4) / 1e7;
    data.in_trip = !!(b[8] & 0x01);
    failed = !!(b[8] & 0x02);
    data.heading = (b[8] >> 2) * 5.625;
    data.speed = b[9]; // km/h
    data.battery = b[10] * 25 / 1000; // volt
  } else if (p === 4 && b.length >= 9) {
    lat = s24le(0) * 256e-7;
    lon = s24le(3) * 256e-7;
    data.heading = (b[6] & 0x07) * 45;
    data.speed = (b[6] >> 3) * 5;
    data.in_trip = !!(b[8] & 0x01);
    failed = !!(b[8] & 0x02);
    data.battery = (b[8] & 0x08 ? 3500 + b[7] * 32 : b[7] * 25) / 1000;
  } else if ((p === 33 || p === 37) && b.length >= 6) {
    failed = !!(b[0] & 0x01);
    var raw = u24le(0) >> 1; // 23 bit, signed
    if (raw & 0x400000) raw -= 0x800000;
    lat = raw * 180 / 8388608;
    lon = s24le(3) * 360 / 16777216;
    if (p === 33 && b.length >= 11) {
      data.in_trip = !!(b[6] & 0x01);
      data.battery = (3500 + b[9] * 32) / 1000;
      data.heading = (b[10] & 0x07) * 45;
      data.speed = (b[10] >> 3) * 5;
    }
  } else {
    return { data: data };
  }

  data.fix_failed = failed;
  if (failed) {
    data.cached_latitude = lat;
    data.cached_longitude = lon;
  } else if ((lat !== 0 || lon !== 0) && Math.abs(lat) <= 90 && Math.abs(lon) <= 180) {
    data.latitude = lat;
    data.longitude = lon;
  }
  return { data: data };
}

When a GPS fix fails, the tracker repeats its last known position with the "fix failed" flag set. Those uplinks are deliberately kept off the map. Yabby Edge / Oyster Edge (LoRa Edge) send no coordinates and only work through a cloud solver.

Milesight AT101 (Asset-Tracker)

Outdoor asset tracker with GNSS and WiFi scanning. The decoder extracts position, battery (%) and temperature from Milesight's channel-based format.
// Milesight AT101 outdoor asset tracker. Channel based format:
// [channel id][channel type][value], values little-endian.
//   01 75  battery in % (1)            03 67  temperature / 10 (2)
//   04 88 / 84 88  GNSS location: lat(4) lon(4) in 1e-6 deg + status (1)
//   06 D9  WiFi scan result (9) - no coordinates, needs a geolocation service
//   20 CE  history record: timestamp(4) lon(4) lat(4) - not a current position
// Full official decoder: https://github.com/Milesight-IoT/SensorDecoders

function decodeUplink(input) {
  var b = input.bytes;
  var data = {};
  function s16le(o) { var v = b[o] | (b[o + 1] << 8); return v & 0x8000 ? v - 0x10000 : v; }
  function s32le(o) { return b[o] | (b[o + 1] << 8) | (b[o + 2] << 16) | (b[o + 3] << 24); }
  var ffSize = { 0x01: 1, 0x09: 2, 0x0a: 2, 0xff: 2, 0x16: 8, 0x0f: 1, 0xfe: 1, 0x0b: 1 };

  var i = 0;
  while (i + 2 <= b.length) {
    var id = b[i++];
    var type = b[i++];
    if (id === 0xff && ffSize[type]) {
      i += ffSize[type]; // versions, serial number, device status
    } else if (id === 0x01 && type === 0x75) {
      data.battery = b[i]; // percent
      i += 1;
    } else if (id === 0x03 && type === 0x67) {
      data.temperature = s16le(i) / 10;
      i += 2;
    } else if (id === 0x83 && type === 0x67) {
      data.temperature = s16le(i) / 10;
      data.temperature_alarm = b[i + 2];
      i += 3;
    } else if ((id === 0x04 || id === 0x84) && type === 0x88 && i + 9 <= b.length) {
      var lat = s32le(i) / 1e6;
      var lon = s32le(i + 4) / 1e6;
      var nearZero = Math.abs(lat) < 0.0001 && Math.abs(lon) < 0.0001;
      if (!nearZero && Math.abs(lat) <= 90 && Math.abs(lon) <= 180) {
        data.latitude = lat;
        data.longitude = lon;
      }
      data.motion_status = b[i + 8] & 0x0f;
      data.geofence_status = b[i + 8] >> 4;
      i += 9;
    } else if (id === 0x05 && type === 0x00) {
      data.tilt = b[i] === 1;
      i += 1;
    } else if (id === 0x06 && type === 0xd9) {
      data.wifi_scan = true; // MAC list only
      i += 9;
    } else if (id === 0x07 && type === 0x00) {
      data.tamper = b[i];
      i += 1;
    } else if (id === 0x20 && type === 0xce) {
      data.history = true;
      i += 12;
    } else {
      break; // downlink response or unknown channel
    }
  }
  return { data: data };
}

In WiFi positioning mode the AT101 only sends a list of WiFi MAC addresses — a payload formatter cannot turn that into a position. The tracker has to run in GNSS mode to appear on the map.

Browan Tabs Object Locator (TBOL100)

Compact GNSS tracker from the Browan Tabs range. Sends position, accuracy class, battery and temperature in 11 bytes on FPort 136 — recognised by the server even without a formatter.
// Browan Tabs Object Locator (TBOL100). FPort 136, 11 bytes.
//   [0] status: bit 0 button, bit 3 = 1 -> no GNSS fix
//   [1] battery: low nibble (25 + v) / 10 V, high nibble capacity / 15
//   [2] temperature: bits 6..0, minus 32
//   [3..6]  latitude,  little-endian, bits 27..0 signed, 1e-6 deg
//   [7..10] longitude, little-endian, bits 28..0 signed, 1e-6 deg,
//           bits 31..29 accuracy class (2^(a+2) m, 7 = worse than 256 m)
// Without a fix the device repeats its last known position, which is
// therefore not reported.

function decodeUplink(input) {
  var b = input.bytes;
  var data = {};
  if (input.fPort !== 136 || b.length < 11) return { data: data };

  data.button = !!(b[0] & 0x01);
  data.gnss_fix = !(b[0] & 0x08);
  data.battery = (25 + (b[1] & 0x0F)) / 10; // volt
  data.battery_percent = Math.round((b[1] >> 4) / 15 * 100);
  data.temperature = (b[2] & 0x7F) - 32;

  var lat = b[3] | (b[4] << 8) | (b[5] << 16) | ((b[6] & 0x0F) << 24);
  if (lat & 0x08000000) lat -= 0x10000000;
  var lon = b[7] | (b[8] << 8) | (b[9] << 16) | ((b[10] & 0x1F) << 24);
  if (lon & 0x10000000) lon -= 0x20000000;

  if (data.gnss_fix && (lat !== 0 || lon !== 0)) {
    data.latitude = lat / 1e6;
    data.longitude = lon / 1e6;
    data.accuracy = Math.pow(2, (b[10] >> 5) + 2); // metres (upper bound)
  }
  return { data: data };
}

MOKO LW001-BG PRO (Asset-Tracker)

Low-cost tracker with GPS, WiFi and Bluetooth positioning. The message type is encoded in the FPort; only GPS fixes (FPort 2 and 12) carry coordinates.
// MOKO LW001-BG PRO. The FPort tells the message type:
//   1 heartbeat, 2 positioning success, 3 positioning failed, 12 compact GPS.
// Only GPS fixes carry coordinates. WiFi / Bluetooth fixes are lists of MAC
// addresses that need an external geolocation service - no position here.

function decodeUplink(input) {
  var b = input.bytes;
  var p = input.fPort;
  var data = {};
  function s32(o) { return (b[o] << 24) | (b[o + 1] << 16) | (b[o + 2] << 8) | b[o + 3]; }
  function position(o) {
    var lat = s32(o) / 1e7;
    var lon = s32(o + 4) / 1e7;
    if ((lat !== 0 || lon !== 0) && Math.abs(lat) <= 90 && Math.abs(lon) <= 180) {
      data.latitude = lat;
      data.longitude = lon;
      data.pdop = b[o + 8] / 10;
    }
  }

  if (p === 12 && b.length >= 11) {
    data.battery = (22 + (b[1] >> 4)) / 10;
    position(2);
    return { data: data };
  }
  if (p >= 1 && p <= 10 && b.length >= 3) {
    data.temperature = b[1] > 0x80 ? b[1] - 0x100 : b[1]; // chip temperature
    data.battery = (22 + (b[2] >> 4)) / 10; // volt
    data.motion = !!(b[0] & 0x20);
  }
  if (p === 2 && b.length >= 13) {
    data.fix_tech = ["wifi", "ble", "gps"][b[3]] || "unknown";
    if (b[3] === 2 && b.length >= 22) position(13);
  } else if (p === 3) {
    data.fix_failed = true;
  }
  return { data: data };
}

Important: in "LoRa Cloud" mode the tracker only sends raw GNSS / WiFi scan data that a cloud solver has to turn into a position — the payload then contains no coordinates and the uplink will not appear on the map. The same applies to WiFi and Bluetooth fixes (MAC lists only). Set the positioning mode to GPS in the MKLoRa app.

MOKO LW008-MT / LW008-MTP (Asset-Tracker)

Small LoRa Edge tracker (LR1110). Coordinates are only in the payload for GPS fixes of the LW008-MTP and in the compact GPS frame (FPort 12).
// MOKO LW008-MT / LW008-MTP. The FPort tells the message type:
//   1 heartbeat, 2 positioning success, 4 positioning failed, 12 compact GPS.
// Coordinates are only in the payload for GPS fixes of the LW008-MTP
// (position type 3) and in the FPort 12 frame. In "LoRa Cloud" mode
// (position type 5 and FPort 199) the tracker sends a raw GNSS scan that
// only the LoRa Cloud solver can turn into a position - a payload formatter
// cannot. Switch the positioning mode in the MKLoRa app if you need
// coordinates in the uplink. WiFi / Bluetooth fixes are MAC lists only.

function decodeUplink(input) {
  var b = input.bytes;
  var p = input.fPort;
  var data = {};
  function s32(o) { return (b[o] << 24) | (b[o + 1] << 16) | (b[o + 2] << 8) | b[o + 3]; }
  function position(o, pdopDiv) {
    var lat = s32(o) / 1e7;
    var lon = s32(o + 4) / 1e7;
    if ((lat !== 0 || lon !== 0) && Math.abs(lat) <= 90 && Math.abs(lon) <= 180) {
      data.latitude = lat;
      data.longitude = lon;
      data.pdop = b[o + 8] / pdopDiv;
    }
  }

  if (p === 199 || p === 10) return { data: data }; // LoRa Cloud traffic
  if (p === 12 && b.length === 11) {
    position(2, 1);
    return { data: data };
  }
  if (b.length >= 3) {
    data.temperature = b[1] > 0x7F ? b[1] - 0x100 : b[1];
    data.battery = (22 + (b[2] >> 4)) / 10; // volt
  }
  if (p === 2 && b.length >= 7) {
    var type = b[5];
    data.position_type = ["wifi", "wifi_lora_cloud", "ble", "gps",
      "gps_custom", "gps_lora_cloud"][type] || "unknown";
    // 9-byte GPS records (lat, lon, pdop) start at byte 7
    if (type === 3 && b.length >= 16) position(7, 10);
  } else if (p === 4) {
    data.fix_failed = true;
  }
  return { data: data };
}

Important: in "LoRa Cloud" mode the tracker only sends raw GNSS / WiFi scan data that a cloud solver has to turn into a position — the payload then contains no coordinates and the uplink will not appear on the map. The same applies to WiFi and Bluetooth fixes (MAC lists only). Set the positioning mode to GPS in the MKLoRa app.

Seeed SenseCAP MeshTracker X1 (Meshtastic – kein LoRaWAN)

Card-sized tracker with dual-band GPS for Meshtastic and MeshCore.
There is no TTN payload formatter for the MeshTracker X1 – and there cannot be one.

The device speaks Meshtastic (or MeshCore), i.e. directly device to device. Its packets do not pass through LoRaWAN gateways and therefore never reach The Things Network. A payload formatter only runs once TTN has received an uplink. According to the manufacturer the X1 only has Meshtastic and MeshCore firmware (as of November 2026).

What works instead:

  • View your group's positions right in the Meshtastic app – that is what the device is made for.
  • For the coverage map use a LoRaWAN tracker, for example the SenseCAP T1000-A/B – decoder above.
MeshTracker X1 on the hardware page Our write-up (German)

Cayenne LPP (Standard-Format)

Generic low-power payload format used by many trackers (RAK, Adeunis, ELSYS, …). Automatically detects GPS, temperature, voltage, etc. — including the RAKwireless extensions (high-precision GPS 0x89 sent by WisBlock / RUI3 firmware, e.g. RAK10700).
function decodeUplink(input) {
 var b = input.bytes;
 var data = {};
 var i = 0;
 while (i + 2 <= b.length) {
 var ch = b[i++];
 var t = b[i++];
 switch (t) {
 case 0x00: data["digital_in_" + ch] = b[i++]; break;
 case 0x01: data["digital_out_" + ch] = b[i++]; break;
 case 0x02: { // analog input
 var v = (b[i]<<8) | b[i+1]; if (v & 0x8000) v -= 0x10000;
 data["analog_in_" + ch] = v / 100; i += 2; break;
 }
 case 0x03: { // analog output
 var v = (b[i]<<8) | b[i+1]; if (v & 0x8000) v -= 0x10000;
 data["analog_out_" + ch] = v / 100; i += 2; break;
 }
 case 0x65: data["luminosity_" + ch] = (b[i]<<8) | b[i+1]; i += 2; break;
 case 0x66: data["presence_" + ch] = b[i++]; break;
 case 0x67: { // temperature
 var v = (b[i]<<8) | b[i+1]; if (v & 0x8000) v -= 0x10000;
 data["temperature_" + ch] = v / 10; i += 2; break;
 }
 case 0x68: data["humidity_" + ch] = b[i++] / 2; break;
 case 0x71: i += 6; break; // accelerometer
 case 0x73: data["barometer_" + ch] = ((b[i]<<8) | b[i+1]) / 10; i += 2; break;
 case 0x74: data["voltage_" + ch] = ((b[i]<<8) | b[i+1]) / 100; i += 2; break;
 case 0x86: i += 6; break; // gyrometer
 case 0x70: data["humidity_" + ch] = ((b[i]<<8) | b[i+1]) / 10; i += 2; break; // RAK: precise humidity
 case 0x78: data["percentage_" + ch] = b[i++]; break; // e.g. battery level
 case 0x64: case 0x76: case 0x82: case 0x83: case 0x85: i += 4; break; // generic, frequency, distance, energy, time
 case 0x87: i += 3; break; // colour
 case 0x8E: case 0xCB: i += 1; break; // switch, RAK light level
 case 0x75: case 0x79: case 0x7D: case 0x80: case 0x84: case 0x8A:
 case 0xBC: case 0xBE: case 0xBF: case 0xC0: case 0xC1: case 0xC2: case 0xC3:
 i += 2; break; // current, altitude, concentration, power, direction + RAK: VOC, soil, wind, pyranometer
 case 0x89: { // RAKwireless precise gps (WisBlock / RUI3): 1e-6 deg
 var plat = (b[i]<<24) | (b[i+1]<<16) | (b[i+2]<<8) | b[i+3];
 var plon = (b[i+4]<<24) | (b[i+5]<<16) | (b[i+6]<<8) | b[i+7];
 var palt = (b[i+8]<<16) | (b[i+9]<<8) | b[i+10]; if (palt & 0x800000) palt -= 0x1000000;
 data.latitude = plat / 1e6;
 data.longitude = plon / 1e6;
 data.altitude = palt / 100;
 i += 11; break;
 }
 case 0x88: { // gps
 var lat = (b[i]<<16) | (b[i+1]<<8) | b[i+2]; if (lat & 0x800000) lat -= 0x1000000;
 var lon = (b[i+3]<<16) | (b[i+4]<<8) | b[i+5]; if (lon & 0x800000) lon -= 0x1000000;
 var alt = (b[i+6]<<16) | (b[i+7]<<8) | b[i+8]; if (alt & 0x800000) alt -= 0x1000000;
 data.latitude = lat / 10000;
 data.longitude = lon / 10000;
 data.altitude = alt / 100;
 i += 9; break;
 }
 default: return { data: data, warnings: ["unknown type 0x" + t.toString(16) + " at " + (i-1)] };
 }
 }
 return { data: data };
}
How to add the decoder in TTS
  1. Open TTS Console → Applications → your app
  2. End Devices → your device → Payload formatters tab
  3. Uplink: Formatter type → Custom JavaScript formatter
  4. Paste the code from above → Save changes
  5. Check on next uplink: Live data tab must show "latitude" and "longitude" in decoded payload
  6. The uplink will then automatically appear on the coverage map

Decoders for other devices can also be found in the official lorawan-devices repository .