i'm using mqtt to send and recieve messages on node red.
i'm receiving "Red" or "Green" messages and import them to an on start function.
var Color = msg.payload
if (Color === "Red") {
return msg;
}
else if (Color === "Green") {
return msg;
}
else return null;
the function output is a label called "Product", i want it to display "Green" or "Red" and if no message is being sent i want it to display nothing but i'm receiving error message the msg is not defined
That usually means you have no data in your message. Without more information everything from here on is a quess. Have you put a debug node on your node to see what the data is? Possibly a flow might help to see what you are doing.
When i'm not receiving "Green" or "Red" i'm receiving null " ", but it's not getting updated in the ui.
should i change the value format of the label ??