CONTEXT: Running some test flows between two PC's.
PC1: MQTT Broker with several clients; Client 1 sends messages to Client 2. Clients 1 & 2 very simple five node groups
Exported Client 1 as JSON file and Imported it to PC2.
While the connection of Client 1 on PC1 remained stable, the connection of Client 1 on PC2 kept connecting and disconnecting.
Confirmed that the WiFi connection on PC2 was strong.
Disabled Client 1 on PC2, and rebuilt it exactly from scratch on PC2, the connection now remained stable.
Any suggestions as to why the imported Client 1 on PC2 failed to maintain a stable connection, and the rebuilt Client 1 was stable?
Have they both got unique client id's set in the mqtt node configuration?
If you copy/paste a flow and you have provided a Client ID in the mqtt broker config then you wll end up with two systems using the same Client ID, which causes the problem you are seeing. Unless you have a good reason then leave the client id blank and node-red will allocate it for you and you will not have this problem.
Actually, you reminded me of something I needed to check. I guess the question is would the Client ID be preserved when imported to PC2, or be given a unique ID by the Broker on the first connection from PC2?
Colin, answered the question the Client ID must have been in conflict; the Broker doesn't automatically assign a new ID.
Are you saying that the id is blank in the flow you imported?
Colin, you answered the question. I was working on the assumption the Broker would assign a new ID when Client 1 was imported to PC2 and deployed.
I don't think it is the broker that allocates an id. If you leave it blank then (I think) the MQTT node allocates an id (probably when it is deployed, but have not checked). If you provide a client id in the config then neither node-red or the broker can change that.
You still have not said whether, where you see the problem, you have provided an id in the config or left it blank.
I just checked the JSON file, it has it's original ID, it's not blank.
I would have though that the Broker kept track (clearing-house) of all the ID's to prevent conficts.
You didn't need to check the file, just look in the config node. So you (or someone else) told the node to use that id, causing the problem. I just wanted to confirm that this was the problem and not that an auto-generated id is getting exported/imported. So leave it blank and you should not have a problem.
Got it thanks., I didn't have Node-RED opened at the time that's why I just did a quick check in the JSON file.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.