Turn ON/OFF with Alexa+NodeRed

How is your “lights” device configured in Alexa Home? I’d expect it to look something like this:

Don’t forget that of you make any changes to the Alexa Home device settings, you should do an “Alexa, Discover new devices”. She’ll tell you that no new devices were found, but the attributes/capabilities of the existing devices will have been updated.

Also, do you have a tick in the “Auto Acknowledge” check box? …

image

My flow looks like this:

(Ignore the fact that there’s no Blynk node in this part of the flow, Blynk is updated elsewhere in Node-Red in this case).

The “msg.command to 0/1” function contains this code…

var OnOff;

if (msg.command==='TurnOnRequest')
{
    OnOff="1";
}

if (msg.command==='TurnOffRequest')
{
        OnOff="0";
}

return {'payload': OnOff};

which is really just the same as using a Change node with two rules, but as you can see, the TurnOnRequest and TurnOffRequest commands, are received on msg.command not on msg.payload which appears to be what you were trying to do.

Pete.