Button node: If msg arrives on input, emulate a button click:

I've been caught on this before I think but want to check.

What exactly does that mean?

This is the code this time:

[{"id":"d3c31e8d.90ed7","type":"ui_button","z":"caed37a2.771dc","name":"","group":"6ab22327.a2f71c","order":18,"width":"2","height":"1","passthru":true,"label":"button","tooltip":"","color":"","bgcolor":"","icon":"","payload":"3","payloadType":"num","topic":"","x":330,"y":380,"wires":[["6741e2f8.7766f4"]]},{"id":"f2826600.de653","type":"inject","z":"caed37a2.771dc","name":"","topic":"","payload":"8","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":380,"wires":[["d3c31e8d.90ed7"]]},{"id":"6741e2f8.7766f4","type":"debug","z":"caed37a2.771dc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":510,"y":380,"wires":[]},{"id":"6ab22327.a2f71c","type":"ui_group","z":"","name":"HOME","tab":"273de47d.2d2bac","order":1,"disp":true,"width":3,"collapse":false},{"id":"273de47d.2d2bac","type":"ui_tab","z":"","name":"TEST","icon":"dashboard","order":4,"disabled":false,"hidden":false}]

I inject a value of 8 and go through the button.
But I get a 3 in the debug node.

So the emulate a button click means forget what is sent in, you are getting the output as though the button was pressed.

Not just pass the message through.

On the switch node (dashboard) it says this:

Pass though msg if payload matches new state

How does this compare to the button's pass through?

If payload matches new state

So sorry for the brain failure.
But I just want to check.

Emulate button click means exactly that, it is like pressing the button.

In your button node, you say 'send 3 when the button is pushed' so that is what is send whether you press the button or send a msg to the button which acts like you pressed the button - 3 gets sent out in msg payload,

1 Like

I know it was (probably) a stupid question, it just caught me out - maybe again.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.