...
The Lobaro wireless Mbus bridge uses the TG PC 1208-6-o feature rich IP67 housing from Spelsberg. For this housing the following accessories are available on request:
...
Example Parser
TTN
Code Block |
---|
function readVersion(bytes, i) { if (bytes.length < 3) { return null; } return "v" + bytes[i] + "." + bytes[i + 1] + "." + bytes[i + 2]; } function Decoder(bytes, port) { // Decode an uplink message from a buffer // (array) of bytes to an object of fields. var decoded = {}; if (port === 9) { decoded.devStatus = bytes[0]; decoded.devID = bytes[1] | bytes[2] << 8 | bytes[3] << 16 | bytes[4] << 24; decoded.dif = bytes[5]; decoded.vif = bytes[6]; decoded.data0 = bytes[7]; decoded.data1 = bytes[8]; decoded.data2 = bytes[9]; } // example decoder for status packet by lobaro if (port === 1 && bytes.length == 9) { // status packet decoded.FirmwareVersion = String.fromCharCode.apply(null, bytes.slice(0, 5)); // byte 0-4 decoded.Vbat = (bytes[5] | bytes[6] << 8) / 1000.0; // byte 6-7 (originally in mV) decoded.Temp = (bytes[7] | bytes[8] << 8) / 10.0; // byte 8-9 (originally in 10th degree C) decoded.msg = "Firmware Version: v" + decoded.FirmwareVersion + " Battery: " + decoded.Vbat + "V Temperature: " + decoded.Temp + "°C"; } else if (port === 1 && bytes.length == 7) { decoded.FirmwareVersion = readVersion(bytes, 0); // byte 0-2 decoded.Vbat = (bytes[3] | bytes[4] << 8) / 1000.0; // originally in mV decoded.Temp = (bytes[5] | bytes[6] << 8) / 10.0; // originally in 10th degree C decoded.msg = "Firmware Version: " + decoded.FirmwareVersion + " Battery: " + decoded.Vbat + "V Temperature: " + decoded.Temp + "°C"; } return decoded; } |