Philips Hue Visual Contoller

A simple UI component to be integrated with node-red-dashboard allowing to control Philips Hue visually:

  • Switch On/OFF
  • Brightness
  • Color
[{"id":"9e1b68b0.b33b28","type":"function","z":"f3511cfe.0b268","name":"Philips_hue_controller","func":"var brightness = 2;\nvar state = false;\nvar r = 75;\nvar g = 15;\nvar b = 245;\nvar color = [r,g,b] ;\n\nif(msg.topic==\"lumonisity\")\n{\n    brightness = msg.payload;\n}\n\nelse if(msg.topic==\"state\")\n{\n    state = msg.payload;\n}\n\nelse if(msg.topic==\"color\")\n{\n    color = msg.payload;\n}\n\nmsg.payload={\n\t\t\t\"on\":[state],\n\t\t\t\"transitiontime\":[0],\n\t\t\t\"bri\":[brightness],\n\t\t\t\"rgb\":color\n\t\t}\nreturn msg;","outputs":1,"noerr":0,"x":478.99998474121094,"y":205.77777099609375,"wires":[["a44ac24e.1acf","39dfb382.6d422c","c50d0322.ec8de"]]},{"id":"a44ac24e.1acf","type":"Hue Set","z":"f3511cfe.0b268","deviceid":"1","serverid":"001788fffe0a2ace","name":"Light","x":716.9999847412109,"y":201.44451904296875,"wires":[[],[]]},{"id":"ca6d0ecb.0b0bf","type":"range","z":"f3511cfe.0b268","minin":"0","maxin":"100","minout":"0","maxout":"255","action":"scale","round":false,"name":"","x":270.5,"y":207,"wires":[["9e1b68b0.b33b28"]]},{"id":"467187b3.158e38","type":"ui_switch","z":"f3511cfe.0b268","group":"fe793323.34a48","order":0,"width":0,"height":0,"name":"","label":"hue_switch","topic":"state","style":"","onvalue":"true","onvalueType":"str","onicon":"","oncolor":"","offvalue":"false","offvalueType":"str","officon":"","offcolor":"","x":124.5,"y":111,"wires":[["9e1b68b0.b33b28"]]},{"id":"39dfb382.6d422c","type":"ui_toast","z":"f3511cfe.0b268","position":"top right","displayTime":"3","name":"","x":723.5,"y":106,"wires":[]},{"id":"197d4d84.09eab2","type":"ui_slider","z":"f3511cfe.0b268","group":"fe793323.34a48","order":0,"width":0,"height":0,"name":"","label":"Brightness","topic":"lumonisity","min":0,"max":"100","x":108.5,"y":203,"wires":[["ca6d0ecb.0b0bf"]]},{"id":"8fc119f5.f97ec8","type":"ui_text_input","z":"f3511cfe.0b268","group":"fe793323.34a48","order":0,"width":0,"height":0,"name":"color","mode":"color","delay":"500","label":"Light Color","topic":"color","x":83.5,"y":285,"wires":[["ec05931b.ca6d5"]]},{"id":"ec05931b.ca6d5","type":"function","z":"f3511cfe.0b268","name":"testing_new_color","func":"var r;\nvar g;\nvar b;\nvar hex;\nhex = msg.payload;\nvar cooler;\n\nfunction convertHex(hex){\n    hex = hex.replace('#','');\n    r = parseInt(hex.substring(0,2), 16);\n    g = parseInt(hex.substring(2,4), 16);\n    b = parseInt(hex.substring(4,6), 16);\n\n    result = [r,g,b];\n    return result;\n}\n\ncooler = convertHex(hex);\nmsg.payload = cooler;\n\nreturn msg;","outputs":1,"noerr":0,"x":270.5,"y":285,"wires":[["9e1b68b0.b33b28"]]},{"id":"c50d0322.ec8de","type":"debug","z":"f3511cfe.0b268","name":"","active":true,"console":"false","complete":"false","x":739.5,"y":279,"wires":[]},{"id":"87b310f.5d585f","type":"comment","z":"f3511cfe.0b268","name":"philips_hue_controller","info":"Control_philips_hue_with_ui","x":183.5,"y":37,"wires":[]},{"id":"fe793323.34a48","type":"ui_group","z":"f3511cfe.0b268","name":"Living_Room_lights","tab":"68fb0651.1f9cc8","order":"1","disp":true,"width":"5"},{"id":"68fb0651.1f9cc8","type":"ui_tab","z":"","name":"Dashboard","icon":"dashboard","order":1}]

Flow Info

Created 5 years, 1 month ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • comment (x1)
  • debug (x1)
  • function (x2)
  • range (x1)
Other
  • Hue Set (x1)
  • ui_group (x1)
  • ui_slider (x1)
  • ui_switch (x1)
  • ui_tab (x1)
  • ui_text_input (x1)
  • ui_toast (x1)

Tags

  • PhilipsHue
  • UI
  • Controller
  • Dashboard
  • Philips
  • Hue
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option