ESP32-PaxCounter/src/TTN/packed_converter.js
Klaus K Wilting 77815cf18b testing
2018-07-15 23:08:52 +02:00

18 lines
365 B
JavaScript

// Converter for device payload encoder "PACKED"
// copy&paste to TTN Console -> Applications -> PayloadFormat -> Converter
function Converter(decoded, port) {
var converted = decoded;
if (port === 1) {
converted.pax = converted.ble + converted.wifi;
}
if (port === 2) {
converted.voltage /= 1000;
}
return converted;
}