# UI Switch node help

**URL:** <https://discourse.nodered.org/t/ui-switch-node-help/20605>\
**Category:** Dashboard\
**Created:** [19 January 2020 23:54 UTC](https://discourse.nodered.org/t/ui-switch-node-help/20605 "2020-01-19T23:54:47Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andrei/32/10446_2.png) [@Andrei](https://discourse.nodered.org/u/Andrei)\
**Post date:** [20 January 2020 00:31 UTC](https://discourse.nodered.org/t/ui-switch-node-help/20605/2 "2020-01-20T00:31:09Z")

</div>

Welcome to the forum @yawstick1

You can use the ui\_switch node to control a gate that will pass or block messages.

Below post is a good reference on how to do that. Good examples there.

> [@Understanding dashboard switch](https://discourse.nodered.org/t/understanding-dashboard-switch/2334/4):
>
> Let the switch be the controller of the gate [{"id":"6f6a991e.4a28d8","type":"function","z":"81c5c63b.6b8288","name":"gate","func":"// read (or initialize) gate state\nvar gateIsOpen = context.get(\"gateIsOpen\") || false;\n\n//message is from switch\nif(msg.topic === \"gate\"){\n gateIsOpen = msg.payload;\n // store the gate state \n context.set(\"gateIsOpen\",gateIsOpen);\n}\n\n// message is from other sources\nelse{\n if(gateIsOpen === true){\n node.status({fill:\"green\",shape:\"ring\",text…

---

_[View the full topic](https://discourse.nodered.org/t/ui-switch-node-help/20605)._
