SenseCAP sensors use a standard payload format, and Seeed Studio provides decoder scripts that work well in ChirpStack. Below is a general-purpose decoder for the SenseCAP LoRa-E5-based sensors:
JavaScript Codec (for ChirpStack):
Go to your Device Profile > Codec tab, and paste this into the “Decode uplink” field:
function Decode(fPort, bytes) {
var decoded = {};
for (var i = 0; i < bytes.length;) {
var channel = bytes[i++];
var type = bytes[i++];
// Temperature (0x67), 2 bytes, °C
if (type === 0x67) {
var temp = (bytes[i] << 8) | bytes[i + 1];
if (temp & 0x8000) temp |= 0xFFFF0000; // Convert to signed
decoded.temperature = temp / 10.0;
i += 2;
}
// Humidity (0x68), 1 byte, %
else if (type === 0x68) {
decoded.humidity = bytes[i++] / 2.0;
}
// CO2 (0x7D), 2 bytes, ppm
else if (type === 0x7D) {
decoded.co2 = (bytes[i] << 8) | bytes[i + 1];
i += 2;
}
// Light Intensity (0x65), 2 bytes, lux
else if (type === 0x65) {
decoded.illuminance = (bytes[i] << 8) | bytes[i + 1];
i += 2;
}
// Soil Moisture (0x75), 1 byte, %
else if (type === 0x75) {
decoded.soil_moisture = bytes[i++];
}
// Battery (0x01, channel 0xFF), 2 bytes, mV
else if (channel === 0xFF && type === 0x01) {
decoded.battery = ((bytes[i] << 8) | bytes[i + 1]) / 1000.0;
i += 2;
}
// Add more types here if needed
else {
break; // Unknown type
}
}
return decoded;
}
This handles typical sensors like temperature, humidity, CO2, illuminance, soil moisture, and battery.