Node red doc for mqtt in (dynamic) is somewhat lackluster. Trying this for the first time, I see what's presented, but not sure what "broker" is (type?), compared url and port. Also I don't see anywhere to specify client id. Luckily, thanks to amazing community, there are some existing discussions which shed some light. Like this: Dynamic MQTT node's "actions->connect" guidance needed
Wouldn't it be nice to update the documentation to include this info readily available?
I'm also not sure about connect vs subscribe, do I need to do both (first connect, then subscribe?) or choose one of them?
I find dynamic config is much smoother compared to hardcoded values, because it is how "everything" else works (like http for example) and it allows for .env variables to store secrets outside node red.
You should take a read of this great tutorial of MQTT:
to get a handle on the terminology used.
What do you think should be added to the HELP for the MQTT nodes? Show what you think would make the current explanation better. If people agree you could even create a PR to update the help.
Broker would be the IP of the broker (should possibly say server as in config title).
But there are many topics on this in the forum, here is one from the nodes maintainer that has many examples Dynamic MQTT LWT birth, Close & Will Property - #2 by Steve-Mcl
I am surprised these examples have not bee added to the node-red library import examples for the node.
I want to set the connection credentials in function node. That requires "dynamic settings" to get input. Then the doc says the following:
broker broker
For the "connect" action, this property can override any of the individual broker configuration settings, including:
broker
port
url - overrides broker/port to provide a complete connection url
username
password
If this property is set and the broker is already connected an error will be logged unless it has the force property set - in which case it will disconnect from the broker, apply the new settings and reconnect.
MQTT in gives linting error if not setting a broker config node. I don't want broker config node, as this is set dynamically. Unless broker config node can take dynamic env variables (which as far as I can see, it cannot).
If I add a dummy broker config node, it too gives linting error if not setting server (blank). So I add dummy server/url value to the dummy config node.
Without anywhere to dynamically set client ID, I'm not getting connected.
When setting correct client id to the dummy config node, I get connected. Why is "dynamic mode" not supporting dynamic client id?
Also struggling with getting the auto-connect feature of static config applied to dynamic config. Only way I found so far is to add status node, listen and filter status changes from mqtt-in and then send it to function node before mqtt-in node. A bit too messy and fragile for my liking.
"force" (boolean) arg in broker seems interesting and useful. Is this documented anywhere? I accidentally stumbled upon it in a discussion, so found it by chance. Would be great to have this in the HELP section!
It is mentioned at the bottom of the sidebar help text
If this property is set and the broker is already connected an error will be logged unless it has the force property set - in which case it will disconnect from the broker, apply the new settings and reconnect.
Thanks, somehow that didn't show up when I made this topic and also failed at finding it when searching. Would be wonderful to have all these "secret" attributes documented in HELP section But for me, I get what I need now with that great community example.