[{"id":"ad468a8.5cacd78","type":"ui_dropdown","z":"eff21ca4.4f961","name":"","label":"","tooltip":"","place":"Select option","group":"f7e9d0df.b98c","order":4,"width":"3","height":"1","passthru":true,"multiple":false,"options":[{"label":"","value":"Slowest","type":"str"},{"label":"","value":"Regular","type":"str"},{"label":"","value":"Fastest","type":"str"}],"payload":"","topic":"","x":460,"y":120,"wires":[["3e8795c7.16ecfa"]]},{"id":"fed3486b.b6eec8","type":"ui_dropdown","z":"eff21ca4.4f961","name":"","label":"","tooltip":"","place":"Select option","group":"f7e9d0df.b98c","order":2,"width":"3","height":"1","passthru":true,"multiple":false,"options":[{"label":"","value":"1/4","type":"str"},{"label":"","value":"1/2","type":"str"},{"label":"","value":"1","type":"str"}],"payload":"","topic":"","x":460,"y":80,"wires":[["d8148902.3b3fe8"]]},{"id":"c473ae61.25757","type":"inject","z":"eff21ca4.4f961","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"1/4","payloadType":"str","x":330,"y":80,"wires":[["fed3486b.b6eec8"]]},{"id":"e32dc1b3.3747f","type":"inject","z":"eff21ca4.4f961","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"Fastest","payloadType":"str","x":320,"y":120,"wires":[["ad468a8.5cacd78"]]},{"id":"ba37db3b.191718","type":"change","z":"eff21ca4.4f961","name":"a","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload & 'a'","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":80,"wires":[["80b4a56c.e63958"]]},{"id":"679a9a7d.99be04","type":"template","z":"eff21ca4.4f961","name":"b","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload}}b","output":"str","x":710,"y":120,"wires":[["80b4a56c.e63958"]]},{"id":"3e8795c7.16ecfa","type":"change","z":"eff21ca4.4f961","name":"speed","rules":[{"t":"change","p":"payload","pt":"msg","from":"Slowest","fromt":"str","to":"1","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Regular","fromt":"str","to":"2","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Fastest","fromt":"str","to":"3","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":120,"wires":[["679a9a7d.99be04"]]},{"id":"d8148902.3b3fe8","type":"change","z":"eff21ca4.4f961","name":"size","rules":[{"t":"change","p":"payload","pt":"msg","from":"1/4","fromt":"str","to":"4","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"1/2","fromt":"str","to":"2","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"str","to":"1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":80,"wires":[["ba37db3b.191718"]]},{"id":"ee934010.11cc1","type":"comment","z":"eff21ca4.4f961","name":"parameters","info":"","x":310,"y":40,"wires":[]},{"id":"80b4a56c.e63958","type":"join","z":"eff21ca4.4f961","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":730,"y":360,"wires":[["ab6b54d4.dae388","2bbb389d.b2fdd8"]]},{"id":"5ad80a50.3600b4","type":"ui_button","z":"eff21ca4.4f961","name":"","group":"3433dfa4.4f671","order":4,"width":"3","height":"1","passthru":false,"label":"Backward","tooltip":"","color":"","bgcolor":"black","icon":"","payload":"Backward","payloadType":"str","topic":"","x":100,"y":480,"wires":[["8b2a8a9d.75fa98"]]},{"id":"b67f29fd.bafa08","type":"ui_button","z":"eff21ca4.4f961","name":"","group":"3433dfa4.4f671","order":5,"width":"3","height":"1","passthru":false,"label":"Forward","tooltip":"","color":"","bgcolor":"black","icon":"","payload":"Forward","payloadType":"str","topic":"","x":100,"y":440,"wires":[["8b2a8a9d.75fa98"]]},{"id":"8b2a8a9d.75fa98","type":"function","z":"eff21ca4.4f961","name":"","func":"var commands = flow.get('commands') || []\n\nmsg.topic = 'collect'\n\nswitch(msg.payload)\n{\n case 'Forward':\n case 'Backward':\n commands.push(msg.payload) \n break\n \n case 'clear':\n commands = []\n break\n \n case 'run':\n msg.topic = 'start'\n break\n}\nflow.set('commands',commands)\nmsg.payload = commands\nreturn msg\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":270,"y":440,"wires":[["ea5c436b.5d8a6","eb96274c.5bb708"]]},{"id":"43515f78.1aa3b","type":"ui_button","z":"eff21ca4.4f961","name":"","group":"3433dfa4.4f671","order":1,"width":0,"height":0,"passthru":false,"label":"Clear","tooltip":"","color":"","bgcolor":"orange","icon":"","payload":"clear","payloadType":"str","topic":"","x":150,"y":280,"wires":[["8b2a8a9d.75fa98"]]},{"id":"39cc03e4.35983c","type":"ui_button","z":"eff21ca4.4f961","name":"","group":"3433dfa4.4f671","order":2,"width":0,"height":0,"passthru":false,"label":"run","tooltip":"","color":"","bgcolor":"","icon":"","payload":"run","payloadType":"str","topic":"run","x":130,"y":320,"wires":[["8b2a8a9d.75fa98","5a02c3b9.3ab1cc"]]},{"id":"66339c39.f7c834","type":"ui_template","z":"eff21ca4.4f961","group":"3433dfa4.4f671","name":"","order":3,"width":"6","height":"4","format":"<div ng-bind-html=\"msg.payload\"></div>\n","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":300,"y":520,"wires":[[]],"info":"https://flows.nodered.org/flow/2f1aaf0635f9bf23207152682323240a\n"},{"id":"ea5c436b.5d8a6","type":"function","z":"eff21ca4.4f961","name":"<br>","func":"msg.payload = msg.payload.join('<br>')\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":270,"y":480,"wires":[["66339c39.f7c834"]]},{"id":"c663ed62.9cc4f","type":"switch","z":"eff21ca4.4f961","name":"queue","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"start","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":470,"y":480,"wires":[["548499d5.d26488"]]},{"id":"2bbb389d.b2fdd8","type":"debug","z":"eff21ca4.4f961","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":850,"y":420,"wires":[]},{"id":"95ac8af1.52a748","type":"function","z":"eff21ca4.4f961","name":"msg.complete","func":"msg.payload = msg.payload + msg.complete //'\\n'\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":580,"y":560,"wires":[["80b4a56c.e63958"]]},{"id":"548499d5.d26488","type":"change","z":"eff21ca4.4f961","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"Forward","fromt":"str","to":"1","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Backward","fromt":"str","to":"2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":520,"wires":[["95ac8af1.52a748"]]},{"id":"ab6b54d4.dae388","type":"mqtt out","z":"eff21ca4.4f961","name":"ESP32_client_1","topic":"nigrelli/test2","qos":"","retain":"","broker":"34a0d767.dc2698","x":900,"y":360,"wires":[]},{"id":"eb96274c.5bb708","type":"function","z":"eff21ca4.4f961","name":",","func":"msg.payload = msg.payload.join(',')\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":410,"y":440,"wires":[["c663ed62.9cc4f"]]},{"id":"3bac6952.aade96","type":"aedes broker","z":"eff21ca4.4f961","name":"Aedes Broker","mqtt_port":1883,"mqtt_ws_port":"","cert":"","key":"","certname":"","keyname":"","dburl":"","usetls":false,"x":90,"y":60,"wires":[[]]},{"id":"1cfbf940.648b07","type":"ui_ui_control","z":"eff21ca4.4f961","name":"","events":"all","x":560,"y":320,"wires":[[]]},{"id":"9ab323cb.94cd2","type":"change","z":"eff21ca4.4f961","name":"Go To Tab: 1","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":320,"wires":[["1cfbf940.648b07"]]},{"id":"5a02c3b9.3ab1cc","type":"delay","z":"eff21ca4.4f961","name":"0.25","pauseType":"delay","timeout":"0.25","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":270,"y":320,"wires":[["9ab323cb.94cd2"]]},{"id":"b150844e.bea958","type":"ui_button","z":"eff21ca4.4f961","name":"","group":"f7e9d0df.b98c","order":7,"width":"0","height":"0","passthru":false,"label":"Module 1","tooltip":"","color":"","bgcolor":"black","icon":"","payload":"","payloadType":"str","topic":"Module 1","x":200,"y":180,"wires":[["12842a9a.7d3615"]],"info":"color: \"#000000\"\r\n"},{"id":"ba62d7d3.879f08","type":"ui_ui_control","z":"eff21ca4.4f961","name":"","events":"all","x":620,"y":180,"wires":[[]]},{"id":"e4210f74.b486d","type":"change","z":"eff21ca4.4f961","name":"Go To Tab: 3","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":180,"wires":[["ba62d7d3.879f08"]]},{"id":"12842a9a.7d3615","type":"delay","z":"eff21ca4.4f961","name":"0.25","pauseType":"delay","timeout":"0.25","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":330,"y":180,"wires":[["e4210f74.b486d"]]},{"id":"806c5789.24c8d8","type":"comment","z":"eff21ca4.4f961","name":"Return to Main Menu","info":"","x":390,"y":280,"wires":[]},{"id":"f7e9d0df.b98c","type":"ui_group","name":"","tab":"5f3fa8f3.c6bcb8","order":1,"disp":true,"width":"6","collapse":false},{"id":"3433dfa4.4f671","type":"ui_group","name":"","tab":"7847d684.265538","order":1,"disp":true,"width":"6","collapse":false},{"id":"34a0d767.dc2698","type":"mqtt-broker","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"5f3fa8f3.c6bcb8","type":"ui_tab","name":"Main Menu","icon":"dashboard","order":5,"disabled":false,"hidden":false},{"id":"7847d684.265538","type":"ui_tab","name":"Module1","icon":"dashboard","order":7,"disabled":false,"hidden":false}]
I think I'm not implementing msg.complete
correctly.
Here is the join node:
So I want the first parameter followed by "a" then the second parameter followed by "b" and last a string of numbers, such as "1,1,2,2,1,2\n"
.
For example, "4a1b1,1,2\n"
.
Initially, I tried using the count (after a number of message parts). But the resulting string needs to follow the order parameter1, a, parameter2, b, numberSequence. The order could be easily rearranged if using count. That's why I think I need to use msg.complete
.