/
Milesight MLRTPS1 Payload Decoder
Copyright Micropelt
Milesight MLRTPS1 Payload Decoder
Codec Uplink Decoder
function get_spt_value(input) {
var spt_value = input[3];
switch (spt_value) {
case 0:
return "0";
case 1:
return "+1";
case 2:
return "+2";
case 3:
return "+3";
case 4:
return "+4";
case 5:
return "+5";
case 12:
return "-4";
case 13:
return "-3";
case 14:
return "-2";
case 15:
return "-1";
case 255:
return "Freeze Protect";
default:
return "Invalid SPT value";
}
}
function Decode(fPort, bytes) {
switch (fPort) {
case 1:
{
var output = {};
output.DEV_EUI = LoRaObject.devEUI;
output.RSSI = LoRaObject.rxInfo[0].rssi;
output.SNR = LoRaObject.rxInfo[0].loRaSNR;
output.Data = LoRaObject.data;
output.ADR = LoRaObject.txInfo.adr;
output.coderate = LoRaObject.txInfo.codeRate;
output.FCnt = LoRaObject.fCnt;
output.Port = LoRaObject.fPort;
output.Frequency = LoRaObject.txInfo.frequency;
output.Modulation = LoRaObject.txInfo.dataRate.modulation;
output.Bandwidth = LoRaObject.txInfo.dataRate.bandwidth;
output.SpreadingFactor = LoRaObject.txInfo.dataRate.spreadFactor;
output.Ambient_Temperature = bytes[0] * 0.25;
output.PIR_Status = bytes[1]>>5 & 0x01;
output.Energy_Storage_Low = bytes[1]>>4 & 0x01;
output.Radio_Communication_Error = bytes[1]>>3 & 0x01;
output.Radio_Signal_Strength = bytes[1]>>2 & 0x01;
output.PIR_Sesnor_Failure = bytes[1]>>1 & 0x01;
output.Ambient_Temperature_Failure = bytes[1] & 0x01;
output.Storage_Voltage = Number((bytes[2]*0.02).toFixed(2));
output.Set_Point_Temperature_Value = get_spt_value(bytes);
return output;
}
default:
return {
errors: ['unknown FPort'],
};
}
}
MLRTPS BACNET Object Mapping
Only applicable for Milesight FW 60.0.0.45 and up
{
"object": [
{
"id": "Ambient_Temperature",
"name": "Ambient_Temperature",
"access_mode": "R",
"data_type": "NUMBER",
"value_type": "FLOAT",
"bacnet_type": "analog_input_object",
"bacnet_unit_type_id": 62,
"bacnet_unit_type": "UNITS_DEGREES_CELSIUS"
},
{
"id": "PIR_Status",
"name": "PIR_Status",
"access_mode": "R",
"data_type": "NUMBER",
"value_type": "UINT8",
"bacnet_type": "analog_input_object",
"bacnet_unit_type_id": 95,
"bacnet_unit_type": "UNITS_NO_UNITS"
},
{
"id": "Energy_Storage_Low",
"name": "Energy_Storage_Low",
"access_mode": "R",
"data_type": "NUMBER",
"value_type": "UINT8",
"bacnet_type": "analog_input_object",
"bacnet_unit_type_id": 95,
"bacnet_unit_type": "UNITS_NO_UNITS"
},
{
"id": "Radio_Communication_Error",
"name": "Radio_Communication_Error",
"access_mode": "R",
"data_type": "NUMBER",
"value_type": "UINT8",
"bacnet_type": "analog_input_object",
"bacnet_unit_type_id": 95,
"bacnet_unit_type": "UNITS_NO_UNITS"
},
{
"id": "Radio_Signal_Strength",
"name": "Radio_Signal_Strength",
"access_mode": "R",
"data_type": "NUMBER",
"value_type": "UINT8",
"bacnet_type": "analog_input_object",
"bacnet_unit_type_id": 95,
"bacnet_unit_type": "UNITS_NO_UNITS"
},
{
"id": "PIR_Sesnor_Failure",
"name": "PIR_Sesnor_Failure",
"access_mode": "R",
"data_type": "NUMBER",
"value_type": "UINT8",
"bacnet_type": "analog_input_object",
"bacnet_unit_type_id": 95,
"bacnet_unit_type": "UNITS_NO_UNITS"
},
{
"id": "Ambient_Temperature_Failure",
"name": "Ambient_Temperature_Failure",
"access_mode": "R",
"data_type": "NUMBER",
"value_type": "UINT8",
"bacnet_type": "analog_input_object",
"bacnet_unit_type_id": 95,
"bacnet_unit_type": "UNITS_NO_UNITS"
},
{
"id": "Storage_Voltage",
"name": "Storage_Voltage",
"access_mode": "R",
"data_type": "NUMBER",
"value_type": "FLOAT",
"bacnet_type": "analog_input_object",
"bacnet_unit_type_id": 5,
"bacnet_unit_type": "UNITS_VOLTS"
},
{
"id": "Set_Point_Temperature_Value",
"name": "Set_Point_Temperature_Value",
"access_mode": "R",
"data_type": "TEXT",
"value_type": "STRING",
"bacnet_type": "character_string_value_object",
"bacnet_unit_type_id": 95,
"bacnet_unit_type": "UNITS_NO_UNITS"
}
]
}
MLRTPS1 payload codec
MLRTPS1 Packets