Device Location updating

Hello all,

While updating the location, I can see changes in the Tracking tab.

However, the device location is not being updated. Any idea where I might be missing something?

Hi Aneel,

The device needs to create a position update event and in addition it also needs to update the device object.
In case you are using MQTT and SmartREST to connect to the platform, you can use the 402 static template: SmartREST 2.0 - Cumulocity IoT Guides which takes care of both.

Regards,
Tristan

1 Like

Hi Bastain,

I was trying to update like below. With tedge

tedge mqtt pub 'te/device/main///e/c8y_Device' '{
"type": "c8y_Device",
"text": "Location updated",
	"c8y_Position": {
	"alt": 2,
	"lng": 2,
	"lat": 2
        }
    }'

To be precise:

You need to update the c8y_Position Fragment in the Managed Object.

https://cumulocity.com/guides/reference/device-management-library/#setting-the-current-position

That shouldn’t work like that. See here:

https://cumulocity.com/guides/reference/device-management-library/#tracking-position-history
Type must be c8y_LocationUpdate Also you defining the type twice: 1. in the topic and 2. in the payload.

So either you send a message directly to c8y/s/us using the 402 static template Tristan mentioned or you have to fix your request and send two

  1. the correct event that contains the position of type c8y_LocationUpdate
  2. update the inventory with the c8y_Position

I would go the 402 static Template way…

Hi Stefan,

I kept trying, but with no luck. The location has been removed, and I have tried, but with no success. Could you please modify and send it. It would be more helpful

tedge mqtt pub 'te/device/main///e/c8y_LocationUpdate' '{
    "c8y_Position": {
       "alt": 67,
       "lng": 6.95173,
       "lat": 51.151977
    }
    "text": "LocUpdate"
}'

Hi,

I can see events and information, but I can’t see the device location getting updated.

tedge mqtt pub 'c8y/s/us' '402,51.151977,6.95173,67,,

Hi,

tedge mqtt pub 'c8y/s/us' '402,51.151977,6.95173,67,,'

works fine for me on a thin-edge device. Two remarks:

  • In your code example above you forgot the closing single-quote at the end

  • Try activating the little “realtime” button in the top right corner. For me it was disabled by default. When disabled you won’t see your new location when switching between e.g. events and location tab of your device (you would need to switch between devices or do a browser tab refresh to get the UI element updated)

1 Like