# Lead node and switch control question

**URL:** https://discourse.nodered.org/t/lead-node-and-switch-control-question/33284
**Category:** General
**Created:** [24 September 2020 13:10 UTC](https://discourse.nodered.org/t/lead-node-and-switch-control-question/33284 "2020-09-24T13:10:32Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![murondo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/murondo/32/29014_2.png) [@murondo](https://discourse.nodered.org/u/murondo)
#### Post date: [24 September 2020 13:10 UTC](https://discourse.nodered.org/t/lead-node-and-switch-control-question/33284/1 "2020-09-24T13:10:32Z")

</div>

When you first switch on, you want to turn on the rest of the switches and LEDs, and when you turn off the other switches, how do you use a function to turn them off?

```auto
[{"id":"9258950d.6aefa8","type":"ui_led","z":"1a00439c.9ac83c","group":"953b7c08.766c6","order":1,"width":"1","height":"1","label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"red","value":"false","valueType":"bool"},{"color":"green","value":"true","valueType":"bool"}],"allowColorForValueInMessage":false,"name":"","x":990,"y":600,"wires":[]},{"id":"71ddd53.a58682c","type":"ui_switch","z":"1a00439c.9ac83c","name":"","label":"전체 ON/OFF","tooltip":"","group":"953b7c08.766c6","order":2,"width":"5","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"false","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"true","offvalueType":"bool","officon":"","offcolor":"","x":380,"y":680,"wires":[["9258950d.6aefa8","230ab659.0f1b1a","46d5acab.b40b24","20e4a896.7ffca8","58fc8851.302508"]]},{"id":"951ff001.20c6","type":"ui_led","z":"1a00439c.9ac83c","group":"953b7c08.766c6","order":3,"width":"1","height":"1","label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"red","value":"false","valueType":"bool"},{"color":"green","value":"true","valueType":"bool"}],"allowColorForValueInMessage":false,"name":"","x":990,"y":680,"wires":[]},{"id":"1bf2728.78c778e","type":"ui_switch","z":"1a00439c.9ac83c","name":"","label":"수중펌프 1번 스위치","tooltip":"","group":"953b7c08.766c6","order":4,"width":"5","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"false","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"true","offvalueType":"bool","officon":"","offcolor":"","x":400,"y":760,"wires":[["951ff001.20c6","230ab659.0f1b1a"]]},{"id":"76b815c4.ba594c","type":"ui_led","z":"1a00439c.9ac83c","group":"953b7c08.766c6","order":5,"width":"1","height":"1","label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"red","value":"false","valueType":"bool"},{"color":"green","value":"true","valueType":"bool"}],"allowColorForValueInMessage":false,"name":"","x":990,"y":780,"wires":[]},{"id":"c8b59f7f.9c766","type":"ui_switch","z":"1a00439c.9ac83c","name":"","label":"수중펌프 2번 스위치","tooltip":"","group":"953b7c08.766c6","order":5,"width":"5","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"false","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"true","offvalueType":"bool","officon":"","offcolor":"","x":400,"y":840,"wires":[["76b815c4.ba594c","46d5acab.b40b24"]]},{"id":"24ac5b36.1e7114","type":"ui_led","z":"1a00439c.9ac83c","group":"953b7c08.766c6","order":6,"width":"1","height":"1","label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"red","value":"false","valueType":"bool"},{"color":"green","value":"true","valueType":"bool"}],"allowColorForValueInMessage":false,"name":"","x":990,"y":880,"wires":[]},{"id":"de4df264.ca326","type":"ui_switch","z":"1a00439c.9ac83c","name":"","label":"물주기 스위치","tooltip":"","group":"953b7c08.766c6","order":7,"width":"5","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"false","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"true","offvalueType":"bool","officon":"","offcolor":"","x":380,"y":920,"wires":[["24ac5b36.1e7114","20e4a896.7ffca8"]]},{"id":"4d69616f.c4019","type":"ui_led","z":"1a00439c.9ac83c","group":"953b7c08.766c6","order":8,"width":"1","height":"1","label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"red","value":"false","valueType":"bool"},{"color":"green","value":"true","valueType":"bool"}],"allowColorForValueInMessage":false,"name":"","x":990,"y":980,"wires":[]},{"id":"3833e156.f643ce","type":"ui_switch","z":"1a00439c.9ac83c","name":"","label":"하우스문 개폐","tooltip":"","group":"953b7c08.766c6","order":9,"width":"5","height":"1","passthru":true,"decouple":"false","topic":"","style":"","onvalue":"false","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"true","offvalueType":"bool","officon":"","offcolor":"","x":380,"y":1000,"wires":[["4d69616f.c4019","58fc8851.302508"]]},{"id":"230ab659.0f1b1a","type":"rpi-gpio out","z":"1a00439c.9ac83c","name":"GPIO35Pin","pin":"35","set":true,"level":"1","freq":"","out":"out","x":1010,"y":720,"wires":[]},{"id":"46d5acab.b40b24","type":"rpi-gpio out","z":"1a00439c.9ac83c","name":"GPIO37Pin","pin":"37","set":true,"level":"0","freq":"","out":"out","x":1010,"y":820,"wires":[]},{"id":"20e4a896.7ffca8","type":"rpi-gpio out","z":"1a00439c.9ac83c","name":"GPIO38Pin","pin":"38","set":true,"level":"0","freq":"","out":"out","x":1010,"y":920,"wires":[]},{"id":"58fc8851.302508","type":"rpi-gpio out","z":"1a00439c.9ac83c","name":"GPIO40Pin","pin":"40","set":true,"level":"0","freq":"","out":"out","x":1010,"y":1020,"wires":[]},{"id":"953b7c08.766c6","type":"ui_group","z":"","name":"기기제어반 스위치","tab":"80b7794.6ac0188","order":3,"disp":true,"width":"6","collapse":false},{"id":"80b7794.6ac0188","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

### Author: ![mudwalker](https://avatars.discourse-cdn.com/v4/letter/m/47e85d/32.png) [@mudwalker](https://discourse.nodered.org/u/mudwalker)
#### Post date: [24 September 2020 13:40 UTC](https://discourse.nodered.org/t/lead-node-and-switch-control-question/33284/2 "2020-09-24T13:40:11Z")

</div>

If you are posting your flow, please [read this](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506) and then people will be able to import the flow far more easily to help them help you.

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [24 September 2020 20:15 UTC](https://discourse.nodered.org/t/lead-node-and-switch-control-question/33284/3 "2020-09-24T20:15:35Z")

</div>

(I've edited your flow so it can be imported)

Could you please explain more. When you say:

> When you first switch on, you want to turn on the rest of the switches and LEDs

do you mean when you turn on the first switch or when you start Node-RED?

and please explain a bit more what you want done when you say:

> when you turn off the other switches, how do you use a function to turn them off?

---

<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: [23 November 2020 20:16 UTC](https://discourse.nodered.org/t/lead-node-and-switch-control-question/33284/4 "2020-11-23T20:16:04Z")

</div>

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