A little node I made to help with people debug their flows

This is a handy little node that you can use if you are seeing (or more so: not seeing) the right thing in your flow/s.

The situation rises where you are trying to see what is going on but while doing that, other messages are coming through/past and confusing you.

Yes, as you get better with Node-Red you may be able to ignore these. But for new people, it can be annoying.

This node goes in the flow and you press the button to allow only one message to pass.
That way you can see what is set and what is doing what.

[{"id":"4f54da14.06347c","type":"inject","z":"b756f41c.b00438","name":"ONE ONLY","topic":"GATE","payload":"open","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":630,"y":160,"wires":[["a944357d.84422"]]},{"id":"a944357d.84422","type":"function","z":"b756f41c.b00438","name":"One only.","func":"if (msg.topic == \"GATE\")\n{\n    context.set(\"ALLOW\",1);\n    node.status({fill: \"green\",text:\"ONE\"});\n    return;\n}\nif (context.get(\"ALLOW\") == 1)\n{\n    //\n    context.set(\"ALLOW\",0);\n    node.status({});\n    return msg;\n}","outputs":1,"noerr":0,"x":620,"y":220,"wires":[[]]},{"id":"5fc647fe.bc1c9","type":"comment","z":"b756f41c.b00438","name":"Signal coming from here","info":"","x":410,"y":220,"wires":[]},{"id":"b9a3f35b.549678","type":"comment","z":"b756f41c.b00438","name":"The rest of the flow","info":"","x":800,"y":220,"wires":[]}]

This is basically how/where it fits in the flow:

2 Likes

Perhaps superfluous, but there are various ways to only show what you want to see:

Configure the debug node to display the payload that you want to see.

You can even use a jsonata expression by selecting "expression"

Use the filters to only show 1 or more specific debug nodes

Enable/disable the debug node itself

30

2 Likes

Nice simple gate function :slight_smile:

If you ever want to do more, I recommend @drmibell node-red-contrib-queue-gate that lets you store up messages and then let them through one message at a time

image

[{"id":"e96dc5c1.37af88","type":"q-gate","z":"92902cbf.e28a4","name":"","controlTopic":"control","defaultState":"queueing","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","queueCmd":"queue","defaultCmd":"default","triggerCmd":"trigger","flushCmd":"flush","resetCmd":"reset","maxQueueLength":"100","x":410,"y":360,"wires":[["270d2e7e.3c0752"]]},{"id":"270d2e7e.3c0752","type":"debug","z":"92902cbf.e28a4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":640,"y":360,"wires":[]},{"id":"3f9a2cf6.cebfc4","type":"inject","z":"92902cbf.e28a4","name":"","topic":"control","payload":"trigger","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":310,"y":300,"wires":[["e96dc5c1.37af88"]]},{"id":"d16a191c.0aa508","type":"inject","z":"92902cbf.e28a4","name":"","topic":"control","payload":"reset","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":510,"y":300,"wires":[["e96dc5c1.37af88"]]},{"id":"73e880d8.83941","type":"inject","z":"92902cbf.e28a4","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":360,"wires":[["e96dc5c1.37af88"]]}]

Yeah, I get it. But this is more towards only allowing one message to get through then you can spend as much time as you want looking through the debug nodes and their data.

It isn't to do with looking at parts of payloads.

I get that you can select nodes to display. But noobs may not get all that. This allows 1 message and you can have all your debug nodes active and not worry about other messages coming through and messing up that at which you are looking.

I agree.
But not wanting to shoot myself in the foot - as I love using extra nodes now and then - but it was just a quick option to clock 1 message through.

I do have that node and need to apply it to other places in my flows for other reasons.

1 Like