Controlling the color of philips hue lights: It seems like a pain in the ass.
I have no idea if someone already solved it. I searched through the replies but i was unable to find it so i sat down and tried to come up with a solution.
I wanted to control 4 color spots that i have. Meaning, turning them on and off but also changing the color. And i found a solution
This is what i came up with.
[{"id":"9a46ebd1.1b884","type":"debug","z":"6c14bc3e8b976abe","name":"abracadabra","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":950,"y":740,"wires":[]},{"id":"3905076c1d531c67","type":"ui_colour_picker","z":"6c14bc3e8b976abe","name":"Eetkamer","label":"","group":"2b0d2624.525502","format":"hsv","outformat":"string","showSwatch":true,"showPicker":true,"showValue":true,"showHue":true,"showAlpha":true,"showLightness":true,"square":"false","dynOutput":"false","order":3,"width":"2","height":"1","passthru":true,"topic":"homie/homey/hue-color-spot-7/color/hsv/set","topicType":"msg","className":"","x":760,"y":820,"wires":[["2b9c8a67b0edc6c4","9a46ebd1.1b884"]]},{"id":"8c7e874185b78b0b","type":"mqtt in","z":"6c14bc3e8b976abe","name":"mqtt spot 7","topic":"homie/homey/hue-color-spot-7/color","qos":"2","datatype":"auto-detect","broker":"3327dd14625028dc","nl":false,"rap":false,"inputs":0,"x":440,"y":820,"wires":[["0615e923196c70f7"]]},{"id":"1d187528.c409e3","type":"ui_switch","z":"6c14bc3e8b976abe","name":"Light Switch","label":"Eetkamer","tooltip":"","group":"2b0d2624.525502","order":9,"width":"2","height":"1","passthru":false,"decouple":"true","topic":"homie/homey/hue-color-spot-7/onoff/set","topicType":"str","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","animate":true,"className":"","x":970,"y":500,"wires":[["0212fea4c7f5e76c","8a53cae18582f582","22522521974dc5b5","f0575ce5.e23a58"]]},{"id":"de41fdc2.8f4218","type":"mqtt in","z":"6c14bc3e8b976abe","name":"MQTT receiver light","topic":"homie/homey/hue-color-spot-7/onoff","qos":"2","datatype":"auto","broker":"3327dd14625028dc","nl":false,"rap":false,"inputs":0,"x":490,"y":500,"wires":[["80c8f8f1.e28b9"]]},{"id":"80c8f8f1.e28b9","type":"function","z":"6c14bc3e8b976abe","name":"Convert String to Boolean","func":"if(msg.payload === \"true\"){\n msg.payload = true; \n}else{\n msg.payload = false;\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":745.1667022705078,"y":500.60003662109375,"wires":[["1d187528.c409e3"]]},{"id":"2b9c8a67b0edc6c4","type":"function","z":"6c14bc3e8b976abe","name":"function 1","func":"// Get the input text\nvar inputText = msg.payload;\n\n// Remove \"hsv(\" and \")\" from the input text\nvar cleanedText = inputText.replace(\"hsv(\", \"\").replace(\")\", \"\");\n\n// Split the cleaned text into an array of values\nvar values = cleanedText.split(\", \");\n\n// Get the hue value (first value in the array) and convert it to a number\nvar hue = Number(values[0]);\n\n// Get the saturation value (second value in the array) and remove \"%\" character, then convert it to a number\nvar saturation = Number(values[1].replace(\"%\", \"\"));\n\n// Get the value (third value in the array) and remove \"%\" character, then convert it to a number\nvar value = Number(values[2].replace(\"%\", \"\"));\n\n// Create a new string in the format \"hue,saturation,value\"\nvar outputText = hue + \",\" + saturation + \",\" + value;\n\n// Set the modified text as the output of the function node\nmsg.payload = outputText;\n\n// Return the modified message object\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":940,"y":820,"wires":[["10c4df957690bb4b","6b3223c4638ec862","452983a8919ce860","1148472cb9e0f7c8"]]},{"id":"10c4df957690bb4b","type":"mqtt out","z":"6c14bc3e8b976abe","name":"MQTT transmit","topic":"homie/homey/hue-color-spot-7/color/set","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"3327dd14625028dc","x":1180,"y":740,"wires":[]},{"id":"6b3223c4638ec862","type":"mqtt out","z":"6c14bc3e8b976abe","name":"MQTT transmit","topic":"homie/homey/hue-color-spot-6/color/set","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"3327dd14625028dc","x":1180,"y":780,"wires":[]},{"id":"452983a8919ce860","type":"mqtt out","z":"6c14bc3e8b976abe","name":"MQTT transmit","topic":"homie/homey/hue-color-spot-4/color/set","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"3327dd14625028dc","x":1180,"y":820,"wires":[]},{"id":"1148472cb9e0f7c8","type":"mqtt out","z":"6c14bc3e8b976abe","name":"MQTT transmit","topic":"homie/homey/hue-color-spot-5/color/set","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"3327dd14625028dc","x":1180,"y":860,"wires":[]},{"id":"0615e923196c70f7","type":"function","z":"6c14bc3e8b976abe","name":"function 2","func":"// Get the input text\nvar inputText = msg.payload;\n\n// Split the input text into an array of values\nvar values = inputText.split(\",\");\n\n// Get the hue value (first value in the array) and convert it to a number\nvar hue = Number(values[0]);\n\n// Get the saturation value (second value in the array) and convert it to a number\nvar saturation = Number(values[1]);\n\n// Get the value (third value in the array) and convert it to a number\nvar value = Number(values[2]);\n\n// Create a new string in the format \"hsv(hue,saturation%,value%)\"\nvar outputText = \"hsv(\" + hue + \", \" + saturation + \"%, \" + value + \"%)\";\n\n// Set the modified text as the output of the function node\nmsg.payload = outputText;\n\n// Return the modified message object\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":600,"y":820,"wires":[["3905076c1d531c67","9a46ebd1.1b884"]]},{"id":"0212fea4c7f5e76c","type":"mqtt out","z":"6c14bc3e8b976abe","name":"MQTT Transmitter","topic":"homie/homey/hue-color-spot-4/onoff/set","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"3327dd14625028dc","x":1190,"y":540,"wires":[]},{"id":"8a53cae18582f582","type":"mqtt out","z":"6c14bc3e8b976abe","name":"MQTT Transmitter","topic":"homie/homey/hue-color-spot-5/onoff/set","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"3327dd14625028dc","x":1190,"y":580,"wires":[]},{"id":"22522521974dc5b5","type":"mqtt out","z":"6c14bc3e8b976abe","name":"MQTT Transmitter","topic":"homie/homey/hue-color-spot-6/onoff/set","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"3327dd14625028dc","x":1190,"y":620,"wires":[]},{"id":"9b5d7e1c6f7b4d1e","type":"mqtt in","z":"6c14bc3e8b976abe","name":"MQTT receiver light","topic":"homie/homey/hue-color-spot-4/onoff","qos":"2","datatype":"auto","broker":"3327dd14625028dc","nl":false,"rap":false,"inputs":0,"x":490,"y":540,"wires":[["80c8f8f1.e28b9"]]},{"id":"e7213c978459e7de","type":"mqtt in","z":"6c14bc3e8b976abe","name":"MQTT receiver light","topic":"homie/homey/hue-color-spot-5/onoff","qos":"2","datatype":"auto","broker":"3327dd14625028dc","nl":false,"rap":false,"inputs":0,"x":490,"y":580,"wires":[["80c8f8f1.e28b9"]]},{"id":"40d35767cf21b43a","type":"mqtt in","z":"6c14bc3e8b976abe","name":"MQTT receiver light","topic":"homie/homey/hue-color-spot-6/onoff","qos":"2","datatype":"auto","broker":"3327dd14625028dc","nl":false,"rap":false,"inputs":0,"x":490,"y":620,"wires":[["80c8f8f1.e28b9"]]},{"id":"f0575ce5.e23a58","type":"mqtt out","z":"6c14bc3e8b976abe","name":"MQTT Transmitter","topic":"homie/homey/hue-color-spot-7/onoff/set","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"3327dd14625028dc","x":1190,"y":500,"wires":[]},{"id":"2b0d2624.525502","type":"ui_group","name":"Lampen","tab":"2f1cda12.393b96","order":1,"disp":true,"width":"6","collapse":false},{"id":"3327dd14625028dc","type":"mqtt-broker","name":"","broker":"192.168.1.1","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""},{"id":"2f1cda12.393b96","type":"ui_tab","name":"Homey Dashboard","icon":"dashboard","order":1,"disabled":false,"hidden":false}]