So I have a LoraWAN device connected with TagoIO through Everynet, I'm using MQTT.
So I've been trying to work with the payload parser so that I can, later, create a dashboard based on the variables.
What I did was, after I connected the Everynet with TagoIO, I created an action with "/lora/luminosity" as the topic ( my device sends room luminosity). After the action was created I went to the payload parser so that I can work with just the value that interests me, luminosity. So on the Payload Parser I created this code based on the MQTT example code given.
const ignore_vars = ['qos', 'isHex', 'messageId', 'bucket', 'type', 'meta', 'network', 'packet_hash', 'application', 'device_addr', 'time', 'device', 'packet_id', 'gateway', 'lora', 'header', 'mac_commands', 'header', 'class_b', 'confirmed', 'adr', 'ack', 'adr_ack_req', 'version', 'type', 'rx_time', 'port', 'duplicate', 'counter_up', 'radio', 'gps_time', 'delay', 'datarate', 'time', 'freq', 'size', 'modulation', 'banwidth', 'type', 'spreading', 'coderate', 'hardware', 'status', 'chain', 'tmst', 'snr', 'rssi', 'channel', 'gps', 'lat', 'lng', 'alt']
// Remove unwanted variables.
payload = payload.filter(x => !ignore_vars.includes(x.variable));
if (payload.hasOwnProperty("params") && payload.params.hasOwnProperty("payload")) {
const payloadData = payload.params.payload;
const decodedPayload = atob(payloadData);
const data = [
{ variable: 'lumus', value: decodedPayload, unit: 'lux' }
];
const group = String(new Date().getTime());
payload = {...payload, ...{data: data.map(x => ({ ...x, group }))}}
}