# MQTT In and Flow Deploy, is this a bug?

**URL:** <https://discourse.nodered.org/t/mqtt-in-and-flow-deploy-is-this-a-bug/2765>\
**Category:** General\
**Created:** [2 September 2018 07:24 UTC](https://discourse.nodered.org/t/mqtt-in-and-flow-deploy-is-this-a-bug/2765 "2018-09-02T07:24:16Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 September 2018 07:24 UTC](https://discourse.nodered.org/t/mqtt-in-and-flow-deploy-is-this-a-bug/2765/1 "2018-09-02T07:24:16Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [2 September 2018 07:38 UTC](https://discourse.nodered.org/t/mqtt-in-and-flow-deploy-is-this-a-bug/2765/2 "2018-09-02T07:38:59Z")

</div>

> [@Colin](#):
>
> Is this expected 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

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [2 September 2018 07:39 UTC](https://discourse.nodered.org/t/mqtt-in-and-flow-deploy-is-this-a-bug/2765/3 "2018-09-02T07:39:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 September 2018 07:47 UTC](https://discourse.nodered.org/t/mqtt-in-and-flow-deploy-is-this-a-bug/2765/4 "2018-09-02T07:47:01Z")

</div>

> [@ukmoose](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 September 2018 07:52 UTC](https://discourse.nodered.org/t/mqtt-in-and-flow-deploy-is-this-a-bug/2765/5 "2018-09-02T07:52:21Z")

</div>

> [@cymplecy](#):
>
> If you try this out on an inject node with it set to auto-inject, then that doesn't trigger either

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.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [2 September 2018 08:27 UTC](https://discourse.nodered.org/t/mqtt-in-and-flow-deploy-is-this-a-bug/2765/6 "2018-09-02T08:27:38Z")

</div>

> [@Colin](#):
>
> 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

Simon

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [2 September 2018 08:31 UTC](https://discourse.nodered.org/t/mqtt-in-and-flow-deploy-is-this-a-bug/2765/7 "2018-09-02T08:31:52Z")

</div>

> [@cymplecy](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [2 September 2018 09:41 UTC](https://discourse.nodered.org/t/mqtt-in-and-flow-deploy-is-this-a-bug/2765/8 "2018-09-02T09:41:51Z")

</div>

For when you come back

If I start with this

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/d/d9a41b4d8c7c41db96344c422264dc91cafd9a81.png)

and add a change node

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/8/82ca7a23fee22e31b754712424f0643208843082.png)

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

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [2 September 2018 10:06 UTC](https://discourse.nodered.org/t/mqtt-in-and-flow-deploy-is-this-a-bug/2765/9 "2018-09-02T10:06:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [2 September 2018 10:26 UTC](https://discourse.nodered.org/t/mqtt-in-and-flow-deploy-is-this-a-bug/2765/10 "2018-09-02T10:26:05Z")

</div>

> [@TotallyInformation](#):
>
> But as you say, this is much more critical with an MQTT-in node.

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

---

<div class="post-metadata">

**Author:** ![banjopicker](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@banjopicker](https://discourse.nodered.org/u/banjopicker)\
**Post date:** [21 February 2019 17:47 UTC](https://discourse.nodered.org/t/mqtt-in-and-flow-deploy-is-this-a-bug/2765/11 "2019-02-21T17:47:21Z")

</div>

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.

Thanks,  
Stephen

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [21 February 2019 20:47 UTC](https://discourse.nodered.org/t/mqtt-in-and-flow-deploy-is-this-a-bug/2765/12 "2019-02-21T20:47:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![m\_elias](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@m\_elias](https://discourse.nodered.org/u/m_elias)\
**Post date:** [18 March 2020 18:16 UTC](https://discourse.nodered.org/t/mqtt-in-and-flow-deploy-is-this-a-bug/2765/13 "2020-03-18T18:16:28Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [18 March 2020 19:04 UTC](https://discourse.nodered.org/t/mqtt-in-and-flow-deploy-is-this-a-bug/2765/14 "2020-03-18T19:04:06Z")

</div>

Short answer is no

---

<div class="post-metadata">

**Author:** ![m\_elias](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@m\_elias](https://discourse.nodered.org/u/m_elias)\
**Post date:** [18 March 2020 19:41 UTC](https://discourse.nodered.org/t/mqtt-in-and-flow-deploy-is-this-a-bug/2765/15 "2020-03-18T19:41:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [18 March 2020 20:51 UTC](https://discourse.nodered.org/t/mqtt-in-and-flow-deploy-is-this-a-bug/2765/16 "2020-03-18T20:51:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [18 March 2020 21:48 UTC](https://discourse.nodered.org/t/mqtt-in-and-flow-deploy-is-this-a-bug/2765/17 "2020-03-18T21:48:45Z")

</div>

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

But a partial deploy will reconnect. 🤔

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [18 March 2020 22:00 UTC](https://discourse.nodered.org/t/mqtt-in-and-flow-deploy-is-this-a-bug/2765/18 "2020-03-18T22:00:14Z")

</div>

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