# Node-red-contrib-ui-multistate switch potential drawback

**URL:** <https://discourse.nodered.org/t/node-red-contrib-ui-multistate-switch-potential-drawback/41743>\
**Category:** Dashboard\
**Created:** [28 February 2021 08:11 UTC](https://discourse.nodered.org/t/node-red-contrib-ui-multistate-switch-potential-drawback/41743 "2021-02-28T08:11:11Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robertotarga](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/robertotarga/32/16890_2.png) [@Robertotarga](https://discourse.nodered.org/u/Robertotarga)\
**Post date:** [28 February 2021 08:11 UTC](https://discourse.nodered.org/t/node-red-contrib-ui-multistate-switch-potential-drawback/41743/1 "2021-02-28T08:11:11Z")

</div>

Multistate switch v. 1.0, NR 1.1.3

I'm testing this very intersting node, but I discovered a possible, at least for me, drawback.  
I noticed that the input message is passed to the output as well and it may cause undesired infinite loops if, as in my case, the input comes from a mqtt broker topic and the output is sent as a command to the same mqtt topic.  
I think that this node should have a checkbox where you can specify if the input message will be sent or not to the output, as is available in the ordinary switch node.

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [28 February 2021 10:23 UTC](https://discourse.nodered.org/t/node-red-contrib-ui-multistate-switch-potential-drawback/41743/2 "2021-02-28T10:23:14Z")

</div>

There is 1.1 beta available to install directly from [github](https://github.com/bartbutenaers/node-red-contrib-ui-multistate-switch)if you want to test do we have addressed mentioned issue correctly.  
I hope, the 1.1 release will be also available in near future.

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [28 February 2021 15:35 UTC](https://discourse.nodered.org/t/node-red-contrib-ui-multistate-switch-potential-drawback/41743/3 "2021-02-28T15:35:31Z")

</div>

> [@Robertotarga](#):
>
> the input message is passed to the output

Hi Roberto,  
Like @hotNipi said: the version on Github does not resend the messages anymore. Because the 1.0.0 version of this node did it like this:

1. Input message arrives in the flow on the server.
2. Input message is send to the frontend (i.e. the dashboard).
3. Switch widget changes state.
4. Due to 3 (similar to a user clicking the switch), a message will be send to the server (containing the new switch state).
5. An output message is send.

So the message did an entire roundtrip to the frontend and back. That is not what we want. Moreover when N dashboards are open at the same time, 1 input msg would result in N output messages. So it was a bug (instead if a feature), which we had to fix.

Later on we will have to decide whether/how the passthrough will be implemented in a next version, but then purely on the server side.  
Bart

---

<div class="post-metadata">

**Author:** ![Robertotarga](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/robertotarga/32/16890_2.png) [@Robertotarga](https://discourse.nodered.org/u/Robertotarga)\
**Post date:** [1 March 2021 08:33 UTC](https://discourse.nodered.org/t/node-red-contrib-ui-multistate-switch-potential-drawback/41743/4 "2021-03-01T08:33:24Z")

</div>

Hi Bart,  
thank you for your tips.  
I think that the passthrough should in some occasions can be useful and should be kept as an option, more or less as you have in the regular switch, with a check box "Pass-through msg" Y/N.

When do you plan to put new version on the standard repository for updating via NR "Manage Palette"?

Will it have the color options you show in the tutorial, but are lacking in 1.0 version?

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [1 March 2021 11:09 UTC](https://discourse.nodered.org/t/node-red-contrib-ui-multistate-switch-potential-drawback/41743/5 "2021-03-01T11:09:29Z")

</div>

> [@Robertotarga](#):
>
> When do you plan to put new version on the standard repository

First my partner for this node (@hotNipi) needs to test it when he has time, and then we discuss it on Discourse and then to npm.

> [@Robertotarga](#):
>
> I think that the passthrough should in some occasions

There is still a [discussion](https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-v1-0-0/41047/21) going on about this. But I will have a surgery this friday, and won't do any developments for a few months. So that feature will have to wait until I'm back in town...

---

<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:** [1 March 2021 11:29 UTC](https://discourse.nodered.org/t/node-red-contrib-ui-multistate-switch-potential-drawback/41743/6 "2021-03-01T11:29:32Z")

</div>

> [@Robertotarga](#):
>
> may cause undesired infinite loops

As a work around for the moment, if you insert an RBE node after the switch that should stop the loops.

---

<div class="post-metadata">

**Author:** ![Robertotarga](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/robertotarga/32/16890_2.png) [@Robertotarga](https://discourse.nodered.org/u/Robertotarga)\
**Post date:** [1 March 2021 12:03 UTC](https://discourse.nodered.org/t/node-red-contrib-ui-multistate-switch-potential-drawback/41743/7 "2021-03-01T12:03:21Z")

</div>

Yes, thank you Colin, good tip!

---

<div class="post-metadata">

**Author:** ![Robertotarga](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/robertotarga/32/16890_2.png) [@Robertotarga](https://discourse.nodered.org/u/Robertotarga)\
**Post date:** [1 March 2021 12:18 UTC](https://discourse.nodered.org/t/node-red-contrib-ui-multistate-switch-potential-drawback/41743/8 "2021-03-01T12:18:03Z")

</div>

Best wishes for your surgery Bart!

---

<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:** [31 March 2021 12:18 UTC](https://discourse.nodered.org/t/node-red-contrib-ui-multistate-switch-potential-drawback/41743/9 "2021-03-31T12:18:20Z")

</div>

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