Device Location - improved resolution?


#1

Hi All,

As I understand it, the device location shown in the dashboard is based purely on IP address geolocation. We have devices that move around a lot, but we’re in the fortunate position of having a GPS on each device.

It would be useful for a whole bunch of reasons to be able to “override” the geolocation used by resin.io with the exact coordinates we have from our GPS. Is there any way to do this?

Thanks!


#2

Hey @cmoss, we (very) recently added this feature. If you go to the location tab you can select the options tag and enter your co-ordinates.

I suspect you’ll want to do it programatically, I’m not sure of the exact API call but @lucian should be able to point you in the right direction until the docs are ready.


#3

Brilliant - thanks! You’re right, we will want to set them programatically. @lucian - is setting this going to be an expensive operation on your side? We’d want to do it quite often (I guess around every 2 minutes) for each of several hundred devices. Would hate to cause any problems if the service hasn’t been designed for that kind of usage.

By the way - love the new log download feature, has been hugely helpful already!

Thanks!


#4

Hey :slight_smile: I was wondering what’s your use case for this device location data?

If GPS positions are such an important part of your design that you are updating it every 2 minutes for several hundred devices, is the Location tab the right place for making use of this rich geo-data? :map:

Just thinking about how the dashboard features are used in practice, and whether there are things that would better fulfill your requirements, whatever they might be.


#5

I’m not thinking about using it directly from the dashboard - that would be rather silly :wink:

We’re using the data API to collect device status information for a given application, and feeding that into ELK, where we have a bunch of indices, visualisations etc set up to show us device status, help us identify any problems with devices, and generally allow us to fix issues before customers are aware of them. Getting the “real” location from the data-API is actually more of a convenience for us than a necessity, of course we can push that information from our device directly into ELK, however given that we’ve already got a resin.io dataapi -> logstash pipeline, it reduces overall complexity if the information provided by that api is richer.


#6

@cmoss We’re planning to make the custom locations a little easier to manage programmatically, but for the time being you can update the value using a curl request or similar.

curl --request PATCH "https://api.resin.io/v1/device(<device_id>)" --data '{"custom_latitude": "<lat>", "custom_longitude": "<long>"}' -H "Content-Type: application/json" -H "Authorization: Bearer <auth_token>"

The <device_id> is your devices numerical id (this is different to its UUID).
The <lat> and <long> values refer to your new location, they need to be formatted as strings.
The <auth_token> is the Auth Token value found in the Account Detail section of your preferences on the dashboard.


#7

Perfect, thanks for that!


#8

If you’re interested in our progress supporting this directly in the SDK, the issue is here: https://github.com/resin-io/resin-sdk/issues/282. Feel free to subscribe over there for updates!


#9

Great, I’ve subscribed, thanks!


#10

Stumbled across this thread while looking for a way to set custom lng/lat. Just what I needed, but why is it not possible to set the custom lng/lat values when a device is offline?