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

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

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:

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 :slight_smile:

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…

1 Like

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.

1 Like

To fetch the device attributes, you can use the end device API, as described here: End Device APIs | The Things Stack for LoRaWAN

My application uses the EndDeviceRegistry.List call:

  • 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”
2 Likes

Sounds reasonable and should be enough for my purpose.