# Activate or deactivate a node according the state of a switch

**URL:** <https://discourse.nodered.org/t/activate-or-deactivate-a-node-according-the-state-of-a-switch/27244>\
**Category:** Dashboard\
**Created:** [25 May 2020 08:47 UTC](https://discourse.nodered.org/t/activate-or-deactivate-a-node-according-the-state-of-a-switch/27244 "2020-05-25T08:47:13Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![zanonim](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zanonim](https://discourse.nodered.org/u/zanonim)\
**Post date:** [25 May 2020 08:47 UTC](https://discourse.nodered.org/t/activate-or-deactivate-a-node-according-the-state-of-a-switch/27244/1 "2020-05-25T08:47:13Z")

</div>

Hi

Would it be possible to make a switch node active or inactive in a dashboard according to the status of another switch?  
For example, if switch "A" closes the flow of water, switch "B" which allows you to choose whether hot or cold water must be disabled.

Many tks  
Marco

---

<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:** [25 May 2020 08:59 UTC](https://discourse.nodered.org/t/activate-or-deactivate-a-node-according-the-state-of-a-switch/27244/2 "2020-05-25T08:59:35Z")

</div>

Hi Marco, welcome to the forum.  
You could use `node-red-contrib-simple-gate` to disable the hot/cold water part of the flow.

---

<div class="post-metadata">

**Author:** ![ristomatti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ristomatti/32/5857_2.png) [@ristomatti](https://discourse.nodered.org/u/ristomatti)\
**Post date:** [25 May 2020 09:12 UTC](https://discourse.nodered.org/t/activate-or-deactivate-a-node-according-the-state-of-a-switch/27244/3 "2020-05-25T09:12:23Z")

</div>

I think Marco was asking how to change a dashboard switch to a disabled/inactive state.

I cannot help with this myself unfortunately as I've yet to use Dashboard at all...

---

<div class="post-metadata">

**Author:** ![zanonim](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zanonim](https://discourse.nodered.org/u/zanonim)\
**Post date:** [25 May 2020 09:21 UTC](https://discourse.nodered.org/t/activate-or-deactivate-a-node-according-the-state-of-a-switch/27244/4 "2020-05-25T09:21:18Z")

</div>

Hi Paul  
many tks.  
Yes with node-red-contrib-simple-gate is possible control the message from the hot/cold switch to the "actuator", but the hot/cold switch is visible and active.  
My question is: is it possible disable or "make disappear" the switch image from the dashboard? or is there any other way to achieve the same result ?

M

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [25 May 2020 09:47 UTC](https://discourse.nodered.org/t/activate-or-deactivate-a-node-according-the-state-of-a-switch/27244/5 "2020-05-25T09:47:50Z")

</div>

Select the switch node and read the built in help on the info panel. I seem to remember it saying you can pass a property in the msg to disable/enable it. Either that or the ui\_control node.

Also, fairly certain this has been asked and answered quite a few times - Search the forum for clues.

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [25 May 2020 09:50 UTC](https://discourse.nodered.org/t/activate-or-deactivate-a-node-according-the-state-of-a-switch/27244/6 "2020-05-25T09:50:28Z")

</div>

Here you go...  
Setting `msg.enabled` to `false` will disable the switch widget.

---

<div class="post-metadata">

**Author:** ![zanonim](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zanonim](https://discourse.nodered.org/u/zanonim)\
**Post date:** [25 May 2020 10:42 UTC](https://discourse.nodered.org/t/activate-or-deactivate-a-node-according-the-state-of-a-switch/27244/7 "2020-05-25T10:42:05Z")

</div>

thanks a lot to everyone

Marco

---

<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:** [24 June 2020 10:42 UTC](https://discourse.nodered.org/t/activate-or-deactivate-a-node-according-the-state-of-a-switch/27244/8 "2020-06-24T10:42:15Z")

</div>

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