Possible to add TTN location data in uplink message?

Hi, I added location data in the TTN console for my different sensors.
Now, I would like to include the individual locations in the uplink message. Is this possible?

I am not sure if I understand you well but: if you look into the json struct that is presented on the uplink of a device with WebSocket or on MQTT, you will find there the location of your device as you administered in the TTN console application.

Many thanks! That was precisely what I was looking for. I was not aware that it was already part of the transmitted information.

Now I would like to do the same with the ā€œEnd device nameā€ as well defined in the console, but it looks like that it is not part of the transmitted information. Am I overlooking something? Does it make sense to place it as a feature request?

1 Like

Everything is in the json struct as you can see in this example:

This example is captured in Node_red with MQTT. As you can see the device_id is your End device name

{
   "topic": "v3/han-demo-test-application@ttn/devices/han-kiss-04/up",
   "payload": {
      "end_device_ids": {
         "device_id": "han-kiss-04",
         "application_ids": {
            "application_id": "han-demo-test-application"
         },
         "dev_eui": "0000000B001F8745",
         "join_eui": "70B3D50000013DED",
         "dev_addr": "260B0000"
      },

Yes, I am aware of the device-id being part of the information sent, but the ā€œEnd device nameā€ as defined in ā€œGeneral Settingsā€ in the console is not. The advantage of using ā€œEnd device nameā€ would be that it can be changed once the logger has been set up.

1 Like

You can also query the end device API for additional properties of the device.

API reference is at:
https://www.thethingsindustries.com/docs/reference/api/end_device/

Java code I am using to access the API is at:

2 Likes

But preferably cache the information rather than query on every uplink ā€¦

1 Like

Many thanks. I am able to get the ā€œEnd device nameā€ with a simple GET request, thatā€™s great, but I struggle to implement it in the uplink payload formatter. I will open another topic on this.

I very much doubt there is anything in that will allow a XHR within the payload formatter or will there ever be. There has already been a compromise on the JS size (an increase) despite people experiencing timeouts on the running of their scripts.

It would be a huge burden on the servers to run each and every time so it would be more likely (but still unlikely to happen) if you got some device & application meta-data provided to the payload formatter.

Thank you for the clear answer.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.