# Switch node - what is point of Show State of Output option?

**URL:** <https://discourse.nodered.org/t/switch-node-what-is-point-of-show-state-of-output-option/41225>\
**Category:** Dashboard\
**Created:** [18 February 2021 09:48 UTC](https://discourse.nodered.org/t/switch-node-what-is-point-of-show-state-of-output-option/41225 "2021-02-18T09:48:27Z")\
**Posts on this page:** 11\
**Page:** 1

<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:** [18 February 2021 09:48 UTC](https://discourse.nodered.org/t/switch-node-what-is-point-of-show-state-of-output-option/41225/1 "2021-02-18T09:48:27Z")

</div>

With the ui\_switch node, when Pass through messages is _not_ selected, one of the options for Indicator is "Icon shows state of the output". In this mode, when the switch is clicked the visual state changes and the message is sent. Incoming messages are completely ignored, so it is pointless connecting an input. It seems to me that the identical operation is achieved if Pass Through is enabled but no inputs are connected. Am I missing something?  
Perhaps there is a bug and the incoming message is supposed to set the visual indication but not send on a message.

---

<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:** [18 February 2021 09:56 UTC](https://discourse.nodered.org/t/switch-node-what-is-point-of-show-state-of-output-option/41225/2 "2021-02-18T09:56:18Z")

</div>

Last night whilst looking at the `node-red-contrib-ui-multistate-switch` thread, I too tried the same thing, and had the same result, so pleased to see that you've raised this.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [18 February 2021 12:37 UTC](https://discourse.nodered.org/t/switch-node-what-is-point-of-show-state-of-output-option/41225/3 "2021-02-18T12:37:26Z")

</div>

It is only ignoring the msg.payload.... you may also set some of the other fields by using msg properties - like label, icons (and more recently topic) etc... You may want to provide this as feedback from the click - but want to show the instant feedback of the click. OK it is possibly redundant if you craft messages carefully - but like much of Node-RED it has evolved over the years.

---

<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:** [18 February 2021 14:06 UTC](https://discourse.nodered.org/t/switch-node-what-is-point-of-show-state-of-output-option/41225/4 "2021-02-18T14:06:47Z")

</div>

OK, that makes sense. Thanks.

---

<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:** [18 February 2021 14:18 UTC](https://discourse.nodered.org/t/switch-node-what-is-point-of-show-state-of-output-option/41225/5 "2021-02-18T14:18:40Z")

</div>

I was looking at the 'Switch icon shows state of input', as it doesn't seem to work as I'd recalled.  
Take this simple example;

```auto
[{"id":"48b78df7.023ba4","type":"debug","z":"a4801683.1c0448","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":530,"y":3040,"wires":[]},{"id":"e55ea81b.adfdd8","type":"ui_switch","z":"a4801683.1c0448","name":"","label":"switch","tooltip":"","group":"e68a1b8a.416f18","order":21,"width":"3","height":"1","passthru":false,"decouple":"true","topic":"topic","topicType":"msg","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","animate":false,"x":380,"y":3040,"wires":[["48b78df7.023ba4"]]},{"id":"4368bdf2.f7a874","type":"group","z":"a4801683.1c0448","name":"Output from Google Home","style":{"stroke":"#ffC000","fill":"#ffefbf","label":true,"label-position":"n","color":"#000000"},"nodes":["93dd8a1e.9f4538","47fb33e9.23e5ac"],"x":94,"y":2979,"w":193,"h":124},{"id":"93dd8a1e.9f4538","type":"inject","z":"a4801683.1c0448","g":"4368bdf2.f7a874","name":"Light ON","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":200,"y":3020,"wires":[["e55ea81b.adfdd8"]]},{"id":"47fb33e9.23e5ac","type":"inject","z":"a4801683.1c0448","g":"4368bdf2.f7a874","name":"Light OFF","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":201,"y":3062,"wires":[["e55ea81b.adfdd8"]]},{"id":"e68a1b8a.416f18","type":"ui_group","name":"Default","tab":"6952137b.75c85c","order":1,"disp":false,"width":16,"collapse":false},{"id":"6952137b.75c85c","type":"ui_tab","name":"Home","icon":"dashboard","order":12}]

```

Where the switch controls a light, which is also voice controlled via Google Home.  
So the light can be activated by either voice or dashboard.

The readme says;  
"the icon can either track the state of... the input msg.payload, in order to provide a closed loop feedback."

So my expectations were that the switch can activate the light as normal, but if a change was made to the light's status via voice, then that could be fed back to the switch node to reflect the change made, without sending an output (which would cause an endless loop).  
The switch icon would then always be in sync.

But the result is that the switch cannot be changed via the dashboard.

---

<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:** [18 February 2021 14:25 UTC](https://discourse.nodered.org/t/switch-node-what-is-point-of-show-state-of-output-option/41225/6 "2021-02-18T14:25:05Z")

</div>

I can't test your flow at the moment but have you checked that the incoming data _exactly_ matches the values specified in the switch? Numbers vs Strings for example is easy to not notice.

---

<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:** [18 February 2021 15:06 UTC](https://discourse.nodered.org/t/switch-node-what-is-point-of-show-state-of-output-option/41225/7 "2021-02-18T15:06:13Z")

</div>

> [@Colin](#):
>
> have you checked that the incoming data _exactly_ matches the values specified in the switch?

The problem isn't that the incoming data doesn't change the switch icon - it does.  
But as I said above;

> [@Paul-Reed](#):
>
> But the result is that the switch cannot be changed via the dashboard.

...which means that the dashboard switch loses functionality, and is therefore just a visual cue.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [18 February 2021 15:10 UTC](https://discourse.nodered.org/t/switch-node-what-is-point-of-show-state-of-output-option/41225/8 "2021-02-18T15:10:33Z")

</div>

But this is what it would be IRL - with an actual lamp

```auto
[{"id":"48b78df7.023ba4","type":"debug","z":"f2f2e382.3228b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":590,"y":1060,"wires":[]},{"id":"e55ea81b.adfdd8","type":"ui_switch","z":"f2f2e382.3228b","name":"","label":"switch","tooltip":"","group":"e68a1b8a.416f18","order":21,"width":"3","height":"1","passthru":false,"decouple":"true","topic":"topic","topicType":"msg","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","animate":false,"x":400,"y":1060,"wires":[["48b78df7.023ba4","655a0d88.557ff4"]]},{"id":"655a0d88.557ff4","type":"ui_switch","z":"f2f2e382.3228b","name":"","label":"actual lamp","tooltip":"","group":"","order":1,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","animate":false,"x":430,"y":1160,"wires":[["e55ea81b.adfdd8"]]},{"id":"4368bdf2.f7a874","type":"group","z":"f2f2e382.3228b","name":"Output from Google Home","style":{"stroke":"#ffC000","fill":"#ffefbf","label":true,"label-position":"n","color":"#000000"},"nodes":["93dd8a1e.9f4538","47fb33e9.23e5ac"],"x":94,"y":1059,"w":193,"h":124},{"id":"93dd8a1e.9f4538","type":"inject","z":"f2f2e382.3228b","g":"4368bdf2.f7a874","name":"Light ON","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":200,"y":1100,"wires":[["e55ea81b.adfdd8","655a0d88.557ff4"]]},{"id":"47fb33e9.23e5ac","type":"inject","z":"f2f2e382.3228b","g":"4368bdf2.f7a874","name":"Light OFF","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":201,"y":1142,"wires":[["e55ea81b.adfdd8","655a0d88.557ff4"]]},{"id":"e68a1b8a.416f18","type":"ui_group","name":"Default","tab":"6952137b.75c85c","order":1,"disp":false,"width":16,"collapse":false},{"id":"6952137b.75c85c","type":"ui_tab","name":"Home","icon":"dashboard","order":12}]

```

---

<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:** [18 February 2021 15:25 UTC](https://discourse.nodered.org/t/switch-node-what-is-point-of-show-state-of-output-option/41225/9 "2021-02-18T15:25:51Z")

</div>

> [@dceejay](#):
>
> But this is what it would be IRL

Now I've seen that, I can see how it works, but without your example, and relying on the readme I think I would struggle.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [18 February 2021 16:43 UTC](https://discourse.nodered.org/t/switch-node-what-is-point-of-show-state-of-output-option/41225/10 "2021-02-18T16:43:57Z")

</div>

Open to suggestions to improve docs/words

---

<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:** [20 March 2021 16:44 UTC](https://discourse.nodered.org/t/switch-node-what-is-point-of-show-state-of-output-option/41225/11 "2021-03-20T16:44:31Z")

</div>

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