LPN CM-2
The system records temperature and moisture at freely programmable intervals. The data is provided on a network server by means of LoRaWAN® radio technology via gateways.
Decoder/Product Datasheet
Device Profile for Tesenso IoT Cloud
Decoder/Payload Converter for Tesenso IoT Cloud
//V1.1, 02.02.2022,DS
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) {
var decoded = {};
// Calculate the battery status of the sensor (no battery status in payload --> standard calculation)
//float batteryStatus = BatteryStatus.CalculateBatterStatus((int)rawMessageSection.bat);
var rawBattery = data.substr(6, 4);
var intBattery = parseInt(rawBattery, 16);
//decoded.batteryStatus = intBattery;
var rawTemp = data.substr(10, 4);
//Check for negative values
var temporaryTemp = parseInt(rawTemp, 16);
if ((temporaryTemp & 0x8000) > 0) {
decoded.temperature = (temporaryTemp - 0x10000)/100;
}
else{
decoded.temperature = temporaryTemp / 100.00;
}
var rawTempPT100 = data.substr(18, 4);
var temporaryTempPT100 = parseInt(rawTempPT100, 16);
if ((temporaryTempPT100 & 0x8000) > 0) {
decoded.temperaturePt100 = (temporaryTempPT100 - 0x10000)/100;
}
else{
decoded.temperaturePt100 = temporaryTempPT100 / 100.00;
}
var rawHum = data.substr(14, 4);
decoded.humidity = parseInt(rawHum, 16) / 100.00;
return decoded;
}
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';
}
}
Device Labels
Battery voltage
batteryVoltage
telemetry
int
Temperature
temperature
telemetry
int
Humidity
humidity
telemetry
int
PT100 Temperature
temperaturePt100
telemetry
int
Remark: 1223 is 12.23 °C, 2345 is 23.45% and so on.
Uplink documentation
sample Uplink message (input to the decoder)
{
"cmd": "gw",
"seqno": 634010,
"EUI": "70B3D5FFFEBF683B",
"ts": 1661243803551,
"fcnt": 19692,
"port": 3,
"freq": 867500000,
"toa": 61,
"dr": "SF7 BW125 4/5",
"ack": false,
"gws": [{
"rssi": -58,
"snr": 8,
"ts": 1661243803551,
"time": "2022-08-23T09:41:10.090091Z",
"gweui": "000800FFFF4A3A27",
"ant": 0,
"lat": 47.4125638,
"lon": 8.557257400000026
}],
"bat": 247,
"data": "0304000bb30b550e770c45",
"_id": "6304919ba2a9c65308c4f2e1"
}
sample decoded output
{
"msg": {
"temperature": 29.01,
"temperaturePt100": 31.41,
"humidity": 37.03,
"ts": 1660999112051,
"rssi": -61,
"dr": "SF7 BW125 4/5",
"bat": 95.2755905511811,
"hex": "0304000bb30b550e770c45"
},
"metadata": {
"deviceType": "CM2-100",
"deviceName": "70B3D5FFFEBF6228",
"ts": "1660999112076"
},
"msgType": "POST_TELEMETRY_REQUEST"
}
Downlink documentation
Downlink PT100
var downlinkPayload = "0001f1f10000f1f1";
var result = {
msg: {
cmd: "tx",
EUI: metadata.originatorName,
port: 101,
confirmed: false,
data: downlinkPayload,
appid: "BE010125"
},
msgType: "LORIOT_ALARMDEVICE_DOWNLINK_APICALL",
metadata: {
}
}
return result;
//return {msg: msg, metadata: metadata, msgType: msgType};ja
Configuration
To check the configuration you must connect the device with your computer (via USB).
Click on the device and open the document
Now you should see all parameters of the device and the configuration.
To change the settings, you can edit the parameters, but please only do it if you know, what you're doing.
When you're finished, save the document, then you can close it and disconnect the device.
Last updated