Add Location of device with API

Its possible to get the Location of device from

[GET][/api/devices/{dev_eui}]

i understand that this location are use in the Geolocation LoraCloud by “triangulation”…

but i already have the location of the devices… can i update application server with the lat,lng of devices with API?

@Daniel_Daey

Yes, you can update location using Application Server API.

{
  "device": {
    "applicationID": "string",
    "description": "string",
    "devEUI": "string",
    "deviceProfileID": "string",
    "isDisabled": true,
    "name": "string",
    "referenceAltitude": 0,
    "skipFCntCheck": true,
    "tags": {},
    "variables": {}
  }
}

The PUT endpoint only show me “referenceAltitude”
whats the API endpoint to update the device “location”?

Sorry, @Daniel_Daey,

I forgot to mention in the previous post
you need to do custom changes in device Service API of chirpstack-application-server

Thanks

How do I get lat and long for a device with EUI? Do I need to install something

It depends on many cases.
If you have the endnode device with GPS, which send the coordinates in the payoad, You need to proceed the payload and use application with geolocation visualisation etc.
If you have gateways(more than one) with GPS and want use the TDoA for geolocation you need to use the cloud services listed in https://www.chirpstack.io/geolocation-server/

@Daniel_Daey in my use case, we don’t have GPS on the gateways or devices, but we do know the lat / long of the locations they are installed. So, we add the location coordinates to the gateways upon registration and then in a separate non-ChirpStack component we consume the MQTT Integration output results which contain the device data and gateway information and lookup the location lat/long using the gateway’s ID. https://www.chirpstack.io/application-server/integrations/mqtt/

You can use geolocation service to retrieve device location based on Gateway RSSI
Please follow below URL of the geolocation service
LocCarto

thank you all for reply…
@John_Roesler do you add the devices location “outside” chirpstack ? I can add gateway lat/lng without problem, and get in every UPLINK the gateway location

but the device lat/lng?can i add this information with chirpstack API? its possible as @sagarpatel indicate
the GET device endpoint show position of device … so its in chirpstack db

{
“device”: {
“applicationID”: “string”,
“description”: “string”,
“devEUI”: “string”,
“deviceProfileID”: “string”,
“isDisabled”: true,
“name”: “string”,
“referenceAltitude”: 0,
“skipFCntCheck”: true,
“tags”: {},
“variables”: {}
},
“deviceStatusBattery”: 0,
“deviceStatusMargin”: 0,
“lastSeenAt”: “2020-12-11T11:27:59.805Z”,
“location”: {
“accuracy”: 0,
“altitude”: 0,
“latitude”: 0,
“longitude”: 0,
“source”: “UNKNOWN”
}
}

but the POST or PUT endpoint documentation:

{
“device”: {
“applicationID”: “string”,
“description”: “string”,
“devEUI”: “string”,
“deviceProfileID”: “string”,
“isDisabled”: true,
“name”: “string”,
“referenceAltitude”: 0,
“skipFCntCheck”: true,
“tags”: {},
“variables”: {}
}
}

dont show the possibility to add lat/lng

do i need to install * (Geolocation Server) ?

@sagarpatel replywith application server modification… can you point me to this modification?

thanks

we use tags to accomplish that would be awesome if the API could provide this functionality.

1 Like

Damn @chopmann … you’re a genius!
thats a great workaround … a simple solution… i can use PUT or POST to add the lat/lng TAG to de device…

i will use that for now. And try to understand the application server change that @sagarpatel are talking about

thanks

@Daniel_Daey

Could you please create a GitHub feature request for the device location?

Thanks