Hi Martin,
Yes; you need to put in at least one “dummy” gateway in order to use this API for WiFi location. Here is an example in Python:
# EXAMPLE MGS request for LoRa+WiFI
import requests
import json
with open("loracloud_keys.json",'r') as read_json:
lc_keys = json.load(read_json)
API_URI='https://mgs.loracloud.com/'
ADD_DEV_URI=API_URI+'api/v1/solve/loraWifi'
myHeaders= {'Authorization': lc_keys['MGS_KEY'],'Content-Type': 'application/json'}
MSG_SEND = {"lorawan": [{"gatewayId": "00", "rssi": 0, "snr": 0, "toa": 0, "antennaId": 0, "antennaLocation": {"latitude": 0, "longitude": 0, "altitude": 0}}], "wifiAccessPoints": [{"macAddress": "cc:0d:ec:3d:58:1c", "signalStrength": -88}, {"macAddress": "20:9a:7d:0f:be:1e", "signalStrength": -89}, {"macAddress": "00:cb:51:47:33:e6", "signalStrength": -84}, {"macAddress": "44:ad:b1:7e:23:e6", "signalStrength": -89}, {"macAddress": "82:d2:94:30:01:06", "signalStrength": -60}, {"macAddress": "86:d2:94:30:30:77", "signalStrength": -72}]}
mydata= json.dumps(MSG_SEND)
response = requests.post(ADD_DEV_URI, data=mydata, headers= myHeaders)
if response.ok:
print ("MGS: {}".format(response.json()))
else:
print("error: {}".format(response))
Response:
MGS: {'result': {'latitude': 37.134126, 'longitude': -121.641793, 'altitude': 0.0, 'accuracy': 16, 'algorithmType': 'Wifi', 'numberOfGatewaysReceived': 0, 'numberOfGatewaysUsed': 0}, 'warnings': [], 'errors': []}
In this case you would replace the “lc_keys[‘MGS_KEY’]” with your own Modem & Geolocation token and you should be good-to-go.
Thanks
Richard