# \[ANNOUNCE\]node-red-contrib-ui-multistate-switch: v1.0.0

**URL:** https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-v1-0-0/41047
**Category:** Share Your Nodes
**Created:** [15 February 2021 21:42 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-v1-0-0/41047 "2021-02-15T21:42:09Z")
**Posts on this page:** 18
**Page:** 3

<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 15:52 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-v1-0-0/41047/41 "2021-02-18T15:52:40Z")

</div>

Does the status coming back from the pump also give you the Auto/Manual state? If it does then you could use that to determine what to send to the switch. Then the actual on/off state is fed to the LED.

---

<div class="post-metadata">

### Author: ![SonoraTechnical](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sonoratechnical/32/20033_2.png) [@SonoraTechnical](https://discourse.nodered.org/u/SonoraTechnical)
#### Post date: [18 February 2021 16:59 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-v1-0-0/41047/42 "2021-02-18T16:59:44Z")

</div>

Colin, in my case YES. I trigger relays over i2c.. and I do get the actual status back from the device (...the relay latched..) It's that status that I feed back to the LED node that I place right next to my toggle switches....

---

<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 17:01 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-v1-0-0/41047/43 "2021-02-18T17:01:58Z")

</div>

So you could merge the auto/manual state with the on/off state to know whether to send on, off, or auto in the front of the switch node.

---

<div class="post-metadata">

### Author: ![SonoraTechnical](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sonoratechnical/32/20033_2.png) [@SonoraTechnical](https://discourse.nodered.org/u/SonoraTechnical)
#### Post date: [18 February 2021 17:06 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-v1-0-0/41047/44 "2021-02-18T17:06:00Z")

</div>

I'm not worried. I'll figure it out.

---

<div class="post-metadata">

### Author: ![pepsi133](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pepsi133/32/37536_2.png) [@pepsi133](https://discourse.nodered.org/u/pepsi133)
#### Post date: [19 February 2021 10:49 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-v1-0-0/41047/45 "2021-02-19T10:49:33Z")

</div>

Thank you [BartButenaers](https://discourse.nodered.org/u/BartButenaers) and [hotNipi](https://discourse.nodered.org/u/hotNipi) for your next great contribution.

I am already starting to include this in my home automation dashboard.  
It's already improvement for me in it's current state.

One question or request - if possible make switching the state of switch only when a message arrives.  
This would help making this both control for sending commands and a status displaying control - that show what the device actually returned (meaning it's current and confirmed state - even if state changes outside of automation)

---

<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: [19 February 2021 11:03 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-v1-0-0/41047/46 "2021-02-19T11:03:40Z")

</div>

This is under discussion if you read carefully whole thread. Most probably it will be available at some point. Just not yet concluded about what will be the actual implementation.

---

<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: [20 February 2021 14:46 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-v1-0-0/41047/47 "2021-02-20T14:46:33Z")

</div>

> [@BartButenaers](#):
>
> A checkbox " _pass input msg to output_ ", which only does what it says

I think I prefer the term pass through as that is used in the ui\_switch and slider.

> [@BartButenaers](#):
>
> - _No input_ : does not accept click/touch events
> - _Accept but don't show input_ : it accepts click/touch events (and send output msg), but doesn't show this new state
> - _Accept and show input_ :it accepts click/touch events (and send output msg), and shows this new state immediately

Initially I thought that one or more of those should only be available in non-passthrough, but having thought about it I agree, they can be available all the time.  
The addition of the No Input mode is interesting as it still allows the switch to move under flow control but not under user control. Which is different to disabling the node. I think the word 'input' (as in Ignore inputs) is ambiguous as it might be talking about message inputs.  
I am not sure about the wording. How about something like

Ignore clicks  
Click sends message and moves switch  
Click sends message but does not move switch

Though I can't get that excited about those. It isn't easy coming up with short phrases for features that really need a sentence or two.  
Or it could be a drop down labelled 'On Click' with options  
Do nothing  
Send message, don't move switch position  
Send message and move switch

Will those be selectable at run time? I can see the Do Nothing option being useful as a way of temporarily disabling the switch but keeping it as an indicator.

---

<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: [20 February 2021 15:12 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-v1-0-0/41047/48 "2021-02-20T15:12:58Z")

</div>

> [@Colin](#):
>
> not sure about the wording

Perhaps _"No user input"_?

> [@Colin](#):
>
> Will those be selectable at run time?

Via an input msg could that be enabled or disabled

---

<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: [21 February 2021 13:30 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-v1-0-0/41047/49 "2021-02-21T13:30:53Z")

</div>

> [@BartButenaers](#):
>
> > [@Colin](#):
> >
> > Will those be selectable at run time?
> 
> Via an input msg could that be enabled or disabled

Excellent

---

<div class="post-metadata">

### Author: ![PaulKana](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paulkana/32/37106_2.png) [@PaulKana](https://discourse.nodered.org/u/PaulKana)
#### Post date: [23 February 2021 14:47 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-v1-0-0/41047/50 "2021-02-23T14:47:16Z")

</div>

Hi, thank you for this great switch! I don't know if this is working as intended: but I have a two state switch set up to choose either 250g or 500g. My interface has a second tab and whe I go to the second tab and come back the 500g value gets selected automatically, even if I had set 250g before going to the other layout.

There is no input wired to the switch, output sets a global variable. Option B is the second one.

 ![Screen Shot 2021-02-23 at 15.45.47](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/d/2d6ebde7da1aac69afa517a3861b06942dc14d29.png)

v 1.0

Thanks!

EDIT:  
So I did put an ui\_control node on the flow that reacts to tab change and changed the message "change" to my global.weight in a switch node; so when I come back to my layout the global is rewritten to the switch, and to the set global after... Not very beautiful, but seems to work for the moment 😃

```auto
[{"id":"4c43bc79.3ebf74","type":"ui_multistate_switch","z":"f0cab7c7.b1df3","name":"Choix de poids","group":"69980645.578418","order":6,"width":5,"height":2,"label":"","options":[{"label":"250","value":"250","valueType":"num"},{"label":"500","value":"500","valueType":"num"}],"x":100,"y":260,"wires":[["806895b2.1715c"]]},{"id":"b076fa9a.0cb798","type":"change","z":"f0cab7c7.b1df3","name":"","rules":[{"t":"set","p":"desired_weight","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":260,"wires":[["9a02fcd2.02fda8"]]},{"id":"806895b2.1715c","type":"show-value","z":"f0cab7c7.b1df3","name":"","path":"","x":290,"y":260,"wires":[["b076fa9a.0cb798"]]},{"id":"9a02fcd2.02fda8","type":"link out","z":"f0cab7c7.b1df3","name":"to calcul paliers","links":["f5795d83.ca0228","92935aa0.c7b04","ed17f4b4.988b38"],"x":715,"y":260,"wires":[]},{"id":"cbef1a40.00b25","type":"ui_ui_control","z":"f0cab7c7.b1df3","name":"","events":"change","x":80,"y":220,"wires":[["8ed925b1.fe953"]]},{"id":"8ed925b1.fe953","type":"change","z":"f0cab7c7.b1df3","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"change","fromt":"str","to":"desired_weight","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":260,"y":220,"wires":[["4c43bc79.3ebf74"]]},{"id":"69980645.578418","type":"ui_group","name":"Adam","tab":"69bfb17e.18e7c8","order":1,"disp":false,"width":"12","collapse":false},{"id":"69bfb17e.18e7c8","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<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: [23 February 2021 19:39 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-v1-0-0/41047/51 "2021-02-23T19:39:34Z")

</div>

> [@PaulKana](#):
>
> whe I go to the second tab and come back

Hi Paul,  
I have added a _ **fix** _ on Github (not on NPM yet!) for your tab-switch issue, which you can install within your .node-red folder like this:

```auto
npm install bartbutenaers/node-red-contrib-ui-multistate-switch

```

Would be nice if you (or others) can test this, because I know from experience that this can have unwanted side effects: tab switches, deploys, ...

---

<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: [23 February 2021 19:46 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-v1-0-0/41047/52 "2021-02-23T19:46:17Z")

</div>

> [@BartButenaers](#):
>
> `npm install bartbutenaers/node-red-contrib-ui-multistate-switch`

Oooh!, it didn't seem to like your last.

![error](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/a/dad25314188dc5ed34ce7c81a2cb2ae7d6062c52.gif)

---

<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: [23 February 2021 19:49 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-v1-0-0/41047/53 "2021-02-23T19:49:05Z")

</div>

That is weird...  
Had that also, but with @hotNipi 's fix from few days ago on Github it was solved.  
Did a couple of tests afterwards and wasn't able to reproduce that behaviour again.  
Will try again ...

---

<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: [23 February 2021 19:51 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-v1-0-0/41047/54 "2021-02-23T19:51:26Z")

</div>

It's only appeared after your last commit a few minutes ago, never had it before.

---

<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: [23 February 2021 19:53 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-v1-0-0/41047/55 "2021-02-23T19:53:37Z")

</div>

Yes now I also have it again. So weird that it was solved temporarily.  
In the last version I simply do `storeFrontEndInputAsState: true`, but I got the impression that this triggers an endless loop of messages between frontend and backend.  
Will need to debug ...

---

<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: [23 February 2021 20:01 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-v1-0-0/41047/56 "2021-02-23T20:01:52Z")

</div>

Is it now solved?  
P.S. I assume there will be no msg passthrough anymore now, but will have a look at that later ...

---

<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: [23 February 2021 20:26 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-v1-0-0/41047/57 "2021-02-23T20:26:33Z")

</div>

> [@BartButenaers](#):
>
> Is it now solved?

Yes, and it retains its visual state when changing ui tabs.

---

<div class="post-metadata">

### Author: ![PaulKana](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paulkana/32/37106_2.png) [@PaulKana](https://discourse.nodered.org/u/PaulKana)
#### Post date: [24 February 2021 14:29 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-v1-0-0/41047/58 "2021-02-24T14:29:14Z")

</div>

Works for me too, thanks!

[Previous page](https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-v1-0-0/41047.md?page=2)
