# How to add extra Informations to sensors and send them to Node Red?

**URL:** <https://www.thethingsnetwork.org/forum/t/how-to-add-extra-informations-to-sensors-and-send-them-to-node-red/67595>\
**Category:** Application Development\
**Created:** [April 15, 2024, 3:20pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-extra-informations-to-sensors-and-send-them-to-node-red/67595 "2024-04-15T15:20:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![scoe](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/s/90ced4/32.png) [@scoe](https://www.thethingsnetwork.org/forum/u/scoe)\
**Post date:** [April 15, 2024, 3:20pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-extra-informations-to-sensors-and-send-them-to-node-red/67595/1 "2024-04-15T15:20:44Z")

</div>

Hey folks,

some time ago we added some sensor for monitoring airquality. In Node Red we then prepare the received data (co2, temperature and humidity) to be conform with our data model.  
Is there a way to add something like room or building for every sensor and send these data to Node Red as well?  
Is this possible with self added attributes?

Best regards

---

<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:** [April 15, 2024, 3:57pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-extra-informations-to-sensors-and-send-them-to-node-red/67595/2 "2024-04-15T15:57:32Z")

</div>

Yes, you can add a device-specific attribute in the console.

However the device-attribute data is not sent with each MQTT uplink message. You need to fetch the attributes in a separate process.

See for example:

 ![image](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/4/1/41159937744dce9c036045eb652b1cc8fc0e2194.png)

---

<div class="post-metadata">

**Author:** ![scoe](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/s/90ced4/32.png) [@scoe](https://www.thethingsnetwork.org/forum/u/scoe)\
**Post date:** [April 15, 2024, 4:43pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-extra-informations-to-sensors-and-send-them-to-node-red/67595/3 "2024-04-15T16:43:58Z")

</div>

> However the device-attribute data is not sent with each MQTT uplink message

Is there some logic behind this? Or what should I expect here?

Thanks your your help so far 🙂

---

<div class="post-metadata">

**Author:** ![kersing](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/kersing/32/44777_2.png) [@kersing](https://www.thethingsnetwork.org/forum/u/kersing)\
**Post date:** [April 15, 2024, 5:40pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-extra-informations-to-sensors-and-send-them-to-node-red/67595/4 "2024-04-15T17:40:51Z")

</div>

> [@scoe](#):
>
> Is there some logic behind this?

Yes, looking up the data is expensive for an environment handling millions of messages. So it’s delegated to a place with less load (your servers).

So get the data periodically and cache it, don’t issue a lookup on every message…

---

<div class="post-metadata">

**Author:** ![Johan\_Scheepers](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/johan_scheepers/32/46550_2.png) [@Johan\_Scheepers](https://www.thethingsnetwork.org/forum/u/Johan_Scheepers)\
**Post date:** [April 15, 2024, 7:42pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-extra-informations-to-sensors-and-send-them-to-node-red/67595/5 "2024-04-15T19:42:03Z")

</div>

Why do you not just have a lookup table, a MySQL table (for example). Using the eui as a key?

No extra load on the TTN server, and minimal load on yours.

---

<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:** [April 16, 2024, 7:00am UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-extra-informations-to-sensors-and-send-them-to-node-red/67595/6 "2024-04-16T07:00:10Z")

</div>

To fetch the device attributes, you can use the end device API, as described here: [End Device APIs | The Things Stack for LoRaWAN](https://www.thethingsindustries.com/docs/api/reference/grpc/end_device/)

My application uses the EndDeviceRegistry.List call:

> <https://github.com/bertrik/sensor-data-bridge/blob/master/sensor-data-bridge/src/main/java/nl/bertriksikken/ttnv3/enddevice/IEndDeviceRegistryRestApi.java#L23>

- application\_id = the id of the TTN application
- Authorization header with an API key that allows permission to view the device properties (‘view devices in application’, perhaps also ‘view application information’)
- field mask set to “ids,attributes”

---

<div class="post-metadata">

**Author:** ![scoe](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/s/90ced4/32.png) [@scoe](https://www.thethingsnetwork.org/forum/u/scoe)\
**Post date:** [April 18, 2024, 10:09am UTC](https://www.thethingsnetwork.org/forum/t/how-to-add-extra-informations-to-sensors-and-send-them-to-node-red/67595/7 "2024-04-18T10:09:10Z")

</div>

Sounds reasonable and should be enough for my purpose.
