I’m testing a couple of LoRaWAN gateways to find out which one has the best rssi/snr.
I have made this function in Node-RED called "get specific data"
var msg1 = {
payload: {
gtw: msg.payload.uplink_message.rx_metadata[0].gateway_ids.gateway_id,
eui: msg.payload.uplink_message.rx_metadata[0].gateway_ids.eui,
received_at: msg.payload.uplink_message.received_at,
PacketFromTTI: msg.payload.uplink_message.frm_payload,
snr: msg.payload.uplink_message.rx_metadata[0].snr,
rssi: msg.payload.uplink_message.rx_metadata[0].rssi
}
}
var msg2 = {
payload: {
gtw: msg.payload.uplink_message.rx_metadata[1].gateway_ids.gateway_id,
eui: msg.payload.uplink_message.rx_metadata[1].gateway_ids.eui,
received_at: msg.payload.uplink_message.received_at,
PacketFromTTI: msg.payload.uplink_message.frm_payload,
snr: msg.payload.uplink_message.rx_metadata[1].snr,
rssi: msg.payload.uplink_message.rx_metadata[1].rssi
}
}
var msg3 = {
payload: {
gtw: msg.payload.uplink_message.rx_metadata[2].gateway_ids.gateway_id,
eui: msg.payload.uplink_message.rx_metadata[2].gateway_ids.eui,
received_at: msg.payload.uplink_message.received_at,
PacketFromTTI: msg.payload.uplink_message.frm_payload,
snr: msg.payload.uplink_message.rx_metadata[2].snr,
rssi: msg.payload.uplink_message.rx_metadata[2].rssi
}
}
return [msg1, msg2, msg3]
My challenge is that I have hardcoded what the 3 gateways at the office receive (rx_metadata). But the plan is to walk around the area with a field tester, and I don’t know if any other gateways are nearby. So I somehow need to find the amount of elements in rx_metedata, and send everything to the csv file.