2018-06-17 22:41:32 +02:00
|
|
|
// Converter for device payload encoder "PACKED"
|
2018-06-17 13:24:20 +02:00
|
|
|
// copy&paste to TTN Console -> Applications -> PayloadFormat -> Converter
|
|
|
|
|
|
|
|
function Converter(decoded, port) {
|
|
|
|
|
|
|
|
var converted = decoded;
|
|
|
|
|
|
|
|
if (port === 1) {
|
|
|
|
converted.pax = converted.ble + converted.wifi;
|
|
|
|
}
|
|
|
|
|
2018-07-12 23:17:51 +02:00
|
|
|
/*
|
2018-07-09 21:22:04 +02:00
|
|
|
if (port === 2) {
|
|
|
|
converted.voltage /= 1000;
|
|
|
|
converted.uptime /= 60;
|
|
|
|
}
|
2018-07-12 23:17:51 +02:00
|
|
|
*/
|
2018-07-09 21:22:04 +02:00
|
|
|
|
2018-06-17 13:24:20 +02:00
|
|
|
return converted;
|
|
|
|
}
|