I will send the payload when I be back to home. The documentation is the data Laird RS1xx data dictionary: https://assets.lairdtech.com/home/brandworld/files/RS1xx%20LoRa%20Protocol_v2_2.pdf
This is the decoder that I developed:
function Decoder(Payload) {
var Param = {
MsgType: 0 ,
optVlues: 0 ,
BatteryCapacity: "none" ,
BatType: "none" ,
humidity: 0 ,
temperature: 0 ,
AlarmMsgCount: 0 ,
BcklogMsgCount: 0 ,
NumReads: 0 ,
Tmtstp: 0 ,
ReadSenPer: 0 ,
SenAggr: 0 ,
TmpAlarmEna: false ,
HumAlarmEna: false ,
LED_BLE: 0 ,
LED_Heartb: 0 ,
Year: 0 ,
Month: 0 ,
Day: 0 ,
VerMaj: 0 ,
VerMin: 0 ,
PartNum: 0
};
Param.MsgType = Payload[0];
Param.optVlues = Payload[1];
switch (Param.optVlues) {
case 0:
Param.Options = "Server response is LoRa ack.";
break;
case 1:
Param.Options = "Inform Server to send UT to sensor in the next downlink transmission";
break;
case 2:
Param.Options = "Sensor configuration error.";
break;
case 4:
Param.Options = "Sensor has alarm condition.";
break;
default:
Param.Options = "This value is not supported";
break;
}
switch(Param.MsgType) {
case 1:
Param.humidity = ((Payload[3] << 8) + Payload[2])/100;
Param.temperature = ((Payload[5] << 8) + Payload[4])/100;
switch(Payload[6]){
case 0:
Param.BatteryCapacity = "0-5%";
break;
case 1:
Param.BatteryCapacity = "5-20%";
break;
case 2:
Param.BatteryCapacity = "20-40%";
break;
case 3:
Param.BatteryCapacity = "40-60%";
break;
case 4:
Param.BatteryCapacity = "60-80%";
break;
case 5:
Param.BatteryCapacity = "80-100%";
break;
default:
Param.BatteryCapacity = "This value is not supported";
}
Param.AlarmMsgCount = (Payload[8] << 8) + Payload[7];
Param.BcklogMsgCount = (Payload[10] << 8) + Payload[9];
return {
MsgType: "Send Temp RH Data Notification",
Options: Param.Options,
humidity: Param.humidity,
temperature: Param.temperature,
BatteryCapacity: Param.BatteryCapacity,
AlarmMsgCount: Param.AlarmMsgCount,
BcklogMsgCount: Param.BcklogMsgCount
};
case 2:
Param.AlarmMsgCount = Payload[2];
Param.BcklogMsgCount = (Payload[4] << 8) + Payload[3];
switch(Payload[5]){
case 0:
Param.BatteryCapacity = "0-5%";
break;
case 1:
Param.BatteryCapacity = "5-20%";
break;
case 2:
Param.BatteryCapacity = "20-40%";
break;
case 3:
Param.BatteryCapacity = "40-60%";
break;
case 4:
Param.BatteryCapacity = "60-80%";
break;
case 5:
Param.BatteryCapacity = "80-100%";
break;
default:
Param.BatteryCapacity = "This value is not supported";
}
Param.NumReads = Payload[6];
Param.Tmtstp =(Payload[10] << 24)+(Payload[9] << 16) +(Payload[8] << 8) + Payload[7];
Param.humidity =((Payload[12] << 8) + Payload[11])/100;
Param.temperature =((Payload[14] << 8) + Payload[13])/100;
return {
MsgType: "Send Temp RH Aggregated Data",
Options: Param.optVlues,
AlarmMsgCount: Param.AlarmMsgCount,
BcklogMsgCount: Param.BcklogMsgCount,
BatteryCapacity: Param.BatteryCapacity,
NumReads: Param.NumReads,
Tmtstp: Param.Tmtstp,
humidity: Param.humidity,
temperature: Param.temperature
};
case 3:
Param.Tmtstp =(Payload[5] << 24)+(Payload[4] << 16) +(Payload[3] << 8) + Payload[2];
Param.humidity =((Payload[7] << 8) + Payload[6])/100;
Param.temperature =((Payload[9] << 8) + Payload[8])/100;
return {
MsgType: "Send Backlog Message Notification",
Options: Param.Options,
Tmtstp: Param.Tmtstp,
humidity: Param.humidity,
temperature: Param.temperature
};
case 4:
Param.Tmtstp =(Payload[6] << 24)+(Payload[5] << 16) +(Payload[4] << 8) + Payload[3];
Param.humidity =((Payload[8] << 8) + Payload[7])/100;
Param.temperature =((Payload[10] << 8) + Payload[9])/100;
return {
MsgType: "Send Backlog Messages Notification",
Options: Param.Options,
Tmtstp: Param.Tmtstp,
humidity: Param.humidity,
temperature: Param.temperature
};
case 5:
switch(Payload[2]) {
case 1:
Param.BatType = "Zinc-Manganese Dioxide (Alkaline).";
break;
case 2:
Param.BatType = "Lithium/Iron Disulfide (Primary Lithium).";
break;
default:
Param.BatType = "Unknow battery type";
}
Param.ReadSenPer =(Payload[4] << 8) + Payload[3];
Param.SenAggr = Payload[5];
Param.TmpAlarmEna = Payload[6];
Param.HumAlarmEna = Payload[7];
return {
MsgType: "Send Sensor Config Simple Notification",
Options: Param.Options,
BatType: Param.BatType,
ReadSenPer: Param.ReadSenPer,
SenAggr: Param.SenAggr,
TmpAlarmEna: Param.TmpAlarmEna,
HumAlarmEna: Param.HumAlarmEna
};
case 6:
switch(Payload[2]) {
case 1:
Param.BatType = "Zinc-Manganese Dioxide (Alkaline).";
break;
case 2:
Param.BatType = "Lithium/Iron Disulfide (Primary Lithium).";
break;
default:
Param.BatType = "Unknow battery type";
}
Param.ReadSenPer =(Payload[4] << 8) + Payload[3];
Param.SenAggr = Payload[5];
Param.TmpAlarmEna = Payload[6];
Param.HumAlarmEna = Payload[7];
Param.temperature = ((Payload[9] << 8) + Payload[8])/100;
Param.humidity = ((Payload[11] << 8) + Payload[10])/100;
Param.LED_BLE = (Payload[13] << 8) + Payload[12];
Param.LED_Heartb = (Payload[15] << 8) + Payload[14];
return {
MsgType: "Send Sensor Config Advanced Notification",
Options: Param.Options,
BatType: Param.BatType,
ReadSenPer: Param.ReadSenPer,
SenAggr: Param.SenAggr,
TmpAlarmEna: Param.TmpAlarmEna,
HumAlarmEna: Param.HumAlarmEna,
humidity: Param.humidity,
temperature: Param.temperature,
LED_BLE: Param.LED_BLE,
LED_Heartb: Param.LED_Heartb
};
case 7:
Param.Year = Payload[2];
Param.Month = Payload[3];
Param.Day = Payload[4];
Param.VerMaj = Payload[5];
Param.VerMin = Payload[6];
Param.PartNum = Payload[7];
return {
MsgType: "Send FW Version Notification",
Options: Param.Options,
Year: Param.Year,
Month: Param.Month,
Day: Param.Day,
VerMaj: Param.VerMaj,
VerMin: Param.VerMin,
PartNum: Param.PartNum
};
}
}