MQTT node- device username

Hi,
I created 2 MQTT nodes and I want to send each output to a different device with a different username(token), but the problem is when I change the username, the username of all the previous MQTT nodes will also change!
How can I fix this issue?

What do you mean by:

MQTT is a protocol and has 2 nodes in Node-Red. The IN and OUT nodes.

Are you wanting to talk to 2 brokers? If so, create a 2nd config node then you can use different credentials.

Untitled

Here is the part of the flow I created 2 nodes

That doesn't answer my question...

I have a feeling you don't quite get how mqtt fits together.

Typically, you have one broker, all devices publish to it. All devices subscribe to topics of interest.

It looks more like NR is being used to either bridge or simulate the data of two different devices and they need to each have their own connection to the broker using different authentication credentials.

Sounds perfectly reasonable to me

@e-infotech as Steve mentioned, you need to give each Mqtt node it's own broker config node. At the moment, they are sharing the same config node, so any change applies to the both

Pick one of the nodes and open its edit dialog. In the drop-down select box for the broker, select "add new mqtt-broker", then click the button next to it. That will create a second broker config node for that node to use. Make sure you give each broker config node a name so you can identify them in the select box.

I know. That node is OUT node actually

So you mean I have to send the data to broker and then split my data and feed it to my devices or I also can split the data based on the topic and the devices should subscribe to the topics. The problem is that I'd rather use node-red on the other side as well but the one that I have on that side is basic and I think it can't support splitting the data. I'll double check to find a better solution.
Thank you

If both bits of data are going to the same device, then use two different topics to tell them apart. Even the most basic mqtt client knows how to subscribe to a specific topic.

I think it would be worth your while spending a little time working through this tutorial on MQTT, then the fundamentals of operation should become clear
https://www.hivemq.com/mqtt-essentials/

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