Hi programmers,
I'm trying to programm a function, which should transform the message of a dashboard-colopicker to a message, which is readable from a HUEmagic node.
The colorpicker sends this message:
The HUEmagic group, which I want to control (I want to change the RGB values) sends this:
So I want to create a function, which takes the color-picker rgb values and makes a message with a payload.rgb.
My function doesn't work, here it is:
// Variablen
var colorR;
var colorG;
var colorB;
/// Programm
colorR = msg.payload.r;
colorG = msg.payload.g;
colorB = msg.payload.b;
var msg_neu ={};
msg_neu.payload.rgb[0] = colorR;
msg_neu.payload.rgb[1] = colorG;
msg_neu.payload.rgb[2] = colorB;
return [msg_neu];
The debug node of the function says:
[TypeError: Cannot read property 'rgb' of undefined]
Hope I formatted everything nice and I hope you can help me. I think it's a format error, but don't know how to fix it..
Thanks for your advice!
Bye, Chris