Good morning everyone....
The packet that is sent from the sensor is received by more than one Gateway.... I only need to extract the data from a specific gateway, the way I wrote the code doesn't work, What could be the right way?
The Function node Code:
msg.topic = "Data"
var gateways = msg.metadata.gateways;
msg.payload = {
gateways: gateways.map(gw => {
if(gateways.gtw_id == "eui-60c5a8fffe7664c3")
return {
Counter: msg.counter,
Node_Time : String(msg.payload),
GwTime : gateways.map(gw => gw.time).slice(11,23) ,
Air_Time : String(msg.metadata.airtime).slice(0,7),
TTN_Time: msg.metadata.time.slice(11,23),
DataRate: msg.metadata.data_rate,
}
})
}
return msg
It would be nice if someone tells me the difference between using this statement
GwTime = gateways.map(gw => gw.time).slice(11,23) ;
And this statement
GwTime: gateways.map(gw => gw.time).slice(11,23),