Is there a way using the standard UI button, to accept msg.enabled true/false with no msg.payload? And still use the msg pass-thru feature? It is designed to react to any message if the pass-thru is enabled? Would seem a nice feature would be that it only reacts if a payload is present? Or such? Just a thought?
Did you try using a change
node before the ui-button node to remove msg.payload?
Yeah I tried that. Since the UI node reacts to 'any' message, that did not work.
What I am trying to do, is change of state to the button, then disable the button, do something, then enable the button again. This works great when I actually click the button.
The instant I check the pass-thru and then send any message, to the button, endless loop. Since the msg.enabled triggers the button over and over.
Because the button does no filtering on any message received. It be a nice feature to use the pass-thru that is smarter or a trigger flag, so I could enable, disable, change icon, change color, etc. But not trigger the pass-thru in those cases, but if I really am sending a 'value' change to the button, than have it respond to the change of value, i.e. pass-throw, in that case. It would seem like a logical standardized feature to add.
Many custom nodes, use 'control' msg 'codes' to separate data from control messages, but the standard UI nodes for the most part lack this flexibility. Not a dig, just not a considered use case, in design I guess.
Using msg.control_iu is a major step in complexity, when all you are doing is simple things. I remember someone here saying simple is better.... when not having to use msg.control_ui would be much simpler.
Can you post a simple flow to show what you are doing ?
Could you not disable pass thru and just have another link around the switch ?
@smcgann99, Yes, actually that is what I do now, just not a great or elegant solution.
Below is 3 flows, first, no pass-through, second pass-through with payload, third pass-through no payload.
[{"id":"3f36cbcde716267c","type":"inject","z":"ab3cb18017d31f4a","name":"Send True","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"ButtonTrue","payload":"true","payloadType":"bool","x":140,"y":140,"wires":[["95000d42446963ef"]]},{"id":"17bbbffcb3f6809c","type":"inject","z":"ab3cb18017d31f4a","name":"Send False","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"ButtonFalse","payload":"false","payloadType":"bool","x":130,"y":180,"wires":[["95000d42446963ef"]]},{"id":"95000d42446963ef","type":"ui_button","z":"ab3cb18017d31f4a","name":"No Input","group":"d7f8625f22b60966","order":23,"width":0,"height":0,"passthru":false,"label":"No Input","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"?","payloadType":"str","topic":"topic","topicType":"msg","x":320,"y":160,"wires":[["95d6cff2540baded","773c76e4c42eb7c6"]]},{"id":"95d6cff2540baded","type":"delay","z":"ab3cb18017d31f4a","name":"Delay (5s)","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":490,"y":160,"wires":[["93ae45f2062a5d1f"]]},{"id":"773c76e4c42eb7c6","type":"change","z":"ab3cb18017d31f4a","name":"Disable","rules":[{"t":"set","p":"enabled","pt":"msg","to":"false","tot":"bool"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":100,"wires":[["95000d42446963ef"]]},{"id":"93ae45f2062a5d1f","type":"change","z":"ab3cb18017d31f4a","name":"Disable","rules":[{"t":"set","p":"enabled","pt":"msg","to":"true","tot":"bool"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":160,"wires":[["ace2454965c0cd6a","95000d42446963ef"]]},{"id":"ace2454965c0cd6a","type":"debug","z":"ab3cb18017d31f4a","name":"Message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":840,"y":160,"wires":[]},{"id":"97f45d695857d2be","type":"comment","z":"ab3cb18017d31f4a","name":"No Message Input","info":"","x":150,"y":60,"wires":[]},{"id":"8b0f0b705735122d","type":"inject","z":"ab3cb18017d31f4a","name":"Send True","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"ButtonTrue","payload":"true","payloadType":"bool","x":120,"y":360,"wires":[["a1d0c305854f6025"]]},{"id":"13412813d6768067","type":"inject","z":"ab3cb18017d31f4a","name":"Send False","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"ButtonFalse","payload":"false","payloadType":"bool","x":110,"y":400,"wires":[["a1d0c305854f6025"]]},{"id":"a1d0c305854f6025","type":"ui_button","z":"ab3cb18017d31f4a","name":"Payload Input","group":"d7f8625f22b60966","order":23,"width":0,"height":0,"passthru":true,"label":"Payload Input","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"?","payloadType":"str","topic":"topic","topicType":"msg","x":320,"y":380,"wires":[["b3136f013d0d9699","fa533cb262202c09"]]},{"id":"b3136f013d0d9699","type":"delay","z":"ab3cb18017d31f4a","name":"Delay (5s)","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":550,"y":380,"wires":[["518fcfa3450665bc"]]},{"id":"fa533cb262202c09","type":"change","z":"ab3cb18017d31f4a","name":"Disable","rules":[{"t":"set","p":"enabled","pt":"msg","to":"false","tot":"bool"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":320,"wires":[["a1d0c305854f6025"]]},{"id":"518fcfa3450665bc","type":"change","z":"ab3cb18017d31f4a","name":"Disable","rules":[{"t":"set","p":"enabled","pt":"msg","to":"true","tot":"bool"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":380,"wires":[["4f575cbf2e9abbe1","a1d0c305854f6025"]]},{"id":"4f575cbf2e9abbe1","type":"debug","z":"ab3cb18017d31f4a","name":"Message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":900,"y":380,"wires":[]},{"id":"3e0f7635a47c1b17","type":"comment","z":"ab3cb18017d31f4a","name":"Message Input Danger Endless Loop","info":"","x":190,"y":280,"wires":[]},{"id":"4f3dc99c4bce1af3","type":"inject","z":"ab3cb18017d31f4a","name":"Send No Payload True","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"ButtonTrue","x":160,"y":580,"wires":[["98651ddf36684eb5"]]},{"id":"924937f274793e83","type":"inject","z":"ab3cb18017d31f4a","name":"Send No Payload False","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"ButtonFalse","x":160,"y":620,"wires":[["98651ddf36684eb5"]]},{"id":"98651ddf36684eb5","type":"ui_button","z":"ab3cb18017d31f4a","name":"No Payload Input","group":"d7f8625f22b60966","order":23,"width":0,"height":0,"passthru":true,"label":"No Payload Input","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"?","payloadType":"str","topic":"topic","topicType":"msg","x":430,"y":600,"wires":[["2b2436fb68c34757","70787115442d534f"]]},{"id":"2b2436fb68c34757","type":"delay","z":"ab3cb18017d31f4a","name":"Delay (5s)","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":630,"y":600,"wires":[["9d9869abc8c0abe9"]]},{"id":"70787115442d534f","type":"change","z":"ab3cb18017d31f4a","name":"Disable","rules":[{"t":"set","p":"enabled","pt":"msg","to":"false","tot":"bool"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":540,"wires":[["98651ddf36684eb5"]]},{"id":"9d9869abc8c0abe9","type":"change","z":"ab3cb18017d31f4a","name":"Disable","rules":[{"t":"set","p":"enabled","pt":"msg","to":"true","tot":"bool"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":800,"y":600,"wires":[["2300fb42855940d6","98651ddf36684eb5"]]},{"id":"2300fb42855940d6","type":"debug","z":"ab3cb18017d31f4a","name":"Message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":980,"y":600,"wires":[]},{"id":"9e93fa46a757381b","type":"comment","z":"ab3cb18017d31f4a","name":"Message No Payload Input","info":"","x":150,"y":500,"wires":[]},{"id":"d7f8625f22b60966","type":"ui_group","name":"Test","tab":"209a402d3277a579","order":1,"disp":true,"width":"6","collapse":true,"className":""},{"id":"209a402d3277a579","type":"ui_tab","name":"Example","icon":"dashboard","order":13,"disabled":false,"hidden":false}]
The idea I had was to allow button to ignore or see the payload, based on another 'control' in message, say 'input' and if input is true, do the pass-thru, if input is false, do not do the pass-thru, but change state. This would let me selectively respond to the payload via the injections origin route of the flow.
I don't know of a way to see if the input box is checked, or to set the check box on demand. If there is a way to control the input message check/uncheck via the in bound message? That would do what I am suggesting. So msg.input=true or msg.input=false controls the check box, i.e. respond to input payload or not for the given message inputed.
A function node after the button to check for property enabled
and nulling msg, should stop the loop.
e.g.
[{"id":"8b0f0b705735122d","type":"inject","z":"bf9e1e33.030598","name":"Send True","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"ButtonTrue","payload":"true","payloadType":"bool","x":170,"y":3280,"wires":[["a1d0c305854f6025"]]},{"id":"a1d0c305854f6025","type":"ui_button","z":"bf9e1e33.030598","name":"Payload Input","group":"d7f8625f22b60966","order":23,"width":0,"height":0,"passthru":true,"label":"Payload Input","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"?","payloadType":"str","topic":"topic","topicType":"msg","x":430,"y":3300,"wires":[["efd7d06.29e173"]]},{"id":"13412813d6768067","type":"inject","z":"bf9e1e33.030598","name":"Send False","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"ButtonFalse","payload":"false","payloadType":"bool","x":160,"y":3320,"wires":[["a1d0c305854f6025"]]},{"id":"518fcfa3450665bc","type":"change","z":"bf9e1e33.030598","name":"Enable","rules":[{"t":"set","p":"enabled","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":980,"y":3300,"wires":[["a1d0c305854f6025","4f575cbf2e9abbe1"]]},{"id":"fa533cb262202c09","type":"change","z":"bf9e1e33.030598","name":"Disable","rules":[{"t":"set","p":"enabled","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":3200,"wires":[["a1d0c305854f6025"]]},{"id":"efd7d06.29e173","type":"function","z":"bf9e1e33.030598","name":"","func":"if(msg.hasOwnProperty(\"enabled\")){\n msg = null;\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":650,"y":3300,"wires":[["b3136f013d0d9699","ed39dfd.607c12"]]},{"id":"b3136f013d0d9699","type":"delay","z":"bf9e1e33.030598","name":"Delay (5s)","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":830,"y":3300,"wires":[["518fcfa3450665bc"]]},{"id":"4f575cbf2e9abbe1","type":"debug","z":"bf9e1e33.030598","name":"Message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":990,"y":3200,"wires":[]},{"id":"ed39dfd.607c12","type":"delay","z":"bf9e1e33.030598","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":530,"y":3200,"wires":[["fa533cb262202c09"]]},{"id":"d7f8625f22b60966","type":"ui_group","name":"Test","tab":"209a402d3277a579","order":1,"disp":true,"width":"6","collapse":true,"className":""},{"id":"209a402d3277a579","type":"ui_tab","name":"Example","icon":"dashboard","order":13,"disabled":false,"hidden":false}]
Or a switch node checking if enabled is of type undefined.
e.g.
[{"id":"8b0f0b705735122d","type":"inject","z":"bf9e1e33.030598","name":"Send True","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"ButtonTrue","payload":"true","payloadType":"bool","x":170,"y":3280,"wires":[["a1d0c305854f6025"]]},{"id":"a1d0c305854f6025","type":"ui_button","z":"bf9e1e33.030598","name":"Payload Input","group":"d7f8625f22b60966","order":23,"width":0,"height":0,"passthru":true,"label":"Payload Input","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"?","payloadType":"str","topic":"topic","topicType":"msg","x":430,"y":3300,"wires":[["749c8b96.b6908c"]]},{"id":"13412813d6768067","type":"inject","z":"bf9e1e33.030598","name":"Send False","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"ButtonFalse","payload":"false","payloadType":"bool","x":160,"y":3320,"wires":[["a1d0c305854f6025"]]},{"id":"518fcfa3450665bc","type":"change","z":"bf9e1e33.030598","name":"Enable","rules":[{"t":"set","p":"enabled","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":980,"y":3300,"wires":[["a1d0c305854f6025","4f575cbf2e9abbe1"]]},{"id":"fa533cb262202c09","type":"change","z":"bf9e1e33.030598","name":"Disable","rules":[{"t":"set","p":"enabled","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":3200,"wires":[["a1d0c305854f6025"]]},{"id":"749c8b96.b6908c","type":"switch","z":"bf9e1e33.030598","name":"","property":"enabled","propertyType":"msg","rules":[{"t":"istype","v":"undefined","vt":"undefined"}],"checkall":"true","repair":false,"outputs":1,"x":630,"y":3300,"wires":[["b3136f013d0d9699","ed39dfd.607c12"]]},{"id":"b3136f013d0d9699","type":"delay","z":"bf9e1e33.030598","name":"Delay (5s)","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":830,"y":3300,"wires":[["518fcfa3450665bc"]]},{"id":"4f575cbf2e9abbe1","type":"debug","z":"bf9e1e33.030598","name":"Message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":990,"y":3200,"wires":[]},{"id":"ed39dfd.607c12","type":"delay","z":"bf9e1e33.030598","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":530,"y":3200,"wires":[["fa533cb262202c09"]]},{"id":"d7f8625f22b60966","type":"ui_group","name":"Test","tab":"209a402d3277a579","order":1,"disp":true,"width":"6","collapse":true,"className":""},{"id":"209a402d3277a579","type":"ui_tab","name":"Example","icon":"dashboard","order":13,"disabled":false,"hidden":false}]
So msg=null effectively does not meet the criteria for the control to react... nice. And msg.payload delete did not work because the msg still had, ah, baggage.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.