AND gate experiment

Hi
Just last two week I started to learn node red and I start with very simple things
I used AND gate with inject number or 80 and numeric.
I found with condition=> to the AND gate that the inject button will pass from debug and the other as well but if the inject changed to more 80 then will no output on debug
would you please explain ow the AND gate operation
[{"id":"e2d6afd7.b17cc","type":"inject","z":"d3a7c1fa.6de2c","name":"","topic":"","payload":"82","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":140,"wires":[["7f28e320.49ef9c"]]}]

thanks in advance

You have only exported the inject node, you need to mark all the nodes required to show the problem then export.
Also tell us which AND get you are using, there are many logic gates available. It is probably node-red-contrib-something.

Sorry ,please find below :slight_smile:[{"id":"e2d6afd7.b17cc","type":"inject","z":"d3a7c1fa.6de2c","name":"","topic":"","payload":"82","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":140,"wires":[["7f28e320.49ef9c"]]},{"id":"111037d.ce9eac8","type":"debug","z":"d3a7c1fa.6de2c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":680,"y":240,"wires":[]},{"id":"7f28e320.49ef9c","type":"and-gate","z":"d3a7c1fa.6de2c","name":"AND Gate","rules":[{"t":"gte","v":"80","vt":"num","propertyType":"msg","property":"payload","topic":""},{"t":"gte","v":"80","vt":"str","propertyType":"msg","property":"payload","topic":""},{"t":"eq","v":"80","vt":"str","propertyType":"msg","property":"payload","topic":""}],"outputTopic":"","gateType":"and","emitOnlyIfTrue":true,"x":450,"y":241,"wires":[["111037d.ce9eac8"]]},{"id":"4b03ab62.fcf104","type":"ui_numeric","z":"d3a7c1fa.6de2c","name":"","label":"numeric","tooltip":"","group":"bae91d50.a1df9","order":5,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"","format":"{{value}}","min":0,"max":"100","step":1,"x":180,"y":400,"wires":[["7f28e320.49ef9c"]]},{"id":"68c9c7ad.deb6c8","type":"ui_slider","z":"d3a7c1fa.6de2c","name":"","label":"S1","tooltip":"","group":"bae91d50.a1df9","order":5,"width":0,"height":0,"passthru":true,"outs":"all","topic":"","min":0,"max":"100","step":1,"x":140,"y":280,"wires":[["7f28e320.49ef9c"]]},{"id":"bae91d50.a1df9","type":"ui_group","z":"","name":"Mustafa","tab":"6af1a82.7e58658","disp":true,"width":"6","collapse":false},{"id":"6af1a82.7e58658","type":"ui_tab","z":"","name":"Home","icon":"my dash","order":2}]

And the answer to my other question?

I got it from this link

That's what I needed to know, node-red-contrib-bool-gate. Now I can look at your flow.

If you click on the AND node and then look at the Info tab for it (click the i above the right hand pane) you will see instructions on how to use it. They are not very clear I agree but if you look at the first paragraph under the heading Inputs it says
"topic(mandatory) string
the topic of the message. This is mandatory because of the node configuration "
You haven't provided topics for your input messages or for your conditions in the node so it isn't going to work very well.
I note also that you have selected True Restriction, which according the Info means
"if checked, the node will output message only if the condition is true"
So the node will either output nothing or True, but never false.
Also I don't understand what rules you are trying to use. Since you are testing numbers you should make sure that all the comparisons are of type number, your second and third ones are string (a/z). Looking at the rules you are asking for >=80 AND >= 80 AND == 80 which seems an odd thing to be testing.

Thank you Colin
it is work now
I have another question for counters can I post it here or with new topic?

Glad you got it working.
If it is a different question then best to start a new thread.

1 Like

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