MQTT Node doesnt give status on Node-Red Boot

I have a case where I need to get the status of MQTT node. Currently I am using a Status node to get the status once the state in MQTT node changes and save it to context for later state retrieval. But I do find difficult in capturing the status of the Node whenever I restart Node-Red or force a deploy.

Note: I have set an empty object while loading the context data. So when I start the NR. My context value is empty and gets updated only when the status node throws a state change. But initially the MQTT node doesn't throw or Status node doesn't report the initial state of the node.

I suspect this is the issue.

Please show us exactly what you are doing.

Im trying to get the status of MQTT out node whenever I deploy the flow.

Case 1: Mqtt is connected --- In this case when I initiate a deploy status node wont send a status because the node is already connected. This is where my context remains empty.

case 2: Mqtt is disconnected -- In this case the status node reports the change and my context is updated.

Problem: In case 1 when the node is already connected why wont the status node send the status when ever I deploy?

The status node only reports changes. Because you deployed only The status node, no changes were detected. This will be because you have the deploy mode set to only deploy changed nodes. If you did a full deploy you would get the status.

To be fair, this is not really an issue in running production only when you're modifying flows. In these instances, it is fair to say you could use an inject node to set up the value of the global. However, if you are in a position to do a full deploy then it will automatically pick up.

Thanks @Steve-Mcl I tried it out and it worked. Thanks much !!!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.