# Possible to add TTN location data in uplink message?

**URL:** <https://www.thethingsnetwork.org/forum/t/possible-to-add-ttn-location-data-in-uplink-message/52145>\
**Category:** Uncategorized\
**Tags:** location\
**Created:** [October 6, 2021, 1:32pm UTC](https://www.thethingsnetwork.org/forum/t/possible-to-add-ttn-location-data-in-uplink-message/52145 "2021-10-06T13:32:59Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![aweichbrodt](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/aweichbrodt/32/35697_2.png) [@aweichbrodt](https://www.thethingsnetwork.org/forum/u/aweichbrodt)\
**Post date:** [October 6, 2021, 1:32pm UTC](https://www.thethingsnetwork.org/forum/t/possible-to-add-ttn-location-data-in-uplink-message/52145/1 "2021-10-06T13:32:59Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![pe1mew](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/pe1mew/32/48520_2.png) [@pe1mew](https://www.thethingsnetwork.org/forum/u/pe1mew)\
**Post date:** [October 6, 2021, 7:07pm UTC](https://www.thethingsnetwork.org/forum/t/possible-to-add-ttn-location-data-in-uplink-message/52145/2 "2021-10-06T19:07:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![aweichbrodt](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/aweichbrodt/32/35697_2.png) [@aweichbrodt](https://www.thethingsnetwork.org/forum/u/aweichbrodt)\
**Post date:** [October 14, 2021, 4:36pm UTC](https://www.thethingsnetwork.org/forum/t/possible-to-add-ttn-location-data-in-uplink-message/52145/3 "2021-10-14T16:36:04Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![pe1mew](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/pe1mew/32/48520_2.png) [@pe1mew](https://www.thethingsnetwork.org/forum/u/pe1mew)\
**Post date:** [October 15, 2021, 6:30am UTC](https://www.thethingsnetwork.org/forum/t/possible-to-add-ttn-location-data-in-uplink-message/52145/4 "2021-10-15T06:30:38Z")

</div>

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**

```auto
{
   "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"
      },

```

---

<div class="post-metadata">

**Author:** ![aweichbrodt](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/aweichbrodt/32/35697_2.png) [@aweichbrodt](https://www.thethingsnetwork.org/forum/u/aweichbrodt)\
**Post date:** [October 20, 2021, 7:22am UTC](https://www.thethingsnetwork.org/forum/t/possible-to-add-ttn-location-data-in-uplink-message/52145/5 "2021-10-20T07:22:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bertrik](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bertrik/32/35697_2.png) [@bertrik](https://www.thethingsnetwork.org/forum/u/bertrik)\
**Post date:** [October 20, 2021, 5:42pm UTC](https://www.thethingsnetwork.org/forum/t/possible-to-add-ttn-location-data-in-uplink-message/52145/6 "2021-10-20T17:42:45Z")

</div>

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/](https://www.thethingsindustries.com/docs/reference/api/end_device/)

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

> **[LoraLuftdatenForwarder/LoraLuftdatenForwarder/src/main/java/nl/bertriksikken/ttn...](https://github.com/bertrik/LoraLuftdatenForwarder/tree/master/LoraLuftdatenForwarder/src/main/java/nl/bertriksikken/ttnv3/enddevice)**
>
> master/LoraLuftdatenForwarder/src/main/java/nl/bertriksikken/ttnv3/enddevice

---

<div class="post-metadata">

**Author:** ![descartes](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/descartes/32/47220_2.png) [@descartes](https://www.thethingsnetwork.org/forum/u/descartes)\
**Post date:** [October 20, 2021, 7:32pm UTC](https://www.thethingsnetwork.org/forum/t/possible-to-add-ttn-location-data-in-uplink-message/52145/7 "2021-10-20T19:32:09Z")

</div>

But preferably cache the information rather than query on every uplink …

---

<div class="post-metadata">

**Author:** ![aweichbrodt](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/aweichbrodt/32/35697_2.png) [@aweichbrodt](https://www.thethingsnetwork.org/forum/u/aweichbrodt)\
**Post date:** [November 3, 2021, 5:58am UTC](https://www.thethingsnetwork.org/forum/t/possible-to-add-ttn-location-data-in-uplink-message/52145/8 "2021-11-03T05:58:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![descartes](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/descartes/32/47220_2.png) [@descartes](https://www.thethingsnetwork.org/forum/u/descartes)\
**Post date:** [November 3, 2021, 9:03am UTC](https://www.thethingsnetwork.org/forum/t/possible-to-add-ttn-location-data-in-uplink-message/52145/9 "2021-11-03T09:03:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![aweichbrodt](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/aweichbrodt/32/35697_2.png) [@aweichbrodt](https://www.thethingsnetwork.org/forum/u/aweichbrodt)\
**Post date:** [November 3, 2021, 10:12am UTC](https://www.thethingsnetwork.org/forum/t/possible-to-add-ttn-location-data-in-uplink-message/52145/10 "2021-11-03T10:12:03Z")

</div>

Thank you for the clear answer.

---

<div class="post-metadata">

**Author:** ![system](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/6/2/6250ea44fd2b0d6259489e1a92748df681e1f970.png) [@system](https://www.thethingsnetwork.org/forum/u/system)\
**Post date:** [November 4, 2021, 10:12am UTC](https://www.thethingsnetwork.org/forum/t/possible-to-add-ttn-location-data-in-uplink-message/52145/11 "2021-11-04T10:12:52Z")

</div>

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