# Activate / deactivate a node with a dashboard switsch

**URL:** <https://discourse.nodered.org/t/activate-deactivate-a-node-with-a-dashboard-switsch/13481>\
**Category:** General\
**Created:** [19 July 2019 12:25 UTC](https://discourse.nodered.org/t/activate-deactivate-a-node-with-a-dashboard-switsch/13481 "2019-07-19T12:25:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kiwi\_gamer01](https://avatars.discourse-cdn.com/v4/letter/k/a587f6/32.png) [@Kiwi\_gamer01](https://discourse.nodered.org/u/Kiwi_gamer01)\
**Post date:** [19 July 2019 12:25 UTC](https://discourse.nodered.org/t/activate-deactivate-a-node-with-a-dashboard-switsch/13481/1 "2019-07-19T12:25:27Z")

</div>

How can I use a dashboard switch to enable or disable a node or program section

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [19 July 2019 12:30 UTC](https://discourse.nodered.org/t/activate-deactivate-a-node-with-a-dashboard-switsch/13481/2 "2019-07-19T12:30:30Z")

</div>

Hi Kiwi\_gamer01.

I'm not an expert, but I'll reply.

You may need to explain this a bit more to what you mean.

Node-Red works with events (as I call them) happening and causing other events.  
Nodes if you will.

So you will need a group of nodes (or: flow) doing something first.

Then you would get a `switch` or `button` (from the dashboard) and connect it into a part of the flow.

This would set a condition which the flow detects and then stops doing it until the value is reset to..... what it was before.

Clearer?

I am sure there are examples, but I am still close to the bottom of the ladder and so can't just produce an example.

Sorry, but good luck with your journey.

---

<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:** [19 July 2019 12:40 UTC](https://discourse.nodered.org/t/activate-deactivate-a-node-with-a-dashboard-switsch/13481/3 "2019-07-19T12:40:32Z")

</div>

You cannot disable a flow or node, but as @Trying_to_learn (nearly) said node-red nodes do something when they receive a message. To stop a flow doing anything you need to stop the flow of messages feeding it. There are many ways to do that. For example node-red-contrib-simple-gate provides an easy way of blocking messages, you could feed the switch state in as the gate signal.  
Have a look at that and if it does not do what you need then tell us a bit more about what you are trying to do.

---

<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:** [20 July 2019 11:04 UTC](https://discourse.nodered.org/t/activate-deactivate-a-node-with-a-dashboard-switsch/13481/4 "2019-07-20T11:04:18Z")

</div>

You could also use a switch node of course to do the same thing if you don't want to install any more Nodes.

---

<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:** [20 July 2019 11:20 UTC](https://discourse.nodered.org/t/activate-deactivate-a-node-with-a-dashboard-switsch/13481/5 "2019-07-20T11:20:28Z")

</div>

With the simple\_gate node you can feed the ui\_switch into the gate node (as well as the messages you want to allow through or block) to control the gate. I think with a Switch node you would need to use flow context which makes it more difficult to see what is going on.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [20 July 2019 12:58 UTC](https://discourse.nodered.org/t/activate-deactivate-a-node-with-a-dashboard-switsch/13481/6 "2019-07-20T12:58:07Z")

</div>

+1 for `node-red-contrib-simple-gate`  
I use it on several flows, and especially as it's state persists a reboot.
