Control Hue Devices with Shelly Plus I4

This small flow illustrates how to turn on and off hue devices using the Shelly Plus I4.

The flow makes use of node-red-contrib-shelly and node-red-contrib-huemagic

[{"id":"d7a6e7e5fd23b5a4","type":"shelly-gen2","z":"f45ce90b3151803b","hostname":"192.168.178.232","description":"LoungeSwitch","mode":"callback","server":"04263f2d054cc2a1","outputmode":"event","uploadretryinterval":"5000","pollinginterval":"2000","pollstatus":true,"getstatusoncommand":true,"devicetype":"Button","outputs":1,"x":180,"y":180,"wires":[["92c494175c3f9b3a","8bc95373ac8cac64","3043ef15e0c3d0ec","9ec331d570185b83"]]},{"id":"92c494175c3f9b3a","type":"function","z":"f45ce90b3151803b","name":"Input 0","func":"let singlePush = null;\nlet doublePush = null;\nlet longePush = null;\n\nif(msg.payload.component === \"input:0\"){\n    event = msg.payload.info.event;\n    switch(event){\n        case \"single_push\":\n            singlePush = msg;\n            break;\n        case \"double_push\":\n            doublePush = msg;\n            break;\n        case \"long_push\":\n            longePush = msg;\n            break;\n    }\n}\n\nnode.send([singlePush, doublePush, longePush]);","outputs":3,"noerr":0,"initialize":"","finalize":"","libs":[],"x":370,"y":180,"wires":[["fd96bfd7cbc645cb"],["fd477204e6e70222"],["456ea9dbc6760c19"]]},{"id":"64c96c8e2b50b74a","type":"hue-group","z":"f45ce90b3151803b","name":"Lounge","bridge":"e93dfe3994ce6fcf","groupid":"1129fbe2-d924-4676-8828-df695449f832","skipevents":false,"initevents":false,"x":780,"y":180,"wires":[["66f44a275df63013"]]},{"id":"fd96bfd7cbc645cb","type":"function","z":"f45ce90b3151803b","name":"on 100%","func":"msg.payload = {};\nmsg.payload.on = true;\nmsg.payload.brightness = 100;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":140,"wires":[["64c96c8e2b50b74a"]]},{"id":"456ea9dbc6760c19","type":"function","z":"f45ce90b3151803b","name":"off","func":"msg.payload = {};\nmsg.payload.on = false;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":550,"y":220,"wires":[["64c96c8e2b50b74a"]]},{"id":"66f44a275df63013","type":"debug","z":"f45ce90b3151803b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":950,"y":180,"wires":[]},{"id":"f771d03c7f9df154","type":"comment","z":"f45ce90b3151803b","name":"Outputs","info":"output 1 = single push\noutput 2 = double push\noutput 3 = triple push\noutput 4 = long push","x":370,"y":120,"wires":[]},{"id":"0fa8cf3551a1f192","type":"comment","z":"f45ce90b3151803b","name":"","info":"see also \nhttps://flows.nodered.org/node/node-red-contrib-huemagic#hue-group","x":560,"y":100,"wires":[]},{"id":"fd477204e6e70222","type":"function","z":"f45ce90b3151803b","name":"on 50%","func":"msg.payload = {};\nmsg.payload.on = true;\nmsg.payload.brightness = 50;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":180,"wires":[["64c96c8e2b50b74a"]]},{"id":"8bc95373ac8cac64","type":"function","z":"f45ce90b3151803b","name":"Input 1","func":"let singlePush = null;\nlet doublePush = null;\nlet longePush = null;\n\nif(msg.payload.component === \"input:1\"){\n    event = msg.payload.info.event;\n    switch(event){\n        case \"single_push\":\n            singlePush = msg;\n            break;\n        case \"double_push\":\n            doublePush = msg;\n            break;\n        case \"long_push\":\n            longePush = msg;\n            break;\n    }\n}\n\nnode.send([singlePush, doublePush, longePush]);","outputs":3,"noerr":0,"initialize":"","finalize":"","libs":[],"x":370,"y":260,"wires":[[],[],[]]},{"id":"3043ef15e0c3d0ec","type":"function","z":"f45ce90b3151803b","name":"Input 2","func":"let singlePush = null;\nlet doublePush = null;\nlet longePush = null;\n\nif(msg.payload.component === \"input:2\"){\n    event = msg.payload.info.event;\n    switch(event){\n        case \"single_push\":\n            singlePush = msg;\n            break;\n        case \"double_push\":\n            doublePush = msg;\n            break;\n        case \"long_push\":\n            longePush = msg;\n            break;\n    }\n}\n\nnode.send([singlePush, doublePush, longePush]);","outputs":3,"noerr":0,"initialize":"","finalize":"","libs":[],"x":370,"y":340,"wires":[[],[],[]]},{"id":"9ec331d570185b83","type":"function","z":"f45ce90b3151803b","name":"Input 3","func":"let singlePush = null;\nlet doublePush = null;\nlet longePush = null;\n\nif(msg.payload.component === \"input:3\"){\n    event = msg.payload.info.event;\n    switch(event){\n        case \"single_push\":\n            singlePush = msg;\n            break;\n        case \"double_push\":\n            doublePush = msg;\n            break;\n        case \"long_push\":\n            longePush = msg;\n            break;\n    }\n}\n\nnode.send([singlePush, doublePush, longePush]);","outputs":3,"noerr":0,"initialize":"","finalize":"","libs":[],"x":370,"y":420,"wires":[[],[],[]]},{"id":"04263f2d054cc2a1","type":"shelly-gen2-server","port":"10001"},{"id":"e93dfe3994ce6fcf","type":"hue-bridge","name":"Philips hue","bridge":"192.168.178.40","key":"pifSymjPe7yCnlH7eZXbFFSuoxGFn0zdChOraR6c","worker":"10","autoupdates":true,"disableupdates":false}]

Flow Info

Created 3 years, 2 months ago
Rating: 5 1

Owner

Actions

Rate:

Node Types

Core
  • comment (x2)
  • debug (x1)
  • function (x7)
Other

Tags

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