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

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.

There is 1.1 beta available to install directly from github 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.

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

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?

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.

There is still a discussion 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...

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

Yes, thank you Colin, good tip!

Best wishes for your surgery Bart!

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