# Looking for a node with a button like the inject and debug nodes

**URL:** <https://discourse.nodered.org/t/looking-for-a-node-with-a-button-like-the-inject-and-debug-nodes/84986>\
**Category:** General\
**Created:** [28 January 2024 11:55 UTC](https://discourse.nodered.org/t/looking-for-a-node-with-a-button-like-the-inject-and-debug-nodes/84986 "2024-01-28T11:55:25Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![stevegroom](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevegroom/32/19591_2.png) [@stevegroom](https://discourse.nodered.org/u/stevegroom)\
**Post date:** [28 January 2024 11:55 UTC](https://discourse.nodered.org/t/looking-for-a-node-with-a-button-like-the-inject-and-debug-nodes/84986/1 "2024-01-28T11:55:25Z")

</div>

Hello,  
I'm trying to develop and debug a complex flow and am looking for a simple way to enable or disable parts of the flow (without the disable/deploy actions).

I like the UI of the Inject and Debug nodes, and want something that passes messages if the node is enabled (via a button).

Is there a similar node (with a button) that passes a message if its button is enabled?

alternate question

How can I configure a debug node passthrough a message?

Steve

---

<div class="post-metadata">

**Author:** ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)\
**Post date:** [28 January 2024 12:00 UTC](https://discourse.nodered.org/t/looking-for-a-node-with-a-button-like-the-inject-and-debug-nodes/84986/2 "2024-01-28T12:00:00Z")

</div>

Have a look at [node-red-contrib-simple-gate (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-simple-gate)  
This should do the trick for you.

---

<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:** [28 January 2024 12:09 UTC](https://discourse.nodered.org/t/looking-for-a-node-with-a-button-like-the-inject-and-debug-nodes/84986/3 "2024-01-28T12:09:31Z")

</div>

The gate node in conjunction with two Inject nodes is the way to do it.

> [@stevegroom](#):
>
> How can I configure a debug node passthrough a message?

You can't, just wire round it.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/7/77245d87318ec6e58899d154c4a7af4c6e915135.png)

---

<div class="post-metadata">

**Author:** ![stevegroom](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevegroom/32/19591_2.png) [@stevegroom](https://discourse.nodered.org/u/stevegroom)\
**Post date:** [28 January 2024 13:17 UTC](https://discourse.nodered.org/t/looking-for-a-node-with-a-button-like-the-inject-and-debug-nodes/84986/4 "2024-01-28T13:17:19Z")

</div>

> [@Colin](#):
>
> You can't, just wire round it.

Yes, but this will execute the subsequent nodes regardless of whether I'm debugging.

---

<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:** [28 January 2024 13:23 UTC](https://discourse.nodered.org/t/looking-for-a-node-with-a-button-like-the-inject-and-debug-nodes/84986/5 "2024-01-28T13:23:09Z")

</div>

Yes it will.

---

<div class="post-metadata">

**Author:** ![ralphwetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ralphwetzel/32/53713_2.png) [@ralphwetzel](https://discourse.nodered.org/u/ralphwetzel)\
**Post date:** [28 January 2024 13:51 UTC](https://discourse.nodered.org/t/looking-for-a-node-with-a-button-like-the-inject-and-debug-nodes/84986/6 "2024-01-28T13:51:35Z")

</div>

> [@stevegroom](#):
>
> I'm trying to develop and debug a complex flow and am looking for a simple way to enable or disable parts of the flow (without the disable/deploy actions).

Did you check if [node-red-debugger](https://flows.nodered.org/node/node-red-debugger) fulfills your demands?

---

<div class="post-metadata">

**Author:** ![stevegroom](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevegroom/32/19591_2.png) [@stevegroom](https://discourse.nodered.org/u/stevegroom)\
**Post date:** [28 January 2024 14:01 UTC](https://discourse.nodered.org/t/looking-for-a-node-with-a-button-like-the-inject-and-debug-nodes/84986/7 "2024-01-28T14:01:46Z")

</div>

Thanks' [edje11](https://discourse.nodered.org/u/edje11) , that pointed me in the right direction.

I prefer not adding nodes, but the answers here and reviewing the node helped me to find my own solution.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/f/1f43330ec6f2471e60b8706cde49f8b938ee7030.png)

```json
[{"id":"76cf0836193ab9eb","type":"group","z":"560a48e311b7eb68","name":"Block or Enable messages to flow","style":{"stroke":"#6f2fa0","fill":"#dbcbe7","label":true,"color":"#000000"},"nodes":["36cb18b26d858526","16d906f2c36a0d37","44e1f702b6d85138","126349533dc29422","401b37ac4d521152","099ae275e7016813","f3a75c2f2eecb8e5","312034a2180d9905","465f5a4e3452cd18","b31e594af6f2b7e8"],"x":154,"y":3919,"w":992,"h":222},{"id":"36cb18b26d858526","type":"inject","z":"560a48e311b7eb68","g":"76cf0836193ab9eb","name":"close","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"closed","payloadType":"str","x":250,"y":3960,"wires":[["099ae275e7016813"]]},{"id":"16d906f2c36a0d37","type":"inject","z":"560a48e311b7eb68","g":"76cf0836193ab9eb","name":"open","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"open","payloadType":"str","x":250,"y":4000,"wires":[["099ae275e7016813"]]},{"id":"44e1f702b6d85138","type":"inject","z":"560a48e311b7eb68","g":"76cf0836193ab9eb","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{ \"class\": \"red\", \"size\": 1, \"returnable\": true}","payloadType":"json","x":250,"y":4100,"wires":[["b31e594af6f2b7e8"]]},{"id":"126349533dc29422","type":"switch","z":"560a48e311b7eb68","g":"76cf0836193ab9eb","name":"Stop when closed","property":"payload.state","propertyType":"msg","rules":[{"t":"eq","v":"closed","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":750,"y":4100,"wires":[[],["401b37ac4d521152"]]},{"id":"401b37ac4d521152","type":"debug","z":"560a48e311b7eb68","g":"76cf0836193ab9eb","name":"Debug when open","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1010,"y":4100,"wires":[]},{"id":"099ae275e7016813","type":"function","z":"560a48e311b7eb68","g":"76cf0836193ab9eb","name":"Save env.state","func":"\nflow.set('state', msg.payload);\n\nmsg.payload = flow.get('state')\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":500,"y":3960,"wires":[["f3a75c2f2eecb8e5"]]},{"id":"f3a75c2f2eecb8e5","type":"debug","z":"560a48e311b7eb68","g":"76cf0836193ab9eb","name":"State","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":710,"y":3960,"wires":[]},{"id":"312034a2180d9905","type":"inject","z":"560a48e311b7eb68","g":"76cf0836193ab9eb","name":"Query state","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"${state}","payloadType":"env","x":270,"y":4040,"wires":[["465f5a4e3452cd18"]]},{"id":"465f5a4e3452cd18","type":"function","z":"560a48e311b7eb68","g":"76cf0836193ab9eb","name":"Get env.state","func":"\nmsg.payload = flow.get('state')\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":490,"y":4000,"wires":[["f3a75c2f2eecb8e5"]]},{"id":"b31e594af6f2b7e8","type":"function","z":"560a48e311b7eb68","g":"76cf0836193ab9eb","name":"Inject env.state","func":"\nmsg.payload.state = flow.get('state')\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":4100,"wires":[["126349533dc29422"]]}]

```

thanks for the replies

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [28 January 2024 14:03 UTC](https://discourse.nodered.org/t/looking-for-a-node-with-a-button-like-the-inject-and-debug-nodes/84986/8 "2024-01-28T14:03:10Z")

</div>

You could use a flow context variable and a switch node.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/4/943a0d06c2802fb7acc5005e8d56381949206f70.png)

---

<div class="post-metadata">

**Author:** ![stevegroom](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevegroom/32/19591_2.png) [@stevegroom](https://discourse.nodered.org/u/stevegroom)\
**Post date:** [28 January 2024 14:32 UTC](https://discourse.nodered.org/t/looking-for-a-node-with-a-button-like-the-inject-and-debug-nodes/84986/9 "2024-01-28T14:32:55Z")

</div>

Ah yes, that makes it cleaner.

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

```json
[{"id":"8aad15f1d1a9acda","type":"group","z":"560a48e311b7eb68","name":"Block or Enable messages to flow","style":{"stroke":"#6f2fa0","fill":"#dbcbe7","label":true,"color":"#000000"},"nodes":["f7216dd244dbc547","862ef72ed4f658a5","79e72b836d5bbfe2","c4e8bd36d12cad8b","06645f8b54715159","3500426c63d0c9f4","1bf877be9626839f","7e142f51c44d7419","280dec3cdd28bdc2","564967cd7bd5b02c"],"x":174,"y":4339,"w":792,"h":222},{"id":"f7216dd244dbc547","type":"inject","z":"560a48e311b7eb68","g":"8aad15f1d1a9acda","name":"Debug=true","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":290,"y":4380,"wires":[["1bf877be9626839f"]]},{"id":"862ef72ed4f658a5","type":"inject","z":"560a48e311b7eb68","g":"8aad15f1d1a9acda","name":"Debug=false","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":290,"y":4420,"wires":[["7e142f51c44d7419"]]},{"id":"79e72b836d5bbfe2","type":"inject","z":"560a48e311b7eb68","g":"8aad15f1d1a9acda","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{ \"class\": \"red\", \"size\": 1, \"returnable\": true}","payloadType":"json","x":270,"y":4520,"wires":[["c4e8bd36d12cad8b"]]},{"id":"c4e8bd36d12cad8b","type":"switch","z":"560a48e311b7eb68","g":"8aad15f1d1a9acda","name":"Pass when debugging","property":"debug","propertyType":"flow","rules":[{"t":"true"}],"checkall":"false","repair":false,"outputs":1,"x":540,"y":4520,"wires":[["280dec3cdd28bdc2"]]},{"id":"06645f8b54715159","type":"debug","z":"560a48e311b7eb68","g":"8aad15f1d1a9acda","name":"State","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"\"Debugging \" & msg.payload","statusType":"jsonata","x":770,"y":4380,"wires":[]},{"id":"3500426c63d0c9f4","type":"inject","z":"560a48e311b7eb68","g":"8aad15f1d1a9acda","name":"Query debug","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":290,"y":4460,"wires":[["564967cd7bd5b02c"]]},{"id":"1bf877be9626839f","type":"change","z":"560a48e311b7eb68","g":"8aad15f1d1a9acda","name":"","rules":[{"t":"set","p":"debug","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":4380,"wires":[["06645f8b54715159"]]},{"id":"7e142f51c44d7419","type":"change","z":"560a48e311b7eb68","g":"8aad15f1d1a9acda","name":"","rules":[{"t":"set","p":"debug","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":4420,"wires":[["06645f8b54715159"]]},{"id":"280dec3cdd28bdc2","type":"debug","z":"560a48e311b7eb68","g":"8aad15f1d1a9acda","name":"Only when flow.debug=true","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":800,"y":4520,"wires":[]},{"id":"564967cd7bd5b02c","type":"change","z":"560a48e311b7eb68","g":"8aad15f1d1a9acda","name":"get flow.debug","rules":[{"t":"set","p":"payload","pt":"msg","to":"debug","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":4460,"wires":[["06645f8b54715159"]]}]

```

Thanks' everyone

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [28 January 2024 15:03 UTC](https://discourse.nodered.org/t/looking-for-a-node-with-a-button-like-the-inject-and-debug-nodes/84986/10 "2024-01-28T15:03:57Z")

</div>

And to tidy up debugging on your complex flow you can use a link out node.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/7/779e0edc7d59f405389554ec0d2d3011cd5dc5cb.png)

If you use a global context variable the link in etc can be on a seperate tab. Then to debug at any point you just need to insert a link-out.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [28 January 2024 15:50 UTC](https://discourse.nodered.org/t/looking-for-a-node-with-a-button-like-the-inject-and-debug-nodes/84986/11 "2024-01-28T15:50:57Z")

</div>

Or a subflow gate that can be toggled with a control message inject node, and can be named to lock multiple with same named toggle\_pass subflows environment variable at same time.  
e,g,

```auto
[{"id":"2a40819a70e49c9a","type":"subflow","name":"toggle pass","info":"","category":"","in":[{"x":40,"y":160,"wires":[{"id":"9ad7eb17b887a806"}]}],"out":[{"x":740,"y":160,"wires":[{"id":"9ad7eb17b887a806","port":0}]}],"env":[{"name":"name","type":"str","value":"default","ui":{"label":{"en-US":"name"},"type":"input","opts":{"types":["str"]}}}],"meta":{},"color":"#DDAA99","status":{"x":420,"y":240,"wires":[{"id":"9ad7eb17b887a806","port":1}]}},{"id":"9ad7eb17b887a806","type":"function","z":"2a40819a70e49c9a","name":"function 152","func":"let pass = global.get(\"toggle_pass.\" + env.get(\"name\") ) ?? true\nif(msg.control){\n if(msg.control === \"toggle\"){\n pass = !pass; \n }else if(msg.control === \"startup\"){\n }\n msg = null;\n global.set(\"toggle_pass.\" + env.get(\"name\"), pass);\n}\nif(!pass){\n msg = null\n}\nlet msg1 = {\n payload:{\n fill: pass ? \"green\" : \"red\", \n shape: \"dot\"\n }\n}\nreturn [msg, msg1];","outputs":2,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":290,"y":160,"wires":[[],[]]},{"id":"881626a80c2af3a8","type":"inject","z":"2a40819a70e49c9a","name":"","props":[{"p":"control","v":"startup","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":150,"y":80,"wires":[["9ad7eb17b887a806"]]},{"id":"2e946fdc95a718cf","type":"inject","z":"d1395164b4eec73e","name":"toggle","props":[{"p":"control","v":"toggle","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":370,"y":5280,"wires":[["c0ac81aa744bde13"]]},{"id":"2f495e9cbbb9e473","type":"debug","z":"d1395164b4eec73e","name":"debug 2476","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":590,"y":5320,"wires":[]},{"id":"3e66623a917ea369","type":"inject","z":"d1395164b4eec73e","name":"message","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":5340,"wires":[["c0ac81aa744bde13","d346cae4c36d61d5","2dbea1203762970c"]]},{"id":"c0ac81aa744bde13","type":"subflow:2a40819a70e49c9a","z":"d1395164b4eec73e","name":"","x":390,"y":5320,"wires":[["2f495e9cbbb9e473"]]},{"id":"d346cae4c36d61d5","type":"subflow:2a40819a70e49c9a","z":"d1395164b4eec73e","name":"","env":[{"name":"name","value":"name1","type":"str"}],"x":410,"y":5400,"wires":[["45431aedcf78e6da"]]},{"id":"2dbea1203762970c","type":"subflow:2a40819a70e49c9a","z":"d1395164b4eec73e","name":"","x":410,"y":5460,"wires":[["4a5e3668707d90ef"]]},{"id":"5213c0261058d98d","type":"inject","z":"d1395164b4eec73e","name":"toggle","props":[{"p":"control","v":"toggle","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":430,"y":5360,"wires":[["d346cae4c36d61d5"]]},{"id":"45431aedcf78e6da","type":"debug","z":"d1395164b4eec73e","name":"debug 2477","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":610,"y":5400,"wires":[]},{"id":"4a5e3668707d90ef","type":"debug","z":"d1395164b4eec73e","name":"debug 2478","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":610,"y":5460,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![stevegroom](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevegroom/32/19591_2.png) [@stevegroom](https://discourse.nodered.org/u/stevegroom)\
**Post date:** [31 January 2024 14:20 UTC](https://discourse.nodered.org/t/looking-for-a-node-with-a-button-like-the-inject-and-debug-nodes/84986/12 "2024-01-31T14:20:18Z")

</div>

That's an eloquent approach 👍

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [14 February 2024 14:21 UTC](https://discourse.nodered.org/t/looking-for-a-node-with-a-button-like-the-inject-and-debug-nodes/84986/13 "2024-02-14T14:21:13Z")

</div>

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