Why am I not getting this? msg.(stuff)


I have a function node.

It has this in it.

var msg2 = { payload:"", background:"red"};
return [msg,msg2];

the second output goes to a button and it sets the colour. (Derived from msg.background)

I am messing about with an INJECT node: (JSON)


Doesn't work.
Looking, the message has an OBJECT which than has a sub-part background.

Ok.... Not too much of a worry. I'll write it in another function node and be done with it.

return msg;

Pretty well the first one, but only with one output.

Also doesn't work.

Anyone know where I can buy a new brain? This one seems to not be working.

I AM sorry. I do NOT like being like I am, but I am stuck with it.

I don't get WHY I am not getting this "syntax" stuff for how messages are "structured".
What is it that I am missing?



go look at our inject node and ask your self "Where is the json being stored?'

adding some ebug nodes might help you figure out what is going wrong



This is the example I am using:

[{"id":"a42a2937.c49d1","type":"debug","z":"afeeae02.67742","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":580,"y":770,"wires":[]},{"id":"1cda3566.bbbb63","type":"inject","z":"afeeae02.67742","name":"","topic":"","payload":"{ \"payload\":\"\", \"background\":\"red\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":410,"y":730,"wires":[["951ac643.5abde"]]},{"id":"b6f9f2fe.7849c8","type":"function","z":"afeeae02.67742","name":"","func":"msg.topic=\"ENABLE\";\nvar msg = { payload:\"\", background:\"lime\"};\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":770,"wires":[["a42a2937.c49d1"]]},{"id":"5ab558bd.ac87d","type":"inject","z":"afeeae02.67742","name":"","topic":"","payload":"Blah","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":270,"y":770,"wires":[["b6f9f2fe.7849c8"]]},{"id":"951ac643.5abde","type":"debug","z":"afeeae02.67742","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":580,"y":730,"wires":[]}]

Not rocket science.

This is the screen shot - as a picture says 1000 words.
The two outputs are not the same - to me anyway.



You are correct. Now go back and look at the inject node and read it’s info tab and look at the settings and see if you can determine why the debug node connected to the inject node displays what it does.



Because it can only deal with msg.payload and msg.topic - right?

I got caught up with msg.background and forgot (yeah, pitiful) that it only does payload and topic.


Just when I am trying to pick a problem to pieces, I just "grab" the inject and stick things in it forgetting the limits.

I either need the change node or the function node to do the extra bits.