(look at my name)
This flow:
[{"id":"35d675e4.2ad77a","type":"function","z":"184dc884.7aba5f","name":"","func":"delete msg.payload;\nmsg.payload.COMMAND = \"Command\";\nreturn msg;","outputs":1,"noerr":0,"x":220,"y":3430,"wires":[[]]},{"id":"633c46c.32c0438","type":"inject","z":"184dc884.7aba5f","name":"","topic":"","payload":"blah","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":80,"y":3390,"wires":[["35d675e4.2ad77a","7baa8ebf.dbb1c8"]]},{"id":"7baa8ebf.dbb1c8","type":"change","z":"184dc884.7aba5f","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.command","pt":"msg","to":"This is the command","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":250,"y":3390,"wires":[["66d94b85.c264bc"]]}]
Via the change node it works. (learned what has been said)
For the sake of trying I thought I did the same in the function node.
This is in the node:
delete msg.payload;
msg.payload.COMMAND = "Command";
return msg;
Pressing the inject
I get this:
TypeError: Cannot set property 'COMMAND' of undefined
Shrug.
I'm seriously missing something.