Set device coordinates
Stores the coordinates of a device's installation site — latitude and longitude — in the device settings. Coordinates are needed, for example, to show the device on a map. The server only checks that they are numbers; it does not check the range or refine the coordinates.
Request and response: set_device_coordinates_req → set_device_coordinates_resp.
Access: a token of any access level sees the devices of its application and of applications that granted it access.
Request
Fields not marked as required may be omitted.
| Field | Type | Description |
|---|---|---|
cmd | string | set_device_coordinates_req |
operation_id | string | Any string; the server returns it in the response to match the request and the response |
devEui | string | Required. Device DevEUI, 16 hex characters |
lat | float | Required. Latitude, degrees |
lon | float | Required. Longitude, degrees |
{
"cmd": "set_device_coordinates_req",
"operation_id": "1W3fd",
"devEui": "D745F677B2412E03",
"lat": 42.221848,
"lon": 75.898052
}
Response
| Field | Type | Description |
|---|---|---|
cmd | string | set_device_coordinates_resp |
operation_id | string | Value from the request |
status | uint8 | 1 — stored, 2 — error |
devEui | string | The device |
lat, lon | float | Stored coordinates |
error_code, error_text | uint8, string | Only on error, see below |
{
"cmd": "set_device_coordinates_resp",
"operation_id": "1W3fd",
"status": 1,
"devEui": "D745F677B2412E03",
"lat": 42.221848,
"lon": 75.898052
}
Errors
error_code | error_text | What happened |
|---|---|---|
| 2 | Required field is not filled | devEui, lat or lon is missing |
| 3 | Data is filled in with an error | devEui is not 16 hex characters; lat or lon is not a number |
| 8 | Device does not exists | The device is not found, inactive or not available with your token |
| 0 | — | Internal server error — retry later |
Good to know
- The server does not check the range: latitude must be from −90 to 90, longitude from −180 to 180. Check the values on your side.
- Do not mix up the fields:
latis latitude,lonis longitude.
See also
get_device_coordinates_req— get coordinates.