[solved] Philips Hue and LIFX RGB-sync

Hi There,

I am a bit new to coding with the function-node. What I am trying to do:

I have Philips Hue lights and LIFX lights.

When I change the color of the Philips lights, I want to send this to the Lifx lights to change in the same colour.

The output of Philips is done by an array (if I'm right), like this:
0 : 255
1 : 255
2 : 255

I need to change this format to just be comma-seperated like:
payload: 255,255,255

I made the following function-node:

var red = msg.payload[0]
var green = msg.payload[1]
var blue =  msg.payload[2]

return [ red, green, blue ];

But it's still returning as:
0 : 255
1 : 255
2 : 255

How can I change this?

Please help me out, thanks!


msg.payload = red+","+green+","+blue

Hi Zenofmud,

Thank you for the reply.

The following error is returning now:

Take a look at that link, rather than returning the payload, return a message object.

Nevermind,found it, had to remove the ".payload" in my return rule.

Thank you for helping me out!

Topic closed.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.