[ANNOUNCE] node-red-contrib-ui-multistate-switch: v1.1.0 beta

This looks awesome. And THANK YOU for having a color option for the different options!!

1 Like

After spending quite some quality time together with @hotNipi, we are very pleased to announce the last new additions for this beta version:

  1. Some basic validation has been added for the editableList, e.g. an error of duplicate button values are being used. This will be extended in future versions.

    image

  2. Bug fixed about colorpickers not showed.

  3. A button node displayed on multiple dashboard at the same moment will now be synced visually across those dashboards.

  4. Two typedinputs have been added on the config screen:

    image

  5. The switch can be disabled via the input messages:

    image

  6. Fix to keep the switch state after a tabsheet change.

  7. Now the button text color will stand out.

We would appreciate if some folks could test this, so we can publish it on npm within the next two days!

5 Likes

Works well with Safari on my dashboard, thanks guys... particularly the state save.

1 Like

Oh dear...
System crash when I try and change the state of the button using the ui.

3 Mar 18:31:44 - [red] Uncaught Exception:
3 Mar 18:31:44 - TypeError: Cannot read property 'indexOf' of undefined
at Object.setMessageProperty (/usr/lib/node_modules/node-red/node_modules/@node-red/util/lib/util.js:365:14)
at Object.beforeSend (/home/opc/.node-red/node_modules/node-red-contrib-ui-multistate-switch/multistate_switch.js:205:38)
at EventEmitter.handler (/home/opc/.node-red/node_modules/node-red-dashboard/ui.js:285:22)
at EventEmitter.emit (events.js:326:22)
at Socket.emit (events.js:314:20)
at /home/opc/.node-red/node_modules/socket.io/lib/socket.js:528:12
at processTicksAndRejections (internal/process/task_queues.js:79:11)
nodered.service: main process exited, code=exited, status=1/FAILURE
Unit nodered.service entered failed state.
nodered.service failed.
nodered.service holdoff time over, scheduling restart.
Stopped Node-RED graphical event wiring tool.

Please add the flow so we can see behind the corners ...

It's only the node and a debug node, but here it is.

[{"id":"97cffe7f.d228d","type":"debug","z":"a4801683.1c0448","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":490,"y":2870,"wires":[]},{"id":"af981bc3.6aecf8","type":"ui_multistate_switch","z":"a4801683.1c0448","name":"Test","group":"e68a1b8a.416f18","order":1,"width":"8","height":1,"label":"Drive sensor","rounded":true,"useThemeColors":true,"hideSelectedLabel":false,"options":[{"label":"ON","value":"on","valueType":"str","color":"#009933"},{"label":"OFF","value":"off","valueType":"str","color":"#999999"}],"x":320,"y":2870,"wires":[["97cffe7f.d228d"]]},{"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}]

Hmm. Was it that you had version 1.0 installed and just installed the beta and tested straight with it?

Yes, but I restarted node-RED after the update, and before testing.

And if you flush browser cache ...

Yes, and tried a different browser. Same result.

But... I've just completely removed the flow, and the node, rebooted, and then installed the node again, and now it works OK.
For some reason it didn't like installing the new version over the old.

From the stacktrace (line 205) I need to initialize the typedinputfield values at server side for existing v1.0.0 nodes.
Now paul has created a new node from scratch which circumvents this problem. But I need to fix it to have no impact on existing flows...
But first doing homework with my son...

1 Like

Guys, this is getting better all of the time. I suspect that alighment problem with the MAC was also appearing in Chrome on RaspberryPi OS. Cant wait to use the release 1.1 version.

Just pushed some minor fixes also. Keep the label in one line and a bit improved the dark/light button text breaking point.

Got to say well done guys, for the visual effect when the node is disabled (dotted line & fading).
It would be great if that could become a standard template for all nodes that are similarly disabled.

1 Like

Little fingers worked fast and I hope we addressed all the traps to avoid issues on upgrade.

1 Like

Just pulled the latest...
Should the label colours be different? (using theme colours)

switch

[{"id":"dae09dca.11a71","type":"ui_multistate_switch","z":"a4801683.1c0448","name":"","group":"e68a1b8a.416f18","order":20,"width":"6","height":0,"label":"switch","stateField":"payload","enableField":"enable","rounded":true,"useThemeColors":true,"hideSelectedLabel":false,"options":[{"label":"Option 0","value":"option_0","valueType":"str","color":"#009933"},{"label":"Option 1","value":"option_1","valueType":"str","color":"#999999"},{"label":"Option 2","value":"option_2","valueType":"str","color":"#ff6666"}],"x":350,"y":2850,"wires":[["73bcfc74.4a12e4"]]},{"id":"73bcfc74.4a12e4","type":"debug","z":"a4801683.1c0448","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":520,"y":2850,"wires":[]},{"id":"c6c6b976.b51278","type":"inject","z":"a4801683.1c0448","name":"disable","props":[{"p":"enable","v":"false","vt":"bool"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":120,"y":2850,"wires":[["dae09dca.11a71"]]},{"id":"2120c435.0f0acc","type":"inject","z":"a4801683.1c0448","name":"enable","props":[{"p":"enable","v":"true","vt":"bool"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":120,"y":2890,"wires":[["dae09dca.11a71"]]},{"id":"48d3e8fb.3720c8","type":"inject","z":"a4801683.1c0448","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"option_2","payloadType":"str","x":110,"y":2930,"wires":[["dae09dca.11a71"]]},{"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}]

No they should not. Will investigate.
The story behind is that as you can choose any color for state, we need to figure out if the text on top of the state is still readable. So we change the text color button by button in case of they both are light or dark.

1 Like

Now fixed.

2 Likes

Sorry guys, I can't find any more bugs :face_with_hand_over_mouth:

Works great here now, nice work.

2 Likes

To be continued here