summaryrefslogtreecommitdiffstats
path: root/misc_scripts/sondehub_krakenmap.py
blob: 2be8b63d621af0fea2288880fe18e412b7674661 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Uses the SondeHub API to gather data about a sonde, and upload it to the krakenrf web mapper. It will show up on the map as a moving beacon. 
# Useful for testing tracking of a moving object
# Note that if the elevation angle between the antenna array and sonde is >45deg, direction finding  results will be poor. 

# Requires "pip install sondehub"

import sondehub
import requests

API_SERVER = 'https://map.krakenrf.com:443'

login = {'username': 'username', 'password': 'password'}

x = requests.post(API_SERVER + '/login', json = login)
token = x.text

#print(x.text)

def on_message(message):
    beaconData = {'lat': message['lat'], 'lon': message['lon'], 'speed': 0, 'height': message['alt']}
    x = requests.post(API_SERVER + '/beacon', json = beaconData, headers = {'Authorization': token})
    #print(x.text)
    #print(message['lat'])
    #print(message['lon'])
    #print(message['alt'])

# Set sondes to whatever active sonde you want
test = sondehub.Stream(on_message=on_message, sondes=["U1140595"])

while 1:
    pass