Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

RSSI values are typically in the range von -60 dBm (good) to -107 dBm (bad)

RSSI Value
Good Reception (close to gateway)-60 dBm
Bad Reception (far from gateway)-107 dBm


Support of Lobaro Devices

...

The link layer check of telegram format B is performed on a maximum of 128 bytes, including the CRC field. Telegrams with a length of up to 128 bytes, including CRC and L field, contain a single CRC field covering both the first and the second block. Telegrams with a length between 131 bytes and 256 bytes (maximum length) contain two CRC fields, with the second CRC field covering the optional block. 



JS wMbus Parser

Compatible Parser for the Lobaro Platform, TTN / TTI and Chirpstack.


Code Block
languagejs
titlewMbus Header Parser


//////////////////////
// Helper
//////////////////////

// Convert a hex string to a byte array
function hexToBytes(hex) {
    for (var bytes = [], c = 0; c < hex.length; c += 2)
        bytes.push(parseInt(hex.substr(c, 2), 16));
    return bytes;
}

// Convert a byte array to a hex string
function bytesToHex(bytes) {
    for (var hex = [], i = 0; i < bytes.length; i++) {
        var current = bytes[i] < 0 ? bytes[i] + 256 : bytes[i];
        hex.push((current >>> 4).toString(16));
        hex.push((current & 0xF).toString(16));
    }
    return hex.join("");
}

// MFieldToString is Calculated from MField (15 bit) and represented as 3 ASCII chars
// First bit is ignored and used to define the uniqueness of the Meter Id
// AAA = 0x0421 = 0 00001 00001 00001
// ZZZ = 0x6b5a = 0 11010 11010 11010
function MFieldToString(m) {
    var letters = ""
    var char3 = (m&0x1F)+64
    var char2 = ((m&0x3E0) >> 5)+64
    var char1 = ((m&0x7C00) >> 10)+64
    letters += String.fromCharCode(char1)
    letters += String.fromCharCode(char2)
    letters += String.fromCharCode(char3)
    return letters
}


// ParseWmbus returns a struct with the wMbus telegram header information plus the raw telegram
// telegram is the whole telegram as byte slice (each element of the slice contains one byte value as number)
//
// Data Link Layer:
// ----------------
//   0  |   1  |  2   |   3  |  4   |   5  |   6  |   7  |   8  |   9    |  10  |  11  | -> Application Layer
// 0x2E | 0x44 | 0xB0 | 0x5C | 0x12 | 0x13 | 0x00 | 0x00 | 0x02 | 0x1B   | 0x8A |  ... |
// Len  |  C   |  M   |  M   |   ID |  ID  |  ID  |  ID  | Ver  | Device |  CRC |  CRC |
function ParseWmbus(telegram) {
    var id = bytesToHex(telegram.slice(4, 8).reverse());
    var mField = MFieldToString((telegram[2] << 0) + (telegram[3] << 8));
    var version = telegram[8];
    var deviceType = telegram[9];

    return {
        "Id": id,
        "MField": mField,
        "Version": version,
        "Device": deviceType,
        "Telegram": bytesToHex(telegram)
    }
}