If the data is minimal, and you want to use the influx single node, this works for me -
if(msg.node == 18) {
var temp = (msg[0])/100;
var batt = (msg[1])/1000;
msg.payload = [{
temp: temp,
battery: batt
},
{
device:"th18"
}];
msg.measurement = "iot";
return msg;
} else {
return null;
}
...so, I've got 4 sensors, and the 'if' condition only runs the function if the incoming flow contains
msg.node == 18
device:"th18"
is the tagmsg.measurement = "iot"
is the measurement