Sorry, I didn't look at the actual flow. I was writing my own take.
Please have a look at this. No special nodes.
Zoom it so the entire flow is visible and press any of the buttons: FWD, REV, Half UP, Half DOWN.
Watch the payloads come out and check you are happy.
Then try the STOP button.
[{"id":"67b8edc1.d9b56c","type":"function","z":"703c61ac.837e1","name":"Motor control.","func":"msg.motor = msg.payload;\n//\n// turn on motor.\n//\n\n// Set payload for next stage.\nmsg.payload = \"OFF\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":600,"y":3540,"wires":[["73bfac2e.59945c","a15221f4.3216f","ffe6301b.8d0e18"]]},{"id":"5fccfc50.27513c","type":"delay","z":"703c61ac.837e1","name":"Delay","pauseType":"delay","timeout":"0.3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":440,"y":3540,"wires":[["67b8edc1.d9b56c"]]},{"id":"73bfac2e.59945c","type":"delay","z":"703c61ac.837e1","name":"Blinds in motion","pauseType":"delayv","timeout":"20","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":550,"y":3670,"wires":[["59be7d4b.bd03b4"]]},{"id":"a15221f4.3216f","type":"debug","z":"703c61ac.837e1","name":"Motor control","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"motor","targetType":"msg","statusVal":"","statusType":"auto","x":770,"y":3590,"wires":[]},{"id":"ffe6301b.8d0e18","type":"debug","z":"703c61ac.837e1","name":"Delay","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"delay","targetType":"msg","statusVal":"delay","statusType":"auto","x":750,"y":3490,"wires":[]},{"id":"331c955a.aa41da","type":"function","z":"703c61ac.837e1","name":"Set DIRECTION per payload","func":"msg.direction = msg.payload;\n//\n// Set GPIO pin depending on message\n//\n\n\n// Set message for next stage.\nmsg.payload = \"ON\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":550,"y":3400,"wires":[["5fccfc50.27513c","1657da4.0f9a2a6"]]},{"id":"3de03a0c.65d78e","type":"inject","z":"703c61ac.837e1","name":"STOP!","props":[{"p":"reset","v":"true","vt":"bool"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":220,"y":3670,"wires":[["5fccfc50.27513c","73bfac2e.59945c","5ee8fd36.fcbb9c"]]},{"id":"59be7d4b.bd03b4","type":"function","z":"703c61ac.837e1","name":"Motor control.","func":"msg.motor = msg.payload;\n//\n// turn on motor.\n//\n\n// Set payload for next stage.\nmsg.payload = \"OFF\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":780,"y":3670,"wires":[["b30f2d87.b92e58","969983b8.09ceb"]]},{"id":"b34615ab.8fc07","type":"inject","z":"703c61ac.837e1","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"FWD","payloadType":"str","x":340,"y":3380,"wires":[["331c955a.aa41da"]]},{"id":"938a1080.8df348","type":"inject","z":"703c61ac.837e1","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"REV","payloadType":"str","x":340,"y":3420,"wires":[["331c955a.aa41da"]]},{"id":"1657da4.0f9a2a6","type":"debug","z":"703c61ac.837e1","name":"Direction","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"direction","targetType":"msg","statusVal":"","statusType":"auto","x":450,"y":3590,"wires":[]},{"id":"a5b1d077.a568a8","type":"inject","z":"703c61ac.837e1","name":"Half up","props":[{"p":"payload"},{"p":"delay","v":"10000","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"FWD","payloadType":"str","x":340,"y":3290,"wires":[["331c955a.aa41da"]]},{"id":"371313bb.963e8c","type":"inject","z":"703c61ac.837e1","name":"Half down","props":[{"p":"payload"},{"p":"delay","v":"10000","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"REV","payloadType":"str","x":350,"y":3330,"wires":[["331c955a.aa41da"]]},{"id":"5ee8fd36.fcbb9c","type":"change","z":"703c61ac.837e1","name":"OFF","rules":[{"t":"set","p":"payload","pt":"msg","to":"OFF","tot":"str"},{"t":"delete","p":"reset","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":3710,"wires":[["59be7d4b.bd03b4"]]},{"id":"b30f2d87.b92e58","type":"debug","z":"703c61ac.837e1","name":"Motor control","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"motor","targetType":"msg","statusVal":"","statusType":"auto","x":460,"y":3810,"wires":[]},{"id":"969983b8.09ceb","type":"delay","z":"703c61ac.837e1","name":"Delay","pauseType":"delay","timeout":"0.3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":440,"y":3760,"wires":[["73f3ab00.97045c"]]},{"id":"73f3ab00.97045c","type":"function","z":"703c61ac.837e1","name":"Release direction control","func":"msg.payload = \"Release\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":640,"y":3760,"wires":[["68a163af.22f8f4"]]},{"id":"68a163af.22f8f4","type":"debug","z":"703c61ac.837e1","name":"Direction","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":840,"y":3810,"wires":[]}]
I wrote it like this (blocky) to not confuse you with what was happening.
The function
nodes need work to actually do anything.
You could nearly just connect the GPIO
nodes to the function
nodes.
I'll leave that part to you.
But do you see what I am doing?
Update:
This is a slightly bigger/better flow.
The stuff on the right is now better explained where it goes and what it does.
You will have to check the 1
and 0
are correct. But it isn't rocket science.
[{"id":"67b8edc1.d9b56c","type":"function","z":"703c61ac.837e1","name":"Motor control.","func":"msg.motor = msg.payload;\n//\n// turn on motor.\n//\n\n// Set payload for next stage.\nmsg.payload = \"OFF\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":600,"y":3540,"wires":[["73bfac2e.59945c","a15221f4.3216f","ffe6301b.8d0e18","57c6aa4d.2463a4"]]},{"id":"5fccfc50.27513c","type":"delay","z":"703c61ac.837e1","name":"Delay","pauseType":"delay","timeout":"0.3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":440,"y":3540,"wires":[["67b8edc1.d9b56c"]]},{"id":"73bfac2e.59945c","type":"delay","z":"703c61ac.837e1","name":"Blinds in motion","pauseType":"delayv","timeout":"20","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":550,"y":3670,"wires":[["59be7d4b.bd03b4"]]},{"id":"a15221f4.3216f","type":"debug","z":"703c61ac.837e1","name":"Motor control","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"motor","targetType":"msg","statusVal":"","statusType":"auto","x":770,"y":3590,"wires":[]},{"id":"ffe6301b.8d0e18","type":"debug","z":"703c61ac.837e1","name":"Delay","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"delay","targetType":"msg","statusVal":"delay","statusType":"auto","x":750,"y":3490,"wires":[]},{"id":"57c6aa4d.2463a4","type":"function","z":"703c61ac.837e1","name":"","func":"if (msg.motor == \"ON\")\n{\n msg.payload = 1;\n} else\nmsg.payload = 0;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1130,"y":3540,"wires":[["1212ec0a.d8ebcc"]]},{"id":"331c955a.aa41da","type":"function","z":"703c61ac.837e1","name":"Set DIRECTION per payload","func":"msg.direction = msg.payload;\n//\n// Set GPIO pin depending on message\n//\n\n\n// Set message for next stage.\nmsg.payload = \"ON\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":550,"y":3400,"wires":[["5fccfc50.27513c","1657da4.0f9a2a6","160b4919.847b87"]]},{"id":"3de03a0c.65d78e","type":"inject","z":"703c61ac.837e1","name":"STOP!","props":[{"p":"reset","v":"true","vt":"bool"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":220,"y":3670,"wires":[["5fccfc50.27513c","73bfac2e.59945c","5ee8fd36.fcbb9c"]]},{"id":"59be7d4b.bd03b4","type":"function","z":"703c61ac.837e1","name":"Motor control.","func":"msg.motor = msg.payload;\n//\n// turn on motor.\n//\n\n// Set payload for next stage.\nmsg.payload = \"OFF\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":780,"y":3670,"wires":[["b30f2d87.b92e58","969983b8.09ceb","57c6aa4d.2463a4"]]},{"id":"1212ec0a.d8ebcc","type":"debug","z":"703c61ac.837e1","name":"TO GPIO PIN for motor ON/OFF","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1380,"y":3540,"wires":[]},{"id":"b34615ab.8fc07","type":"inject","z":"703c61ac.837e1","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"FWD","payloadType":"str","x":340,"y":3380,"wires":[["331c955a.aa41da"]]},{"id":"938a1080.8df348","type":"inject","z":"703c61ac.837e1","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"REV","payloadType":"str","x":340,"y":3420,"wires":[["331c955a.aa41da"]]},{"id":"1657da4.0f9a2a6","type":"debug","z":"703c61ac.837e1","name":"Direction","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"direction","targetType":"msg","statusVal":"","statusType":"auto","x":450,"y":3590,"wires":[]},{"id":"a5b1d077.a568a8","type":"inject","z":"703c61ac.837e1","name":"Half up","props":[{"p":"payload"},{"p":"delay","v":"10000","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"FWD","payloadType":"str","x":340,"y":3290,"wires":[["331c955a.aa41da"]]},{"id":"371313bb.963e8c","type":"inject","z":"703c61ac.837e1","name":"Half down","props":[{"p":"payload"},{"p":"delay","v":"10000","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"REV","payloadType":"str","x":350,"y":3330,"wires":[["331c955a.aa41da"]]},{"id":"160b4919.847b87","type":"function","z":"703c61ac.837e1","name":"","func":"if (msg.direction == \"FWD\")\n{\n msg.payload = 1;\n} else\nmsg.payload = 0;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1140,"y":3400,"wires":[["e8fd2650.75467"]]},{"id":"5ee8fd36.fcbb9c","type":"change","z":"703c61ac.837e1","name":"OFF","rules":[{"t":"set","p":"payload","pt":"msg","to":"OFF","tot":"str"},{"t":"delete","p":"reset","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":3710,"wires":[["59be7d4b.bd03b4"]]},{"id":"b30f2d87.b92e58","type":"debug","z":"703c61ac.837e1","name":"Motor control","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"motor","targetType":"msg","statusVal":"","statusType":"auto","x":460,"y":3810,"wires":[]},{"id":"969983b8.09ceb","type":"delay","z":"703c61ac.837e1","name":"Delay","pauseType":"delay","timeout":"0.3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":440,"y":3760,"wires":[["73f3ab00.97045c"]]},{"id":"e8fd2650.75467","type":"debug","z":"703c61ac.837e1","name":"TO GPIO PIN for direction control","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1390,"y":3400,"wires":[]},{"id":"73f3ab00.97045c","type":"function","z":"703c61ac.837e1","name":"Release direction control","func":"msg.payload = \"Release\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":640,"y":3760,"wires":[["68a163af.22f8f4","160b4919.847b87"]]},{"id":"68a163af.22f8f4","type":"debug","z":"703c61ac.837e1","name":"Direction","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":840,"y":3810,"wires":[]}]