# Value through switch permanently

**URL:** https://discourse.nodered.org/t/value-through-switch-permanently/30102
**Category:** Dashboard
**Created:** [15 July 2020 06:42 UTC](https://discourse.nodered.org/t/value-through-switch-permanently/30102 "2020-07-15T06:42:51Z")
**Posts on this page:** 20
**Page:** 4

<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: [17 July 2020 07:18 UTC](https://discourse.nodered.org/t/value-through-switch-permanently/30102/61 "2020-07-17T07:18:15Z")

</div>

> [@Chorum](#):
>
> For the rate of the MQTT Messages - wich machine has to be strong, the one that sends or the one that Displays or the Broker ? Perhaps i want to much...

The machine getting the messages that fast and having to parse the messages, process them and put the data on the chart.

That is a lot of work for the machine.

The one sending is doing that quite happily now already.

---

<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: [17 July 2020 07:20 UTC](https://discourse.nodered.org/t/value-through-switch-permanently/30102/62 "2020-07-17T07:20:31Z")

</div>

The flow:

```auto
[{"id":"e9b9dd78.e10f1","type":"ui_switch","z":"af61c022.bc96e","name":"","label":"{{msg.payload.MQTTWert1name}}","tooltip":"","group":"22029319.b38d4c","order":1,"width":"3","height":"1","passthru":false,"decouple":"false","topic":"ATESTEO/Wolfsburg/W16","style":"","onvalue":"true","onvalueType":"str","onicon":"","oncolor":"","offvalue":"false","offvalueType":"str","officon":"","offcolor":"","x":3800,"y":2310,"wires":[["fef7d669.96ce98","2c2043b2.4cb60c"]]},{"id":"fef7d669.96ce98","type":"change","z":"af61c022.bc96e","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"Wertcheck1","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":4000,"y":2310,"wires":[[]]},{"id":"80fe1189.5a0ff","type":"change","z":"af61c022.bc96e","name":"","rules":[{"t":"delete","p":"payload.MQTTWert1","pt":"msg"},{"t":"delete","p":"payload.MQTTWert2","pt":"msg"},{"t":"delete","p":"payload.MQTTWert3","pt":"msg"},{"t":"delete","p":"payload.MQTTWert4","pt":"msg"},{"t":"delete","p":"payload.Status","pt":"msg"},{"t":"delete","p":"payload.MQTTWert2name","pt":"msg"},{"t":"delete","p":"payload.MQTTWert3name","pt":"msg"},{"t":"delete","p":"payload.MQTTWert4name","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":3560,"y":2310,"wires":[["e9b9dd78.e10f1"]]},{"id":"2c2043b2.4cb60c","type":"trigger","z":"af61c022.bc96e","op1":"true","op2":"off","op1type":"str","op2type":"str","duration":"0","extend":true,"units":"s","reset":"false","bytopic":"all","name":"","x":3810,"y":2370,"wires":[["e9b9dd78.e10f1"]]},{"id":"22029319.b38d4c","type":"ui_group","z":"","name":"Messwerte auswählen","tab":"ec7a53af.4ac29","order":1,"disp":true,"width":"29","collapse":false},{"id":"ec7a53af.4ac29","type":"ui_tab","z":"","name":"W16-Chart","icon":"dashboard","order":11,"disabled":false,"hidden":false}]

```

I am not happy with it because I am really not sure it will work for what you want.  
Though, if it works: good.

---

<div class="post-metadata">

### Author: ![Chorum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chorum/32/47644_2.png) [@Chorum](https://discourse.nodered.org/u/Chorum)
#### Post date: [17 July 2020 07:47 UTC](https://discourse.nodered.org/t/value-through-switch-permanently/30102/63 "2020-07-17T07:47:19Z")

</div>

What happend:

1. only switch 1 is "on"
2. inject (first msg object)
3. switch 1 goes "off" on first inject
4. second inject with all switches on "off" but payload goes through (second msg object)

So here is a Screenshot:

 ![Switchtest](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/2/f2db23820a1f031f797654bba9644cf8b42bc2de.jpeg)

---

<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: [17 July 2020 08:16 UTC](https://discourse.nodered.org/t/value-through-switch-permanently/30102/64 "2020-07-17T08:16:28Z")

</div>

Ok, that is a bit hard to read the outputs.  
**EDIT** sorry. Clicked on picture and looked.  
There isn't really much showing me that you are getting the _wrong_ value sent.  
It looks like the right value. `25.1`. Which is what I get.

But what "bugs" me is:  
You have `debug1` turned on.

The other `function` nodes (may) need to be turned `off`. Turn them on then off. Just to be sure. Though I have made them block by default, it would be nice to see the red dots below the nodes.

I am not saying what you say is wrong, but as I said, I can't really read the output.

Please turn off `debug1` and turn on `debug a`, `debug b`, `debug c` and `debug d`.

What happens then?

I have `debug a` turned on and press the `inject` time and time again and only see `25.1` in/on `debug a`.

 ![Screenshot from 2020-07-17 18-14-45](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/2/726946f963c809cd7d8b5e249ac832a6a5cbcf0c.png)

---

<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: [17 July 2020 08:19 UTC](https://discourse.nodered.org/t/value-through-switch-permanently/30102/65 "2020-07-17T08:19:16Z")

</div>

> [@Chorum](#):
>
> switch 1 goes "off" on first inject

Please don't worry too much abut that. Look at the `function` node and see the colour of the dot below it.

Red or Green. This is really what is happening. I know it is a bit confusing, but please, trust me.

 ![Screenshot from 2020-07-17 18-14-45](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/9/f96b154464750c9e382daf82f598e631be280710.png)

---

<div class="post-metadata">

### Author: ![Chorum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chorum/32/47644_2.png) [@Chorum](https://discourse.nodered.org/u/Chorum)
#### Post date: [17 July 2020 08:40 UTC](https://discourse.nodered.org/t/value-through-switch-permanently/30102/66 "2020-07-17T08:40:05Z")

</div>

So i did like u asked

1. only debug's a,b,c,d activ
2. switches on / off and stayed on "off"
3. 
  1. inject - no pass through - ok

4. 
  1. inject with first switch on "on" - switch sets to "off" and payload passes through

5. 
  1. inject with now all switches "off" - payload passes through (funktion node is on pass)

Screenshot:

 ![Switchtest2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/8/f8bb892edd996a11606cc1a5871b5a4824f2eabf.jpeg)

---

<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: [17 July 2020 08:42 UTC](https://discourse.nodered.org/t/value-through-switch-permanently/30102/67 "2020-07-17T08:42:22Z")

</div>

I want to check if this doing what you want?

Change the switch positions and press the `inject` node and see if **only** those messages get through.

---

<div class="post-metadata">

### Author: ![Chorum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chorum/32/47644_2.png) [@Chorum](https://discourse.nodered.org/u/Chorum)
#### Post date: [17 July 2020 08:44 UTC](https://discourse.nodered.org/t/value-through-switch-permanently/30102/68 "2020-07-17T08:44:41Z")

</div>

this flow doesnt work for me, because it lets payload pass with switch on "off".

in around 2 Hours i will test my actual solution with 8 values and report back.

till then i wanna find a way to send values to the original Sender of the values

---

<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: [17 July 2020 08:45 UTC](https://discourse.nodered.org/t/value-through-switch-permanently/30102/69 "2020-07-17T08:45:25Z")

</div>

> [@Chorum](#):
>
> because it lets payload pass with switch on "off".

Where is it letting through messages when the switch is off?

---

<div class="post-metadata">

### Author: ![Chorum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chorum/32/47644_2.png) [@Chorum](https://discourse.nodered.org/u/Chorum)
#### Post date: [17 July 2020 08:47 UTC](https://discourse.nodered.org/t/value-through-switch-permanently/30102/70 "2020-07-17T08:47:46Z")

</div>

on the debugs a,b,c,d

---

<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: [17 July 2020 08:49 UTC](https://discourse.nodered.org/t/value-through-switch-permanently/30102/71 "2020-07-17T08:49:50Z")

</div>

No, only `a`. Take another look

![foo](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/2/320a9835d9f7a8a887a86afb7e8e18cbd7bdf5f3.jpeg)

Only `a` (or the first one) is passing messages.

Only one output is received per injection.  
I am taking it you pressed the `inject` node twice when you took this picture.

Turn on all 4 and press the `inject` and you will see four messages.

There seems to be a serious confusion to what is wanted and what is being seen and expected.

---

<div class="post-metadata">

### Author: ![Chorum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chorum/32/47644_2.png) [@Chorum](https://discourse.nodered.org/u/Chorum)
#### Post date: [17 July 2020 08:55 UTC](https://discourse.nodered.org/t/value-through-switch-permanently/30102/72 "2020-07-17T08:55:12Z")

</div>

Sorry wrong screen...

second payload set is while every switch is on "off"

 ![Switchtest3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/6/b67b01e1bdd5dc4b692fd1672f930f162f94ae4a.jpeg)

---

<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: [17 July 2020 09:00 UTC](https://discourse.nodered.org/t/value-through-switch-permanently/30102/73 "2020-07-17T09:00:42Z")

</div>

> [@Chorum](#):
>
> Sorry wrong screen...

(Bangs head against wall)  
Ok, it happens.

Deep breath.

Ok. The _switch_ says off. **look at the `function` node state**.

Go to the GUI (dashboard) and make sure the switches are set to the _OFF_ position.  
If they are, turn them on, the back to off and try again.

Do **NOT** use the indication of the `switch` node to determine what is going on.  
The `function` node determines that. There may be a bit of a set up glitch so I strongly suggest you toggle the switches and make sure the **graphical** state of the `switch` matches the `function` node.

Mine is working fine. There is something happening somewhere which is causing a lot of grief.

I have tested it time and time again and it works.

By the way:  
What do call `ON` and `OFF` on the graphic side of the `switch` node?

![Screenshot from 2020-07-17 19-02-41](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/1/11e4b110bd2f2cf6be7d1dc3d2e6a9dd104bfba1.png)

![Screenshot from 2020-07-17 19-05-26](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/3/a3084a382924e1f60e522400a8db67d96902d6c3.png)

They match

---

<div class="post-metadata">

### Author: ![Chorum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chorum/32/47644_2.png) [@Chorum](https://discourse.nodered.org/u/Chorum)
#### Post date: [17 July 2020 09:44 UTC](https://discourse.nodered.org/t/value-through-switch-permanently/30102/74 "2020-07-17T09:44:48Z")

</div>

I did it exactly like u wrote. But it works like i wrote.

on the graphic side i do not have any "on" or "off" like you have...

---

<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: [17 July 2020 09:46 UTC](https://discourse.nodered.org/t/value-through-switch-permanently/30102/75 "2020-07-17T09:46:12Z")

</div>

The `on` and `off` are there to show the difference and which I show as `on` and which is `off`.

So when you set the `switches` from the GUI side, what do the `function` nodes do?

---

<div class="post-metadata">

### Author: ![Chorum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chorum/32/47644_2.png) [@Chorum](https://discourse.nodered.org/u/Chorum)
#### Post date: [17 July 2020 09:48 UTC](https://discourse.nodered.org/t/value-through-switch-permanently/30102/76 "2020-07-17T09:48:19Z")

</div>

They go on "Block" like intended i think…  
ahh u inserted These on & off to the switches 🙂  
I didnt realized that...

---

<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: [17 July 2020 09:50 UTC](https://discourse.nodered.org/t/value-through-switch-permanently/30102/77 "2020-07-17T09:50:19Z")

</div>

Set the GUI switches as I had. (Take screen shot and post)  
Then flip to the edit screen and show the state of the 4 `function` nodes.

Similar to what I did, but you can have the 4 switches are you want.

Oh, the screen shots. Please don't post JPG type. They are bad if I need to load, edit and re-post. Try PNG format please.

For you to do if you want, have two windows open. One is the GUI and one is the EDIT screen.

Then as you move the GUI switches you can see the `function` nodes change their state.  
In fact you could have the two window on the screen shot if you want.

Something like:

 ![Screenshot from 2020-07-17 19-57-49](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/1/117495dbed0ebe1be75cdbe81dd502c68828eede.png)

As you move the switches you see the `function` nodes change their state.

---

<div class="post-metadata">

### Author: ![Chorum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chorum/32/47644_2.png) [@Chorum](https://discourse.nodered.org/u/Chorum)
#### Post date: [17 July 2020 10:00 UTC](https://discourse.nodered.org/t/value-through-switch-permanently/30102/78 "2020-07-17T10:00:10Z")

</div>

Ok so here are the proofing screenshots 🙂

1. All to "off" as starting Point  

2. After Setting two switches to "on"  

3. After the first inject (doesnt change with more injects)  

Debugs a & c keep going getting values.

---

<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: [17 July 2020 10:01 UTC](https://discourse.nodered.org/t/value-through-switch-permanently/30102/79 "2020-07-17T10:01:41Z")

</div>

> [@Chorum](#):
>
> Debugs a & c keep going getting values.

Yes they will because the switches are still `ON`.

(What am I missing?)

The switches are ON, they allow the _message_. They are OFF the block the _message_.

That is what is happening.

---

<div class="post-metadata">

### Author: ![Chorum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chorum/32/47644_2.png) [@Chorum](https://discourse.nodered.org/u/Chorum)
#### Post date: [17 July 2020 10:03 UTC](https://discourse.nodered.org/t/value-through-switch-permanently/30102/80 "2020-07-17T10:03:00Z")

</div>

the switches are off? i dont see switches at "on"

[Previous page](https://discourse.nodered.org/t/value-through-switch-permanently/30102.md?page=3)

[Next page](https://discourse.nodered.org/t/value-through-switch-permanently/30102.md?page=5)
