Hello i m want a simple if else sircet but instad of switches with buttons
so i select number 2 so Button 2 is true than thats saved for 5 second and when in this time a aktivations switch is pressed its true. but im not sure how to do this.
Hi @LostiLama
I am trying to understand what you mean, but can't.
What are the inputs - to be clear?
Node-red buttons or physical buttons via GPIO?
How many buttons?
Idea:
Although I believe time is also in the formula, try to draw a table of what you want to happen.
I can't show an example just now as formatting text is not allowed here.
I'll go away and make a picture and post it soon.
Grey = off
Green = on
yellow = don't care
1,2,3 inputs.
0 output.
This is a bit of code I made.
I don't really know what you want, but it does what I think you mean.
Press either of the inject
nodes.
Press the other one within 5
seconds and you get an output.
If you wait more than 5
seconds, nothing happens.
Not perfect - I'm sure - and you need a foreign node:
node-red-contrib-queue-gate
[{"id":"435f958cf7838596","type":"trigger","z":"65c9b63cb09879a0","name":"","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"5","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":470,"y":2550,"wires":[["d438eb4f1721d421"]]},{"id":"70fbcc90902efe7c","type":"inject","z":"65c9b63cb09879a0","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"A","payloadType":"str","x":280,"y":2550,"wires":[["435f958cf7838596","5a0977f7980f71c5","c211e18e54e5ffd7"]]},{"id":"12e5a75dfcd214da","type":"inject","z":"65c9b63cb09879a0","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"B","payloadType":"str","x":280,"y":2690,"wires":[["192d5ee3605f0aeb","e41b5aa7c73cccb8","a06e461907a508b7"]]},{"id":"192d5ee3605f0aeb","type":"trigger","z":"65c9b63cb09879a0","name":"","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"5","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":470,"y":2690,"wires":[["c03615454637527a"]]},{"id":"5a0977f7980f71c5","type":"q-gate","z":"65c9b63cb09879a0","name":"","controlTopic":"control","defaultState":"queueing","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","queueCmd":"queue","defaultCmd":"default","triggerCmd":"trigger","flushCmd":"flush","resetCmd":"reset","peekCmd":"peek","dropCmd":"drop","statusCmd":"status","maxQueueLength":"1","keepNewest":false,"qToggle":false,"persist":false,"storeName":"memory","x":610,"y":2490,"wires":[["c8fb069fb3e702eb"]]},{"id":"e41b5aa7c73cccb8","type":"q-gate","z":"65c9b63cb09879a0","name":"","controlTopic":"control","defaultState":"queueing","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","queueCmd":"queue","defaultCmd":"default","triggerCmd":"trigger","flushCmd":"flush","resetCmd":"reset","peekCmd":"peek","dropCmd":"drop","statusCmd":"status","maxQueueLength":"1","keepNewest":false,"qToggle":false,"persist":false,"storeName":"memory","x":610,"y":2640,"wires":[["c8fb069fb3e702eb"]]},{"id":"d438eb4f1721d421","type":"change","z":"65c9b63cb09879a0","name":"Reset","rules":[{"t":"set","p":"payload","pt":"msg","to":"reset","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":2550,"wires":[["5a0977f7980f71c5","e41b5aa7c73cccb8"]]},{"id":"c211e18e54e5ffd7","type":"change","z":"65c9b63cb09879a0","name":"Trigger","rules":[{"t":"set","p":"payload","pt":"msg","to":"trigger","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":2590,"wires":[["e41b5aa7c73cccb8"]]},{"id":"c03615454637527a","type":"change","z":"65c9b63cb09879a0","name":"Reset","rules":[{"t":"set","p":"payload","pt":"msg","to":"reset","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":2690,"wires":[["e41b5aa7c73cccb8","5a0977f7980f71c5"]]},{"id":"a06e461907a508b7","type":"change","z":"65c9b63cb09879a0","name":"Trigger","rules":[{"t":"set","p":"payload","pt":"msg","to":"trigger","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":2730,"wires":[["5a0977f7980f71c5"]]},{"id":"c8fb069fb3e702eb","type":"debug","z":"65c9b63cb09879a0","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":830,"y":2600,"wires":[]}]
Hope that helps.
Je this is the right Thing i needed Thanks
If you mean the code, it may be better to mark that post as the solution.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.