I just made the jump from IDE to Node-RED where JavaScript comes into play. I am eager to learn but my knowledge is limited knowledge.
What I am trying to do, is simple to check the msg.payload, if the value is larger than 25 then I want to return 1 else I want to return 0.
I have tried different codes, but it does not work.
m = msg.payload;
if (m < 25)
{
return 1;
}
else if (m > 25)
{
return 0;
}
and
m = msg.payload;
if (m < 25)
{
return 1;
}
else ()
{
return 0;
}
<to>, no?msgobject from a Node-RED function node, not just a value. Convention says you return the value asmsg.payload