I am relatively new to Node red but have found it to be a remarkably handy platform when dealing with data coming from multiple sources, including The Things Network (TTN) - hence this question.
In my current flow I am connecting to TTN using the MQTT broker node and on TTN I have added MQTT integration to the application. The MQTT node gets configured with what appear to be three specific bits of information to enable it to connect to TTN and get the data from my TTN application. These three are the Topic (which includes the TTN application ID), the user name (which carries the application ID also) and the password - this last is an API key generated by TTN. So far so good and this configuration has worked perfectly for best part of a year.
Recently I added a new application to TTN with the object of using MQTT integration to pull this application data into a new Node Red flow. In Node red I created a new flow and then added in the MQTT-In node to the flow and configured this node with a new topic (new because it carries the new application name), the user id and password - a new API key generated from the MQTT integration for this new application. All good so far.
However once I configured this new MQTT node, the previous flow (the one running for a year) suddenly stopped working. After checking I found that the new MQTT configuration had overwritten the configuration in the old MQTT node - even though these are two separate nodes on two separate flows. I assumed I had made an error so I tried this again - same result.
So currently it seems like Node red can only support a single MQTT connection to a TTN application while TTN can have many MQTT integrations, each unique to an application.
I have tried to think a way around this but at the most basic level, if the TTN application is the container for the data I need and the TTN application name is required for the MQTT node, then I can only ever see on application in Node red at a time.....but this doesn't seem right.
Any thoughts on how to configure the MQTT in Node Red so each flow can get data from a different application via TTN/MQTT?
Many thanks for your help.
Configuring a MQTT-In/MQTT-Out node is a 2 step process.
When you first double click on the node you will be presented with a screen that looks like:
The import thing to know is that the "Server" entry is a reference to what is known as MQTT-Broker config node, which holds the second level of detail.
Config nodes hold details that can be shared between multiple nodes. In the case of the MQTT nodes, the config node holds the broker hostname, username and password details (and some other stuff we don't need to worry about here).
You can create as many config nodes as required (for different combinations of hostname/username/password). What I susspect you have done here is instead of creating new config node for your new application you have edited the orignal config node which means this will have also changed the nodes associated with the first TTN app.
So the first step is reset the config node to hold the credentials for the first TTN app. To do this open one of the MQTT nodes for that app and click on the pencil button next to the Server entry to open the config node. Enter all the correct details and also make sure you fill in the Name box at the top to contain a meaningful name for the first TTN app. Then hit Done button to return to the MQTT node config and then Done again.
Now open one of the MQTT nodes for the new (second) TTN app. This time before you click pencil button, click the drop down button and select the "add new MQTT-broker" then hit the pencil button. This will create a new MQTT config node which you can enter the new credentials (again set a meaningful Name at the top for this TTN app).
Setting the Name is probably the useful bit here, as by default the MQTT config nodes just use the hostname to label the config nodes in the drop down list and since all the TTN apps in a given region will use the same broker hostname it makes them hard to tell apart. Setting a name overrides this making it obvious which you have selected.
You can then go round all the MQTT nodes and make sure the correct MQTT Broker config node is selected in each MQTT-In/MQTT-Out nodes' Server input.
Thank you for taking the time to help me with this one. I have tested this and you are right on the money - its a two level node and I missed that entirely. So it's all working as I originally expected it to now based on your steps. Many thanks again.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.