I am sure it is very easy but I am struggling.
I am trying to use a button as an indicator on the Node-Red Dashboard from a Modbus TCP connection as the picture shows:
The formula in the function is as follows:
if (msg.payload === 28){
msg.colour = "green";
msg.background ="red";
return msg;}
else{msg.colour ="white";
return msg;}
However the button on my dashboard does not change colour.
Can anyone here help please?
I am open to other suggestions to make an indicator in Node-Red's dashboard.
EDIT I have edited the typo.
Make sure you have configured the ui_button
node's Colour field to be {{msg.colour}}
and Background to be {{msg.background}}
. That tells the node what msg properties to look for to set those fields.
Fix the typo in your function - you are setting msg.backgroud
not msg.background