MQTT IP Address setup

Hello,
I’m looking a way to setup remotely the IP / port of the MQTT out node

image

(example, via a “http in” node) but until now, no luck.

From the node-red UI it’s possible to edit the mqtt-broker configuration,
but I cannot find a way to “inject” the IP address.

Maybe there is some way using something like “search-replace” on the Mqtt out node configuration ?

Of course a better/simple/clean way is welcome !

Hi @l.viola , welcome to the forums!

Unfortunately there’s no built-in way to dynamically change this setting of an mqtt-out (or mqtt-in) node by default. A big reason for this is because you’re not changing the setting for just this node, you’re changing the setting for the configuration node that all MQTT nodes point at.

Just in case you’re not familiar with configuration nodes, you can find them in the right-hand pane:
image

This shows list of all your configurations, and a number of how many nodes reference that particular config. You won’t see these nodes in the editor flow itself, they’re just a shared setting for other nodes. The Node-RED documentation site explains it like this: "“the node acts as a simple container for the configuration - it has no actual runtime behavior.”Configuration nodes : Node-RED

There may be a way to dynamically change settings on a configuration, but it’s not something I’ve looked into before, and I imagine it would require redeploying / restarting the Node-RED runtime somehow…
You may want to search around over at https://discourse.nodered.org/, and maybe repost your question there – the folks there may have a solution for you.

Can I ask what broker you’re using and what the application is for this?


EDIT: It’s an older post, but here’s something I found on Google; I believe is still true in v2.0: amazon web services - Is it possible to edit configuration nodes in a Node-Red flow? - Stack Overflow
Note knolleary’s response (the creator of Node-RED). I hope that helps.

Update to this question.
In Node-RED 2.1 and up, you can have dynamic connections.
There is a really solid write up about how to use those new settings here:

1 Like