Button normally open

Hello everyone
Reference to post Momentary switch or button (normally open)
I don't understand how to do it, I would like it to remain true when pressed and false when not pressed. I am trying to do it with an LED node but it stays locked on true (green).

Thank you very much

The momentary switch works as expected. How are using it, and with what LED node. Best if you upload your flow or the relevant part of it so that we can see why it doesn't work as you expect.

With switch if the led works, I mean to do it with a push button while you keep pressed is true and if not pressed is false.

image

Thanks for your answer!

I'm sorry but I have no idea what the nodes X-forward and led are. Can you upload the flow rather than just a picture. If I search for led in the nodes it comes up with 112 nodes!

I want to make a normally open button, that when you press it is true and when you stop pressing it is false. What is in the image is a 'switch' node and then a 'button' node with a name assigned by me, it is for the control of a motor.

Thank you very much

Did you try the solution in the post you linked to at the start?

1 Like

The momentary button sends TRUE when pressed and FALSE when released in the msg.payload. Open the browser dashboard to see the button and its action.

[{"id":"eac5d9eb.958798","type":"ui_template","z":"6d08d5ab.a8aa3c","group":"61e6d4c4.e7619c","name":"momentary button","order":7,"width":"1","height":"1","format":"<div id=\"momentary\">\n   <md-button style=\"min-width:36px;\n                    width: 100%; \n                    height: 100%; \n                    margin:0; \n                    padding: 0px; \n                    border-radius: 50%; \n                    background-color:green\">\n       \n      <i class=\"fa fa-hand-pointer-o\"></i>\n   </md-button>\n</div>\n<script>\n(function($scope) {\n    \n$('#momentary').on('touchstart mousedown', function(e) {\n    e.preventDefault(); //prevent default behavior\n    $scope.send({\"topic\":\"momentary\",\"payload\": true});\n});\n\n$('#momentary').on('touchend mouseup', function(e) {\n    e.preventDefault(); //prevent default behavior\n    $scope.send({\"topic\":\"momentary\",\"payload\": false});\n});\n    \n})(scope);\n</script>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":360,"y":140,"wires":[["534f375d.fce978"]]},{"id":"534f375d.fce978","type":"debug","z":"6d08d5ab.a8aa3c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":530,"y":140,"wires":[]},{"id":"61e6d4c4.e7619c","type":"ui_group","name":"TEST","tab":"d680797a.2f8b88","order":1,"disp":true,"width":"5","collapse":false},{"id":"d680797a.2f8b88","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

I don't know where to put the solution from the previous thread to create the push button. Where to put it?

Thank you very much

That's right, where do I put that? I have tried in the node 'button' in payload: JSON and nothing.

Thank you very much

Did you down load the code by copying it? When you put your cursor over the code in my post you will see in the top right corner a copy icon or expand icon. Click on the copy icon. In Node Red click on the hamburger top right and then Import in the dropdown menu. Paste the code you copied from the post to import it.

It works! How can I change the appearance of the 'button' node type?

Thank you very much

If you double click on the momentary button in the Node Red editor you will be able to edit the ui_template node.

Thank you very much

Hi again,

hello again,

hello again,

I have put two pushbuttons, each connected to its node. The first one turns on both the first 'led' node and the second 'led' node but the second 'led' node is not connected to the first pushbutton, and second pushbutton

image

Thank you!

Without seeing your actual flow, rather than a snapshot, then it is difficult to know what you are doing wrong. For instructions on how to post a flow onto the forum, please read here.

The solution to create several, is to change the id to "momentary".

Thank you very much

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