CMi4110 Kälte
Last updated
Last updated
Energie
coldMeterEnergy
telemetry
long
Volumen
coldMeterVolume
telemetry
long
Leistung
power
telemetry
long
Durchfluss
flowRate
telemetry
long
Vorlauftemperatur
flowTemperature
telemetry
long
Rücklauftemperatur
returnFlowTemperature
coldMeterEnergy
long
{
"cmd": "gw",
"seqno": 69998,
"EUI": "94193A01020000D0",
"ts": 1662548610229,
"fcnt": 2794,
"port": 2,
"freq": 867300000,
"toa": 107,
"dr": "SF7 BW125 4/5",
"ack": false,
"gws": [{
"rssi": -45,
"snr": 10,
"ts": 1662548610229,
"time": "2022-09-07T11:29:42.123146Z",
"gweui": "000800FFFF4A4CB7",
"ant": 0,
"lat": 47.36227823944397,
"lon": 8.589862106445304
}],
"bat": 254,
"data": "000c07320301000c15856337000b2d0000000b3b1000f00a5a33020a5e27020c786860317002fd170000",
"_id": "63187a82a43493046323a2c1"
}
{
"msg": {
"coldMeterEnergy": 103.32,
"coldMeterVolume": 37638.5,
"power": 0,
"flowRate": -0.01,
"returnflowTemperature": 23.3,
"FlowTemperature": 22.7,
"ts": 1661262701281,
"rssi": -80,
"snr": 9.8,
"toa": 61,
"frequency": 867700000,
"dr": "SF7 BW125 4/5",
"bat": "External power source",
"hex": "000c07320301000c15856337000b2d0000000b3b1000f00a5a33020a5e27020c786860317002fd170000"
},
"metadata": {
"deviceType": "default",
"deviceName": "Test Device",
"ts": "1662549070536"
},
"msgType": "POST_TELEMETRY_REQUEST"
}
All Downlinks shall be sent on Port 3
//V1.0, 10.08.2021,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 telemetry = {};
if (data.substr(0,2) == "00") {
if (data.substr(2, 4) == "0c07") {
telemetry.coldMeterEnergy = parseFloat(data.substr(12,2)+data.substr(10,2)+data.substr(8,2)+data.substr(6,2))/100;
}
if (data.substr(14, 4) == "0c15") {
telemetry.coldMeterVolume = parseFloat(data.substr(24,2)+data.substr(22,2)+data.substr(20,2)+data.substr(18,2))/10;
}
if (data.substr(26, 4) == "0b2d") {
telemetry.power = parseFloat(data.substr(34,2)+data.substr(32,2)+data.substr(30,2))/10;
}
if (data.substr(36, 4) == "0b3b") {
var dataString = (data.substr(44,2)+data.substr(42,2)+data.substr(40,2));
var flowRate = parseFloat(dataString.substr(1,5))/1000;
if (dataString.substr(0,1) == "f"){
flowRate = -1*flowRate;
}
telemetry.flowRate = flowRate;
}
if (data.substr(46, 4) == "0a5a") {
dataString = (data.substr(52,2)+data.substr(50,2));
var returnflowTemperature = parseFloat(dataString.substr(1,5))/10;
if (dataString.substr(0,1) == "f"){
returnflowTemperature = -1*returnflowTemperature;
}
telemetry.returnflowTemperature = returnflowTemperature;
}
if (data.substr(54, 4) == "0a5e") {
dataString = (data.substr(60,2)+data.substr(58,2));
var FlowTemperature = parseFloat(dataString.substr(1,5))/10;
if (dataString.substr(0,1) == "f"){
FlowTemperature = -1*FlowTemperature;
}
telemetry.FlowTemperature = FlowTemperature;
}
}
return telemetry;
}
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';
}
}