Skip to content

Alexa Integration

Dominik Kogel edited this page Oct 17, 2020 · 2 revisions

You may use this Code in Node-Red to transform a Alexa Devices Message into a Usable Message you can send over MQTT.

if(msg.on){
    newMsg = 
            {"payload":{  
                "mode": 0,
                "color": [  Math.round(msg.rgb[0]*4),
                            Math.round(msg.rgb[1]*3.8),
                            Math.round(msg.rgb[2]*3.6),
                            0,
                            0],
                "time": 1000 
            }}
}else{
    newMsg = 
            {  "payload":{ 
                "mode": 0,
                "color": [  0,
                            0,
                            0,
                            0,
                            0],
                "time": 1000 
            }}
}

return newMsg;
Clone this wiki locally