MQTT In and Flow Deploy, is this a bug?

This was mentioned in a thread a couple of days ago bit I did not see an authoritative reply.
If the wiring out of an MQTT In node is changed (wire moved, or deleted or another one added) then a Flow deploy does not restart the MQTT node. At least retained messages are not re-sent. Is this expected behaviour? Is it desirable behaviour?

I think its NodeRED consistent behaviour

If you try this out on an inject node with it set to auto-inject, then that doesn't trigger either

Given that a node should not know or care what follows it, that behaviour is what I would expect.

I think that is the whole point of flow level deploy though. If I have the MQTT In wired to a Function node and edit the Function node and Flow Deploy then the MQTT node does restart.

Oh yes, I hadn't noticed that, so it to do with the Flow level deploy logic, not the MQTT In node.
As with the MQTT In, if I wire the inject to a function node and deploy, then edit the function node and Flow Deploy then the Inject does restart, but if the change is just to the wiring then it does not. That does not seem consistent to me.

aaa - now that is a good point - the deploy button lights up but inject doesn't trigger

Actually, I've got an inject wired to a debug node and when I insert a change node in-between the two and redeploy - the inject doesn't retrigger either!! (with Deploy set to Modified Flows)

I think this might be a thing worth bringing up in its own thread


No thanks... It's all the same logic. Individual nodes don't decide when they redeploy.

There was a reason a change to wiring didn't trigger a flow deploy.... I remember someone made a convincing case for it and the logic was changed. But this would have been 3-4 years ago so the specifics aren't to hand.

Happy to review the situation, and of course any highlight issues. Just not for a couple days as I'm away.

1 Like

For when you come back

If I start with this


and add a change node


and then re-deploy (using Modified Flows setting), it doesn't re-trigger the inject

Its does re-trigger if I subsequently modify the change node and redeploy

That doesn't seem right to me. In fact, I don't remember hitting this issue previously which really surprises me.

I've tested a number of scenarios now in a similar vein and you can certainly change the flow logic without a flow redeploy restarting the flow. If I wanted that to happen, I would use a node deploy not a flow deploy.

I guess I've always just hit the manual trigger without thinking about it. But as you say, this is much more critical with an MQTT-in node.

I wouldn't go to Defcon 1 over it :slight_smile:
But it was surprising to find

I'd love to revisit this if possible. I use MQTT to maintain settings that are set in the dashboard and then delivered to various parts of my flows.

It took me a while to track down why my flow logic was failing, but I eventually figured out that even with "Modified Flows" set for deploy, affected MQTT-in nodes don't consistently re-fire. This means that node-red doesn't provide my flows with the data they need from the mqtt-in nodes unless I do a full redeploy, which is excessive to do after every individual change. This behavior with "Modified flows" set doesn't seem consistent.

I haven't been able to come up with an elegant workaround that will provide my flow the data from MQTT that will persist after I press "Deploy" without manually injecting the data or doing a full redeploy.


For me also it is a pain that MQTT nodes do not redeploy even when Modified Flows are deployed and the MQTT node is connected to a node that has been modified. I am often having to do a Full Deploy when I would rather not. Unless that has been changed very recently.

I hope I'm not out of line resurrecting this thread but I just came across this behavior with a project using a MQTT IN node wired to a JOIN node. Unless I Full Deploy, my JOIN node does not received the required MQTT payloads even though the RETAINED flag is set for each when I modify something further down the line. I understand the reason but is there any other work around besides a Full Deploy?

Short answer is no

A Full Tab/Sheet Deploy option could solve it? Or a checkbox option in the relevant nodes to redeploy each time?

The problem is that you have to deploy the config node for the MQTT client. That does not exist on any particular tab which is why the only way to get it to re-connect (so you get topics again) is to edit it or do a full deploy. It is definitely a bit of a pain occasionally and has been discussed before, but I think there is no easy solution.

You can also pull up the Configuration Nodes tab in the side bar and delete the configuration node for the broker. :star_struck: But then you have to edit every MQTT-in and MQTT-out node that used that configuration :sob:

But a partial deploy will reconnect. :thinking:

You can also use the "Restart Flows" option if you forgot and only did a Modified Nodes deploy.