Hi, trying to change msg.payload from true to on and false to off from the alexa node. Used a function node with the following but it doesnt work, can anyone tell me why.??
if (msg.payload == "true"){
msg.payload = "on";
}
else if (msg.payload == "false"){
msg.payload = "off";
}
return msg;
if its a typeof boolean true and false you need to do the comparison without the “”,so:
if (msg.payload == true) {
otherwise your looking for the literal strings of true and false.
You can see which it is when you connect a debug to the previous node and check in the debug tab for the format of this message property.
Johannes
Ps: and a happy forum anniversary