Node-Red node for all devices in one application?

I want to process the data traffic of all devices in one ttn application with node-red.
How can i setup a node-red node for this?

The Node-RED built-in MQTT client node can use wildcards in its subscription, such as +/devices/+/up. Is that what youā€™re after?

MQTT

For the serverā€™s credentials use the applicationā€™s human readable id from TTN Console for the user name, and for the password use an Access Key, with at least the ā€œmessagesā€ right.

2 Likes

Iā€™m currently using the TTN nodes in node-red. Must i switch to MQTT to have the ā€œall devices upā€ feature?

I need a flow that listenes for all devices of a certain ttn app, but will only answer to that one device which actually sent a message, e.g. like a ā€œDHCPā€ server.

I switched in Node-Red from TTN node to MQTT node.

After 2 hours of fiddling i still not manage it to get the MQTT output node to trigger a downlink in ttn console.

Has anyone an example how to correctly feed MQTT output node in node-red, so that TTN starts downlink?

@arjanvanb

Looking in my Node-RED instance I just found an old, but still operational, TTN message client that did not have any device id configured, and shows uplinks for all devices in that application.

TTN client

But the above surely is an outdated version; Iā€™ve no idea if more recent versions of that library still support this. (I thought I stopped using this TTN Node-RED library long agoā€¦)

A regular Node-RED MQTT output works just fine for me. Like:

Node-RED

The inject node just injects a boolean true when clicking the button on its left side, which I ignore. In the function node, Iā€™ve used:

const payload = [0x01, 0x02, 0x03, 0x04];

return {
  topic: 'my-app-id/devices/my-device-id/down',
  payload: {
    port: 1,
    confirmed: false,
    payload_raw: new Buffer(payload).toString('base64'),
    schedule: 'replace'
  }
};
2 Likes

Ok, got it running now, the ā€˜base64ā€™ was the secret sauceā€¦
Thanks for your help!

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