Hi dceejay,
I have tried the RBE - Ignore initial value, but I cannot find a good result using it. According to my flow, each time two buy messages are coming, the RBE blocks both. As soon as a sell message comes, it passes.
What I would expect here is the RBE - ignore initial value to block the first "buy message", then let the second buy to pass. As soon as it turns to "sell" message, block the 1st sell one, then let the second to pass.
[{"id":"685360b7.22a1b","type":"link out","z":"bf3bef9a.b6faf","name":"","links":["2333c760.a5a568","6d254b4d.d156c4","67619b0a.8245b4","96ebcc.5b423438","186344db.624dfb","a6eb259c.a7a368","c4d89bb5.4156b8","176593ca.87d22c","443f31a1.9058","5713ac11.01d544","5846ab79.5ee1b4","a3e69091.80c","5fd911df.05f63","9c7cd9cb.b8fe58"],"x":1535,"y":400,"wires":[]},{"id":"b96a4b3.e677db8","type":"function","z":"bf3bef9a.b6faf","name":"Set to Buy","func":"if (flow.get(\"Direction\") != \"Buy\")\n{\n flow.set(\"Direction\",\"Buy\"); \n}\n// else\n// {\n// // Stop flow\n// return null;\n// }\nreturn msg;\n","outputs":1,"noerr":0,"x":1390,"y":380,"wires":[["685360b7.22a1b"]]},{"id":"84c7325f.6e1fd","type":"inject","z":"bf3bef9a.b6faf","name":"Sell","topic":"","payload":"Sell","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":750,"y":420,"wires":[["cc11d921.7096f8"]]},{"id":"c3265a99.2bf198","type":"function","z":"bf3bef9a.b6faf","name":"Set to Sell","func":"if (flow.get(\"Direction\") != \"Sell\")\n{\n flow.set(\"Direction\",\"Sell\"); \n}\n// else\n// {\n// // Stop flow\n// return null;\n// }\nreturn msg;\n","outputs":1,"noerr":0,"x":1390,"y":440,"wires":[["685360b7.22a1b"]]},{"id":"9fa9f9b0.f1bb68","type":"inject","z":"bf3bef9a.b6faf","name":"Buy","topic":"","payload":"Buy","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":770,"y":380,"wires":[["cc11d921.7096f8"]]},{"id":"cc11d921.7096f8","type":"rbe","z":"bf3bef9a.b6faf","name":"","func":"rbei","gap":"","start":"","inout":"out","property":"payload","x":1010,"y":400,"wires":[["c49a8b2e.806a18"]]},{"id":"c49a8b2e.806a18","type":"switch","z":"bf3bef9a.b6faf","name":"Buy/Sell","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Buy","vt":"str"},{"t":"eq","v":"Sell","vt":"str"}],"checkall":"true","repair":true,"outputs":2,"x":1160,"y":400,"wires":[["b96a4b3.e677db8"],["c3265a99.2bf198"]]}]
Regarding the reset of the RBE, I couldn't find a way to incorporate it on my flow. I have checked it out on the internet and I have find this, but unfortunately it doesn't work properly:
[{"id":"685360b7.22a1b","type":"link out","z":"bf3bef9a.b6faf","name":"","links":["2333c760.a5a568","6d254b4d.d156c4","67619b0a.8245b4","96ebcc.5b423438","186344db.624dfb","a6eb259c.a7a368","c4d89bb5.4156b8","176593ca.87d22c","443f31a1.9058","5713ac11.01d544","5846ab79.5ee1b4","a3e69091.80c","5fd911df.05f63","9c7cd9cb.b8fe58"],"x":1535,"y":400,"wires":[]},{"id":"b96a4b3.e677db8","type":"function","z":"bf3bef9a.b6faf","name":"Set to Buy","func":"if (flow.get(\"Direction\") != \"Buy\")\n{\n flow.set(\"Direction\",\"Buy\"); \n}\n// else\n// {\n// // Stop flow\n// return null;\n// }\nreturn msg;\n","outputs":1,"noerr":0,"x":1390,"y":380,"wires":[["685360b7.22a1b"]]},{"id":"84c7325f.6e1fd","type":"inject","z":"bf3bef9a.b6faf","name":"Sell","topic":"","payload":"Sell","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":750,"y":420,"wires":[["cc11d921.7096f8"]]},{"id":"c3265a99.2bf198","type":"function","z":"bf3bef9a.b6faf","name":"Set to Sell","func":"if (flow.get(\"Direction\") != \"Sell\")\n{\n flow.set(\"Direction\",\"Sell\"); \n}\n// else\n// {\n// // Stop flow\n// return null;\n// }\nreturn msg;\n","outputs":1,"noerr":0,"x":1390,"y":440,"wires":[["685360b7.22a1b"]]},{"id":"9fa9f9b0.f1bb68","type":"inject","z":"bf3bef9a.b6faf","name":"Buy","topic":"","payload":"Buy","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":770,"y":380,"wires":[["cc11d921.7096f8"]]},{"id":"cc11d921.7096f8","type":"rbe","z":"bf3bef9a.b6faf","name":"","func":"rbei","gap":"","start":"","inout":"out","property":"payload","x":1010,"y":400,"wires":[["c49a8b2e.806a18","986ceddd.e1347"]]},{"id":"c49a8b2e.806a18","type":"switch","z":"bf3bef9a.b6faf","name":"Buy/Sell","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Buy","vt":"str"},{"t":"eq","v":"Sell","vt":"str"}],"checkall":"true","repair":true,"outputs":2,"x":1160,"y":400,"wires":[["b96a4b3.e677db8"],["c3265a99.2bf198"]]},{"id":"986ceddd.e1347","type":"switch","z":"bf3bef9a.b6faf","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":true,"outputs":2,"x":1170,"y":300,"wires":[["74f1c82e.a60c08"],["96e5e633.7120e8"]]},{"id":"74f1c82e.a60c08","type":"delay","z":"bf3bef9a.b6faf","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1000,"y":180,"wires":[[]]},{"id":"96e5e633.7120e8","type":"change","z":"bf3bef9a.b6faf","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"1","tot":"num"},{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":180,"wires":[["74f1c82e.a60c08"]]}]
Overall, what I am looking for is:
- block the first message, then let the other to pass
- reset the RBE after a certain period of time (1 minute), this would allow to only send a message to the flow every minute.
The result would be:
BLOCK (because of the ignore initial value)
PASS (buy or sell)
BLOCK
BLOCK
BLOCK
...
1 minute later (reset of RBE)
...
BLOCK (because of the ignore initial value)
PASS (buy or sell)
BLOCK
BLOCK
BLOCK
etc...
Thanks a lot