LogoLogo
  • Tesenso IoT Cloud
  • Overview Tesenso Products
  • Hardware
    • Tesenso M-Bus LoRaWAN
    • Tesenso LoRa Edge
    • Tesenso Industrial Edge
    • Tesenso LoRa RTD Device
    • Tesenso Analog
Powered by GitBook
On this page
  • Quickstart
  • Product Datasheet
  • Uplink documentation
  • Uplink Decoder
  • Downlink samples
  • Add secundary adress manually to EEPROM
  • Downlink for Scan M-Bus slave on the M-Bus
  • Delete saved slaves from EEPROM
  • Change send Intervall:
  • Troubleshoot Checklist:

Was this helpful?

  1. Hardware

Tesenso M-Bus LoRaWAN

Product documentation

PreviousOverview Tesenso ProductsNextTesenso LoRa Edge

Last updated 1 year ago

Was this helpful?

Quickstart

Product Datasheet

Uplink documentation

M-BUS message formats

Name:
Length
MsgType
Data depending on MsgType

Unit:

Enum

Bytes

Range:

0..255

0..127

Uplink message ports

Uplink message port:

2

Uplink message port for split messages

12

Status Uplink message port:

50

ENUM definitions

MsgType Enum

0

0

Status message

1

1

Scan Result

2

2

Telegram Response

3

3

Read Meter

4

4

Read Meter Raw

...

123

7B

HW_ID_UL

124

7C

MCU_ID_UL

125

7D

Firmware_hash

Port for ID-s (123-125) is 200

Message Types

0: Status message

Port 50

Name:
Length
MsgType
Voltage
Temp
Saved slaves
Read interval
Flags
Status interval

Unit:

Enum

1/100 -170

Count

Min(s)

Min(s)

Bytes

1

1

1

1

1

1

1

MSB

LSB

Range:

8

0

Example

08

0

08 00 9e 30 00 03 a0 05 a0

1: Scan Result

Name:
Length
MsgType
slave addresses

Unit:

Enum

Bytes

1

1

X

Range:

1

2: Telegram Response

Name:
Length
MsgType
Slave response

Unit:

Enum

Bytes

1

1

X

Range:

2

3: Read Meter

3: Read Meter
Meter properties block
Meter properties block

Name:

Length

MsgType

no. of slaves

ID

Medium

VIF

Volume

...

Unit:

Enum

count

BCD encoded

BCD encoded

Bytes

1

1

1

1

1

1

1

1

1

1

1

1

1

10

Range:

3

HighByte

LowByte

HighByte

LowByte

4: Read Meter Raw

Port 2

Has to be decoded in the backend (contains all information)

Name:

Length

MsgType

Slave No.

Full response telegram

Unit:

Enum

Byte

Bytes

1

1

1

X

Range:

4

4: Read Meter Raw SPLIT

Port 12

Has to be decoded in the backend (contains all information)

Name:

Length

MsgType

Slave No.

Pointer

Full response telegram

Unit:

Enum

Byte

Byte

Bytes

1

1

1

1

X

Range:

4

123: HW_ID_UL

Name:

MsgType

HWID

Unit:

Enum

version

Bytes

123

Range:

0..7

124: MCU_ID_UL

Name:
MsgType
MCU_ID

Unit:

Enum

Bytes

124

HighByte

LowByte

Range:

125: Firmware_hash_UL

Name:
MsgType
Firmware version and hash

Unit:

Enum

String

Bytes

125

Size varies

Range:

(not available yet, coming soon)

Uplink Decoder

// V3.0 10.05.2022, copyright by Tesenso GmbH

//Code entry
if (msg.data) {
    var decoded = decodeFromHex(msg.data);
    decoded.ts = msg.ts;
    decoded.rssi = msg.rssi;
    decoded.snr = msg.snr;
    decoded.toa = msg.toa;
    decoded.frequency = msg.frequency;
    decoded.dr = msg.dr;
    decoded.bat = decodeBattery(msg.bat);
    decoded.hex = msg.data;

    return {
        msg: decoded,
        metadata: metadata,
        msgType: msgType
    };
} else {
    return {
        msg: msg,
        metadata: metadata,
        msgType: msgType
    };
}


function decodeFromHex(data) {
    // Decode uplink message
    var decoded = {};

    //Parse string as bytes
    var bytes = parseHexString(data);
    //scale to manage the different scales with none, one or more decimals on the meter.
    var scale = metadata.ss_scale;

    //various info that can be extracted
    var length = bytes[0];
    var msgType = bytes[1];
    var slaveCount = bytes[2];
    var startCharacter1 = bytes[3];
    var length1 = bytes[4];
    var length2 = bytes[5];
    var startCharacter2 = bytes[6];
    var c = bytes[7];
    var a = bytes[8];
    //72 or 76 -> variable; 73 or 77 -> fixed
    var ciField = bytes[9];
    var medium = data.substr(34, 2);
    var checkSum = bytes[36];


    //Different medium IDs, register positions vary
    if (medium == "02") {
        var volume = data.substr(72, 2) + data.substr(70,
            2) + data.substr(68, 2) + data.substr(66, 2);
        decoded.electricityMeterEnergyHt = parseInt(volume,
            16) * scale;
        volume = data.substr(88, 2) + data.substr(86, 2) +
            data.substr(84, 2) + data.substr(82, 2);
        decoded.electricityMeterEnergyNt = parseInt(volume,
            16) * scale;
    }
    if (medium == "03") {
        var volume = data.substr(66, 2) + data.substr(64,
            2) + data.substr(62, 2) + data.substr(60, 2);
        decoded.gasMeterVolume = parseInt(volume) * scale;
    }
    if (medium == "16") {
        var volume = data.substr(54, 2) + data.substr(52,
            2) + data.substr(50, 2) + data.substr(48, 2);
        decoded.waterMeter = parseInt(volume, 16) * scale;
    }

    return decoded;
}

//Helper functions
function parseHexString(hex) {
    for (var bytes = [], c = 0; c < hex.length; c += 2)
        bytes.push(parseInt(hex.substr(c, 2), 16));
    return bytes;
}

function decodeBattery(byte) {
    if (byte == 0) {
        return 'External power source';
    } else if (byte > 0 && byte < 255) {
        return byte / 254 * 100;
    } else {
        return 'Unknown battery state';
    }
}

function parseFloat(str) {
    var float = 0,
        sign, order, mantissa, exp,
        int = 0,
        multi = 1;
    if (/^0x/.exec(str)) {
        int = parseInt(str, 16);
    } else {
        for (var i = str.length - 1; i >= 0; i -= 1) {
            if (str.charCodeAt(i) > 255) {
                console.log('Wrong string parameter');
                return false;
            }
            int += str.charCodeAt(i) * multi;
            multi *= 256;
        }
    }
    sign = (int >>> 31) ? -1 : 1;
    exp = (int >>> 23 & 0xff) - 127;
    mantissa = ((int & 0x7fffff) + 0x800000).toString(2);
    for (i = 0; i < mantissa.length; i += 1) {
        float += parseInt(mantissa[i]) ? Math.pow(2, exp) :
            0;
        exp--;
    }
    return float * sign;
}

All Downlinks shall be sent on Port 3

Downlink samples

Add secundary adress manually to EEPROM

Name:
Length
MsgType
ID

Unit:

Enum

BCD encoded

Bytes

1

1

1

1

1

1

Range:

5

133

HighByte

LowByte

  • 05 --> Length

  • 85 --> MsgType

  • 17670401 --> secondaryAdress of the meter

058517670401

Downlink for Scan M-Bus slave on the M-Bus

Name:
Length
MsgType
Retry

Unit:

Enum

Bytes

1

1

1

Range:

2

130

0..3

  • 02 --> Length

  • 82 --> MsgType

  • 01 --> Retry

028201

Delete saved slaves from EEPROM

Name:
Length
MsgType

Unit:

Enum

Bytes

1

1

Range:

1

131

  • 01 --> Length

  • 83 --> MsgType

0183

Change send Intervall:

Message Types

Name:

Length

MsgType

Flags

status msg interval

Meter interval

Unit:

Enum

Min(s)

Min(s)

Bytes

1

1

1

MSB

LSB

1

Range:

0..255

128

sample downlinks to change the intervall:

  • 05800000001E --> 30 minutes

  • 05800000000F --> 15minutes

  • 058000000005 --> 5minutes

Troubleshoot Checklist:

  • take a photo of the meter and the full installation

  • power device

  • make sure that the connection (wires/cables) are connected correctly

510KB
Tesenso M-Bus QuickStart Guide V4-EN.pdf
pdf
1MB
Tesenso M-Bus QuickStart Guide V4-DE.pdf
pdf
604KB
Tesenso M-Bus Datenblatt 1.3.pdf
pdf
571KB
Tesenso M-Bus Datasheet 1.3.pdf
pdf
Page cover image