Need to lock off this node from being clicked until a command is sent to it

I'm using this really cool node, node-red-contrib-ui-button_state by * haydendonald and I would like to be able to send a command to it to stop any clicks from being recognized until an unlock command is received. Here's what I'm using in my flow which is one of his examples.

[{"id":"0637174b7a71a782","type":"tab","label":"Flow 4","disabled":false,"info":"","env":[]},{"id":"ab2c6cda6ec42650","type":"group","z":"0637174b7a71a782","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["f075e4b1e82ffdee","0a2fe11a3bc5737c","7cd1becac0065c12","a9fce646456cb6b5","3e6c0840af9141f6"],"x":314,"y":179,"w":372,"h":302},{"id":"f075e4b1e82ffdee","type":"function","z":"0637174b7a71a782","g":"ab2c6cda6ec42650","name":"Pass","func":"return msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":410,"y":280,"wires":[["a9fce646456cb6b5"]]},{"id":"0a2fe11a3bc5737c","type":"debug","z":"0637174b7a71a782","g":"ab2c6cda6ec42650","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":590,"y":360,"wires":[]},{"id":"7cd1becac0065c12","type":"function","z":"0637174b7a71a782","g":"ab2c6cda6ec42650","name":"Default","func":"return {\n    \"payload\": \"option_3\"\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":400,"y":440,"wires":[["a9fce646456cb6b5"]]},{"id":"a9fce646456cb6b5","type":"ui_button_state","z":"0637174b7a71a782","g":"ab2c6cda6ec42650","group":"fb4ca7c3.864058","name":"","order":1,"onClass":"onColor","offClass":"offColor","width":"6","height":"2","options":[{"label":"Option 0","value":"option_0","onColor":"#99ff99","offColor":"#ff3333"},{"label":"Option 1","value":"option_1","onColor":"#99ff99","offColor":"#ff3333"},{"label":"Option 2","value":"option_2","onColor":"#99ff99","offColor":"#ff3333"},{"label":"Option 3","value":"option_3","onColor":"#99ff99","offColor":"#ff3333"}],"x":410,"y":360,"wires":[["f075e4b1e82ffdee","0a2fe11a3bc5737c"],["7cd1becac0065c12"]]},{"id":"3e6c0840af9141f6","type":"ui_template","z":"0637174b7a71a782","g":"ab2c6cda6ec42650","group":"148b74783879b574","name":"Add Styling","order":2,"width":0,"height":0,"format":"<div>\n    <style>\n        .offColor {\n            color: white !important;\n            background-color: black !important;\n        }\n        .onColor {\n            color: black !important;\n            background-color: orange !important;\n        }\n    </style>\n</div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"global","className":"","x":410,"y":220,"wires":[[]],"icon":"node-red-dashboard/ui_colour_picker.png","info":"# Modern Dark Theme for node-red-dashboard\n\nInspired by Victor Lucachi with his [Node Red Dashboard Concept](https://dribbble.com/shots/10356530-Node-Red-Dashboard-Concept) on Dribbble. Thank you for your work.\n\n## Customize\n\n1. Go on dashboard customisation tab (At the right of Debug Console).\n2. Select the style `Dark`.\n3. Pick the color you want. Example `#66B5F8`\n\n## Buttons\n\nUse `2x2` size for buttons with icon and text on the screenshot"},{"id":"fb4ca7c3.864058","type":"ui_group","name":"Default","tab":"64be35cd.7831bc","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"148b74783879b574","type":"ui_group","name":"Default","tab":"d70e5370d33a9c7f","order":5,"disp":true,"width":"6","collapse":true},{"id":"64be35cd.7831bc","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

Thanks, any help is much appreciated.

Did you try sending msg.enabled set to boolean false ?

Thank you fort that info, it does work. This is the kind of info that really helps a newbie like myself. Node Red is really grabbed my attention but man do I have a lot to learn about it.

I thank you for your help once again.

1 Like