I am new to node red, but been a system designer, extensive code designer on many systems, etc. Well I guess you get the picture, I know programming and many languages. But I digress.
Below are three(3) simple flows. The first one works. The second one does not, but I think it should? The third one works, but not sure it is valid or best practice, need suggestions on if it is such? Seems like a bit of a hack?
[{"id":"f06145ab.bcc268","type":"tab","label":"Test","disabled":false,"info":""},{"id":"63130af7.50e58c","type":"inject","z":"f06145ab.bcc268","name":"Test (False)","topic":"Test","payload":"false","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":120,"wires":[["92211433.f9a4a8"]]},{"id":"92211433.f9a4a8","type":"function","z":"f06145ab.bcc268","name":"Set Flow To Message","func":"var theMessage=flow.get('Message') || {};\n\nflow.set('Message', 'This is a test!');\nmsg.payload=flow.get('Message');\n\nreturn msg;","outputs":1,"noerr":0,"x":320,"y":120,"wires":[["67bc5365.df0544"]]},{"id":"67bc5365.df0544","type":"debug","z":"f06145ab.bcc268","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":530,"y":120,"wires":[]},{"id":"d6ce6963.ce1118","type":"inject","z":"f06145ab.bcc268","name":"Test (False)","topic":"Test","payload":"false","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":180,"wires":[["e6e594cd.840ff"]]},{"id":"e6e594cd.840ff","type":"change","z":"f06145ab.bcc268","name":"Set flow.payload","rules":[{"t":"set","p":"payload","pt":"flow","to":"This is a test!","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":180,"wires":[["407ec064.2ad938"]]},{"id":"407ec064.2ad938","type":"change","z":"f06145ab.bcc268","name":"Set msg.payload","rules":[{"t":"set","p":"payload","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":180,"wires":[["f5414498.397d98"]]},{"id":"f5414498.397d98","type":"debug","z":"f06145ab.bcc268","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":180,"wires":[]},{"id":"bda2d04d.e10208","type":"inject","z":"f06145ab.bcc268","name":"Test (False)","topic":"Test","payload":"false","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":240,"wires":[["29f2e3c0.b5bc9c"]]},{"id":"29f2e3c0.b5bc9c","type":"change","z":"f06145ab.bcc268","name":"Set flow.payload","rules":[{"t":"set","p":"payload","pt":"flow","to":"This is a test!","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":240,"wires":[["13bbdc29.bfca8c"]]},{"id":"13bbdc29.bfca8c","type":"change","z":"f06145ab.bcc268","name":"Move msg.payload","rules":[{"t":"move","p":"payload","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":240,"wires":[["9a5021d.a158d6"]]},{"id":"9a5021d.a158d6","type":"debug","z":"f06145ab.bcc268","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":240,"wires":[]}]
Any help explaining why the second flow does not work, when I think it should work, greatly appreciated.