Variable payload keeps still displayed on the UI even when no there's no payload

I'm using python to detect two colors "red" and "green", and display them on the node red UI in the form of a text and a led, if i detect green a text green will be written and the led is lit green, but when i terminate the color detection code, the text and led are still green.
i have a function before the text and led to discriminate between red and green:

var Color = msg.payload
if (Color === "Red") {
return msg;
}
else if (Color === "Green") {
return msg;
}

As far as I can see, you are not actually changing the message payload - just returning the original message from each part of the 'if' 'else' construct.

It would help if you posted/shared your Node-RED flow and explained what your main objective is.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.