CMi4110 Wärme
Last updated
Last updated
Energie
heatMeterEnergy
telemetry
long
Volumen
heatMeterVolume
telemetry
long
Leistung
power
telemetry
long
Durchfluss
flowRate
telemetry
long
Vorlauftemperatur
flowTemperature
telemetry
long
Rücklauftemperatur
returnFlowTemperature
telemetry
long
{
"cmd": "gw",
"seqno": 70000,
"EUI": "94193A010200002B",
"ts": 1662548900093,
"fcnt": 2780,
"port": 2,
"freq": 868500000,
"toa": 107,
"dr": "SF7 BW125 4/5",
"ack": false,
"gws": [{
"rssi": -36,
"snr": 7.8,
"ts": 1662548900093,
"time": "2022-09-07T11:34:32.147217Z",
"gweui": "000800FFFF4A4CB7",
"ant": 0,
"lat": 47.36227823944397,
"lon": 8.589862106445304
}],
"bat": 254,
"data": "000c07484206000c15614994010b2d0000000b3b0000000a5a57020a5e55020c787861177002fd170000",
"_id": "63187ba4a43493046323a30a"
}
{
"msg": {
"heatMeterEnergy": 642.48,
"heatMeterVolume": 194496.1,
"power": 0,
"flowRate": 0,
"flowTemperature": 25.7,
"returnFlowTemperature": 25.5,
"ts": 1661262701281,
"rssi": -80,
"snr": 9.8,
"toa": 61,
"frequency": 867700000,
"dr": "SF7 BW125 4/5",
"bat": "External power source",
"hex": "000c07484206000c15614994010b2d0000000b3b0000000a5a57020a5e55020c787861177002fd170000"
},
"metadata": {
"deviceType": "default",
"deviceName": "Test Device",
"ts": "1662549396794"
},
"msgType": "POST_TELEMETRY_REQUEST"
}
All Downlinks shall be sent on Port 3
//V1.1, 15.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 telemetry = {};
if (data.substr(0,2) == "00") {
if (data.substr(2, 4) == "0c06") {
telemetry.heatMeterEnergy = parseFloat(data.substr(12,2)+data.substr(10,2)+data.substr(8,2)+data.substr(6,2));
}
if (data.substr(2, 4) == "0c07") {
telemetry.heatMeterEnergy = parseFloat(data.substr(12,2)+data.substr(10,2)+data.substr(8,2)+data.substr(6,2))/100;
}
if (data.substr(14, 4) == "0c14") {
telemetry.heatMeterVolume = parseFloat(data.substr(24,2)+data.substr(22,2)+data.substr(20,2)+data.substr(18,2))/100;
}
if (data.substr(14, 4) == "0c15") {
telemetry.heatMeterVolume = parseFloat(data.substr(24,2)+data.substr(22,2)+data.substr(20,2)+data.substr(18,2))/10;
}
if (data.substr(14, 4) == "0c16") {
telemetry.heatMeterVolume = parseFloat(data.substr(24,2)+data.substr(22,2)+data.substr(20,2)+data.substr(18,2));
}
if (data.substr(26, 4) == "0b2b") {
telemetry.power = parseFloat(data.substr(34,2)+data.substr(32,2)+data.substr(30,2))/1000;
}
if (data.substr(26, 4) == "0b2c") {
telemetry.power = parseFloat(data.substr(34,2)+data.substr(32,2)+data.substr(30,2))/100;
}
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(26, 4) == "0b2e") {
telemetry.power = parseFloat(data.substr(34,2)+data.substr(32,2)+data.substr(30,2));
}
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(36, 4) == "0b3c") {
var dataString = (data.substr(44,2)+data.substr(42,2)+data.substr(40,2));
var flowRate = parseFloat(dataString.substr(1,5))/100;
if (dataString.substr(0,1) == "f"){
flowRate = -1*flowRate;
}
telemetry.flowRate = flowRate;
}
if (data.substr(36, 4) == "0b3d") {
var dataString = (data.substr(44,2)+data.substr(42,2)+data.substr(40,2));
var flowRate = parseFloat(dataString.substr(1,5))/10;
if (dataString.substr(0,1) == "f"){
flowRate = -1*flowRate;
}
telemetry.flowRate = flowRate;
}
if (data.substr(36, 4) == "0b3e") {
var dataString = (data.substr(44,2)+data.substr(42,2)+data.substr(40,2));
var flowRate = parseFloat(dataString.substr(1,5));
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 flowTemperature = parseFloat(dataString.substr(1,5))/10;
if (dataString.substr(0,1) == "f"){
flowTemperature = -1*flowTemperature;
}
telemetry.flowTemperature = flowTemperature;
}
if (data.substr(46, 4) == "0a5b") {
dataString = (data.substr(52,2)+data.substr(50,2));
var flowTemperature = parseFloat(dataString.substr(1,5));
if (dataString.substr(0,1) == "f"){
flowTemperature = -1*flowTemperature;
}
telemetry.flowTemperature = flowTemperature;
}
if (data.substr(54, 4) == "0a5e") {
dataString = (data.substr(60,2)+data.substr(58,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) == "0a5f") {
dataString = (data.substr(60,2)+data.substr(58,2));
var returnFlowTemperature = parseFloat(dataString.substr(1,5));
if (dataString.substr(0,1) == "f"){
returnFlowTemperature = -1*returnFlowTemperature;
}
telemetry.returnFlowTemperature = returnFlowTemperature;
}
}
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';
}
}