Button node - passthrough?

The dashboard button config contains this -


...which suggests if you stick an inject node in front of the button node, the msg from the inject node should pass through the button node and appear in debug.


But it doesn't, it just sends the payload contained in the button node, and the msg from the inject node is disregarded.

My user case was to chain a number of buttons together, each of which performs a different function, and the single output then influences further processes.


The flow for the 3 node example above;

        "id": "d87ba0f9.de993",
        "type": "ui_button",
        "z": "6eb37a1d.ee8f34",
        "name": "button",
        "group": "ddd690d2.0351d",
        "order": 5,
        "width": "2",
        "height": "1",
        "passthru": true,
        "label": "test",
        "color": "green",
        "bgcolor": "#2A2A2A",
        "icon": "",
        "payload": "fromButton",
        "payloadType": "str",
        "topic": "",
        "x": 750,
        "y": 540,
        "wires": [
        "id": "8f4c010f.465cd",
        "type": "inject",
        "z": "6eb37a1d.ee8f34",
        "name": "inject",
        "topic": "",
        "payload": "fromInject",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 590,
        "y": 540,
        "wires": [
        "id": "8bdb8c06.f727f",
        "type": "debug",
        "z": "6eb37a1d.ee8f34",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 900,
        "y": 540,
        "wires": []
        "id": "ddd690d2.0351d",
        "type": "ui_group",
        "z": "",
        "name": "Test2",
        "tab": "117b6717.6166b9",
        "disp": true,
        "width": "27",
        "collapse": false
        "id": "117b6717.6166b9",
        "type": "ui_tab",
        "z": 0,
        "name": "Test2",
        "icon": "dashboard",
        "order": 7

The button will only send a payload if the input matches the expected output - ie it acts like you pressed the button - it is not a general passthru. It will pass through all the other properties - so you can use those to tell if it was a simulated click or a real click.

Why not just wire all four buttons into the function node ?

It's easy to workaround, but maybe that needs clarifying in the node info.
I read 'If msg arrives on input, pass through to output' in a different context, meaning what goes in, comes out.

Also, it seems to send the button node msg even if the incoming message doesn't match.

sorry - was mixing it up with the switch node.

Could I have some clarity on this please;
Is it a bug, or am I misinterpreting the node help/readme?


If set to pass through mode a message arriving on the input will act like pressing the button. The output payload will be as defined in the node configuration.

OK thanks.
In that case I'll move to plan B!

@dceejay - so If `msg` arrives on input, pass through to output: doesn't actually pass the msg object out? If I have an inject node sending 'hello button' connected to a button that is connected to a debug, the debug will not show 'hello buton', it will show what ever is in When clicked, send:

Maybe the statement should read If `msg` arrives on input, it will trigger an automatic button push

1 Like

Well no.. I said the payload is set to whatever is configured... The rest of the msg and other properties are passed through. When pressing the button you only get payload and optional topic.

But isn't that what Paul Z is saying?

Button push = " Clicking the button generates a message with msg.payload set to the Payload field."


As far as the payload goes yes. The rest of the msg may well be different.

...but his statement is not wrong, and probably makes more sense than what we presently have.

From a user perspective, the current wording is misleading.

1 Like

My first response to you tonight was cut/pasted from the latest (master) info panel.

I did check first, but I'm not seeing that - https://github.com/node-red/node-red-dashboard/blob/master/nodes/ui_button.html

To sumarize:

If passthru is NOT checked, any flow msg entering the ui_node will go no further - it's a dead end. The only time a msg will leave the node is when the button is pushed on the dashboard.

If pastthru IS checked and a msg enters the ui_node, all parts of the msg except payload and topic will remain unchanged. For payload and topic the following applies:

  • payload - will becone the value set in the ui_button or if it is left blank, it becomes the id of the ui-button (for example: payload: "4b7e1b33.5b482c")
  • topic - will become the value set in the ui_button node or if left blank, the existing msg.topic will not change.
1 Like

I am also trying to get this node to pass through a variable msg.Zone which has been set through a previous dropdown list ui. Nothing passes through the ui_button node and I need msg.Zone for the next nodes (selects an element of an Context file array for changing.)
Running Node-red 1.0.2 on windows

[{"id":"b46402af.18cde","type":"tab","label":"UI_button bug?","disabled":false,"info":""},{"id":"6e4d938e.bc05ec","type":"ui_dropdown","z":"b46402af.18cde","name":"","label":"Zone","tooltip":"","place":"Select Zone to edit","group":"3b78ccda.b81e54","order":0,"width":0,"height":0,"passthru":true,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"","x":113,"y":923,"wires":[["be3ee684.df72e8","cc2d059.f8f7bf8"]]},{"id":"dfd57b59.68a4f8","type":"ui_button","z":"b46402af.18cde","name":"","group":"3b78ccda.b81e54","order":0,"width":0,"height":0,"passthru":false,"label":"LoadCurrent Zone Values","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":503,"y":923,"wires":[["ea1fa810.5e4448"]]},{"id":"f454008b.a50d4","type":"change","z":"b46402af.18cde","name":"","rules":[{"t":"set","p":"Zone","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":167,"y":842,"wires":[["166fe87c.c69cb8"]]},{"id":"166fe87c.c69cb8","type":"change","z":"b46402af.18cde","name":"","rules":[{"t":"set","p":"options","pt":"msg","to":"[{\"Spare\":0},{\"Bed 1\":1},{\"Bed 2\":2},{\"Bed 3\":3},{\"Bed 4\":4},{\"Bed 5\":5},{\"East Bed\":6},{\"West Bed\":7}]","tot":"json"},{"t":"set","p":"payload","pt":"msg","to":"Zone","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":355,"y":841,"wires":[["6e4d938e.bc05ec","f0ea1ec4.bc0e8"]]},{"id":"ea1fa810.5e4448","type":"debug","z":"b46402af.18cde","name":"4 Common","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":702,"y":1018,"wires":[]},{"id":"be3ee684.df72e8","type":"change","z":"b46402af.18cde","name":"","rules":[{"t":"set","p":"Zone","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":923,"wires":[["dfd57b59.68a4f8","9e7efb95.20bf78"]]},{"id":"9e7efb95.20bf78","type":"debug","z":"b46402af.18cde","name":"3 Common","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":441,"y":1012,"wires":[]},{"id":"cc2d059.f8f7bf8","type":"debug","z":"b46402af.18cde","name":"2 Common","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":229,"y":1007,"wires":[]},{"id":"f0ea1ec4.bc0e8","type":"debug","z":"b46402af.18cde","name":"1 Common","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":635,"y":832,"wires":[]},{"id":"eb7f10fd.8d82b","type":"inject","z":"b46402af.18cde","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":93.5,"y":760,"wires":[["f454008b.a50d4"]]},{"id":"3b78ccda.b81e54","type":"ui_group","z":"","name":"Default","tab":"58a3d04c.c5bb7","disp":true,"width":"6","collapse":false},{"id":"58a3d04c.c5bb7","type":"ui_tab","z":"","name":"ButtonBug","icon":"dashboard","disabled":false,"hidden":false}]

I have a workaround, that is to save msg.Zone into flow.Zone before button, the set the payload to flow.Zone. But I thought the idea of Node red was this stuff should be passed through the messages, saving temporary data to context may give issues later.

I am not able to test your flow at the moment, but have you made sure the payload is set to either the on or off values defined for the switch? You can check that by making sure that your message sets the switch state when you send it, having first set the switch to the other state obviously.

[edit] Sorry, I misread your post, I thought you were talking about a ui-switch node rather than a button node. I notice that you have not selected Emulate a button click if message arrives on input. Have you tried selecting that?

Thanks, I thought you might have been on the wrong node, thanks for the correction.

I do not want the 'button click' on message arrives function as that will prematurely set off next message.