Get real TTN gateway ID if data arriving via a packetbroker

This commit is contained in:
Mark Jessop 2024-05-25 19:46:32 +09:30
parent 4fdf302329
commit e8957337d7

View File

@ -228,6 +228,13 @@ def upload_ttn(event, context):
hotspot_telem['uploader_callsign'] = hotspot['gateway_ids']['gateway_id']
# Handle telemetry arriving via a packetbroker, and try and get the real gateway ID
if hotspot_telem['uploader_callsign'] == "packetbroker":
try:
hotspot_telem['uploader_callsign'] = hotspot['packet_broker']['forwarder_gateway_id']
except:
pass
# Frequency and modulation metadata is common to all packets
# Frequency is in Hz
hotspot_telem['frequency'] = float(payload['uplink_message']['settings']['frequency'])/1e6