FORUM

Lorawifi solution

I am integrating support for the LR1110 and am adding the ability to do wifi solutions using the lorawifi api.

I am starting with the demo payloads in the TRM and am trying to use those to verify my integration with the geolocation api.

The api will do wifi and then fall back to tdoa - we don’t care about the tdoa at all for this applicaiton and for a variety of gateways in our network, we don’t have geoposition information for them. When I call the api with only the mac and rssi wifi information, I get an error back from the api:
400, {‘result’: None, ‘warnings’: [], ‘errors’: [‘Missing valid frame information’]}

Can I call this api without gateway tdoa information? If not, can I just load it with dummy values?

Thanks.
Martin.

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