Accessing device_id from a ttn message

My setup is as follows:

LAIRD Sentrius Gateway configured to use TTN which in turn links to NODE RED hosted by SenseTecnic (FRED)

I also have two LoraWan End devices with device ids of “devboard” and “belboard”

On the TTN Console I have an application called rg1xx_marlborough which has the two devices linked to it.

In NODE RED I have a ttn message node which is configured to listen for messages from the aforementioned app.

When I trigger messages from either end device the messages are detected on the NODERED debug console and everything appears to work correctly.

My problem is how can I determine which message comes from which end device?

I can see that both app_id and device_id appear under object - see screenshot below

Does anyone know how to access them?

2017-12-05 (2)

On a node red function just write:

var deviceId = msg.dev_id;

Then your deviceId variable should have the device id. This offcourse only works if the msg variable is not modified and is sourced directly from th TTN message node.

Thanks for that

Where do ttn mesage and ttn send come from pls? I can’t see the repository.