Commit a68174ba authored by Alan Mitchell's avatar Alan Mitchell

Added signal RSSI to collected data.

parent ae79f041
......@@ -273,10 +273,12 @@ def store_readings_things(request):
if fld not in EXCLUDE_THINGS_FIELDS:
readings.append( [ts, f'{hdw_serial}_{fld}', val] )
# Also extract the max SNR received by gateways that received this
# message
snrs = [gtw['snr'] for gtw in req_data['metadata']['gateways']]
readings.append([ts, f'{hdw_serial}_snr', max(snrs)])
# Also extract the SNR and RSSI received by gateway that received this
# message and had the best SNR.
sigs = [(gtw['snr'], gtw['rssi']) for gtw in req_data['metadata']['gateways']]
snr, rssi = max(sigs)
readings.append([ts, f'{hdw_serial}_snr', snr])
readings.append([ts, f'{hdw_serial}_rssi', rssi])
msg = storereads.store_many({'readings': readings})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment