I have done this in the following way more or less, setting the name of the node programely is difficult,
(you have to update the flow.js file and deploy it) but maybe this can help you.
What i do here is,
- I set the name of the comment node,
- deploy, and then use this name property to inject this value into the flow.
- so i can see what i am injecting for manually testing.
[{"id":"688cf92c.1f9a48","type":"trigger","z":"e97aed1b.db4d9","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"200","extend":false,"units":"ms","reset":"","bytopic":"all","name":"for puls","x":384,"y":72,"wires":[["feabb847.8fa378"]]},{"id":"feabb847.8fa378","type":"function","z":"e97aed1b.db4d9","name":"main func","func":"if(msg.topic === \"setStatus\") return [null,null];\n\nvar Door = 0;\nvar pin = global.get(\"manual\"); // number\n\nif (msg.flow[pin].t !== \"switch\") {\n Door = msg.payload;\n if(msg.payload === true || msg.payload === false) {\n node.warn(\"Doors need to be opend and closed!!!\");\n return null;\n }\n}\n\nif( Door === \"OPEN\" || Door === \"CLOSED\" ) { \n return {manually:true,i:pin,state:Door === \"OPEN\"?false:true}; // doors\n} \nif(msg.payload === \"OPEN\" || msg.payload === \"CLOSED\") {\n msg.payload = msg.payload === \"CLOSED\"? false:true;\n} \nreturn{ i :pin,\n state :msg.payload,\n manually:true};\n\n\n","outputs":1,"noerr":0,"x":552,"y":108,"wires":[[]],"outputLabels":["Doors"]},{"id":"2901597f.23a516","type":"switch","z":"e97aed1b.db4d9","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"pushed","vt":"str"},{"t":"eq","v":"pushed-released","vt":"str"},{"t":"eq","v":"CLOSED","vt":"str"},{"t":"eq","v":"OPEN","vt":"str"},{"t":"eq","v":"setStatus","vt":"str"}],"checkall":"false","repair":false,"outputs":5,"x":206,"y":120,"wires":[["688cf92c.1f9a48"],["b999acdc.acb2c"],["3d798d5c.84e7a2"],["3d798d5c.84e7a2"],["e4f73ac0.49bb38"]]},{"id":"b999acdc.acb2c","type":"trigger","z":"e97aed1b.db4d9","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"1000","extend":false,"units":"ms","reset":"","bytopic":"all","name":"hold 1 sec","x":384,"y":108,"wires":[["feabb847.8fa378"]]},{"id":"3d798d5c.84e7a2","type":"trigger","z":"e97aed1b.db4d9","op1":"","op2":"","op1type":"pay","op2type":"nul","duration":"1","extend":false,"units":"ms","reset":"","bytopic":"all","name":"dummy","x":384,"y":144,"wires":[["feabb847.8fa378"]]},{"id":"e4f73ac0.49bb38","type":"http request","z":"e97aed1b.db4d9","name":"get number from comment field","method":"GET","ret":"obj","paytoqs":false,"url":"http://openhab:1880/flows","tls":"","persist":false,"proxy":"","authType":"","x":166,"y":204,"wires":[["a15d0cf2.06521"]]},{"id":"a15d0cf2.06521","type":"change","z":"e97aed1b.db4d9","name":"set global to number","rules":[{"t":"set","p":"input","pt":"msg","to":"payload.(\t$number($[id=\"f987b28a.65576\"].name\t))","tot":"jsonata"},{"t":"set","p":"manual","pt":"global","to":"input","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":424,"y":204,"wires":[["8a1db4ab.f16868"]]},{"id":"8a1db4ab.f16868","type":"function","z":"e97aed1b.db4d9","name":"Info on manual","func":"var Door = false;\nvar comment = [], p;\n\n\nif (msg.flow[msg.input].t === \"switch\") {\n p = msg.flow[msg.input].puls;\n} else {\n p =msg.flow[msg.input].OPEN;\n Door = true;\n}\nfor (var name in p){\n comment.push(name + \" - \");\n}\n\nmsg = {};\nreturn {payload:Door? \"Type: Door - Output \" + comment : \"Type: Switch - Outpu \" + comment};\n\n\n","outputs":1,"noerr":0,"x":632,"y":204,"wires":[[]]}]