-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
HUE-CLIP-API_Node-Red-Flows.json
1 lines (1 loc) · 74.8 KB
/
HUE-CLIP-API_Node-Red-Flows.json
1
[{"id":"7a14643a.75260c","type":"subflow","name":"Splitter","info":"","category":"","in":[{"x":540,"y":300,"wires":[{"id":"273108cc.4b9928"}]}],"out":[{"x":960,"y":300,"wires":[{"id":"a7524f72.576f3","port":0},{"id":"f3125664899350c0","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"273108cc.4b9928","type":"switch","z":"7a14643a.75260c","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"split","vt":"str"},{"t":"eq","v":"array","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":630,"y":300,"wires":[["fb18185d.5df9e8"],["f3125664899350c0"]]},{"id":"a7524f72.576f3","type":"split","z":"7a14643a.75260c","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":810,"y":240,"wires":[[]]},{"id":"fb18185d.5df9e8","type":"change","z":"7a14643a.75260c","name":"del topic","rules":[{"t":"delete","p":"topic","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":800,"y":280,"wires":[["a7524f72.576f3"]]},{"id":"f3125664899350c0","type":"change","z":"7a14643a.75260c","name":"del topic","rules":[{"t":"delete","p":"topic","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":800,"y":320,"wires":[[]]},{"id":"d1abcd4.10bc03","type":"subflow","name":"Request Timer","info":"","category":"","in":[{"x":320,"y":180,"wires":[{"id":"ae3b4275178b1b9a"}]}],"out":[{"x":860,"y":300,"wires":[{"id":"244e6655.741d9a","port":0},{"id":"6bd8af1f.89fdd","port":0},{"id":"2a5d491d.97c806","port":0},{"id":"9e7f2747.5c4628","port":0},{"id":"c2dcb099.f3e78","port":0},{"id":"9fd56572.0c0b38","port":0},{"id":"f15b3597.8713b8","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"f0a2d4f4.19a288","type":"delay","z":"d1abcd4.10bc03","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":480,"y":220,"wires":[["6bd8af1f.89fdd","a0bdc284.5e792"]]},{"id":"a0bdc284.5e792","type":"delay","z":"d1abcd4.10bc03","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":480,"y":260,"wires":[["2a5d491d.97c806","ffdeebc6.4d7b88"]]},{"id":"244e6655.741d9a","type":"change","z":"d1abcd4.10bc03","name":"room","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"topic","pt":"msg"},{"t":"set","p":"endpoint","pt":"msg","to":"room","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":180,"wires":[[]]},{"id":"6bd8af1f.89fdd","type":"change","z":"d1abcd4.10bc03","name":"zone","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"topic","pt":"msg"},{"t":"set","p":"endpoint","pt":"msg","to":"zone","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":220,"wires":[[]]},{"id":"2a5d491d.97c806","type":"change","z":"d1abcd4.10bc03","name":"scene","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"topic","pt":"msg"},{"t":"set","p":"endpoint","pt":"msg","to":"scene","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":260,"wires":[[]]},{"id":"ffdeebc6.4d7b88","type":"delay","z":"d1abcd4.10bc03","name":"","pauseType":"delay","timeout":"4","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":480,"y":300,"wires":[["c2dcb099.f3e78","b2ade02a.ff9c1"]]},{"id":"c2dcb099.f3e78","type":"change","z":"d1abcd4.10bc03","name":"device","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"topic","pt":"msg"},{"t":"set","p":"endpoint","pt":"msg","to":"device","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":300,"wires":[[]]},{"id":"9e7f2747.5c4628","type":"change","z":"d1abcd4.10bc03","name":"motion","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"topic","pt":"msg"},{"t":"set","p":"endpoint","pt":"msg","to":"motion","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":340,"wires":[[]]},{"id":"b2ade02a.ff9c1","type":"delay","z":"d1abcd4.10bc03","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":480,"y":340,"wires":[["9e7f2747.5c4628","db7b216c.0f12c"]]},{"id":"9fd56572.0c0b38","type":"change","z":"d1abcd4.10bc03","name":"button","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"topic","pt":"msg"},{"t":"set","p":"endpoint","pt":"msg","to":"button","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":380,"wires":[[]]},{"id":"f15b3597.8713b8","type":"change","z":"d1abcd4.10bc03","name":"light","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"topic","pt":"msg"},{"t":"set","p":"endpoint","pt":"msg","to":"light","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":420,"wires":[[]]},{"id":"db7b216c.0f12c","type":"delay","z":"d1abcd4.10bc03","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":480,"y":380,"wires":[["9fd56572.0c0b38","5ff7e2ec.4fce7c"]]},{"id":"5ff7e2ec.4fce7c","type":"delay","z":"d1abcd4.10bc03","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":480,"y":420,"wires":[["f15b3597.8713b8"]]},{"id":"ae3b4275178b1b9a","type":"delay","z":"d1abcd4.10bc03","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":480,"y":180,"wires":[["f0a2d4f4.19a288","244e6655.741d9a"]]},{"id":"aff9cdb5.1ba04","type":"subflow","name":"Scenes Room / Zones","info":"","category":"","in":[{"x":660,"y":340,"wires":[{"id":"d783c4a0.a134f8"},{"id":"b2fff99f.0b7af8"}]}],"out":[{"x":1260,"y":300,"wires":[{"id":"fb43fcd6.f6b8c","port":0}]},{"x":1260,"y":380,"wires":[{"id":"c17682ee.48568","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"b2fff99f.0b7af8","type":"split","z":"aff9cdb5.1ba04","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":840,"y":380,"wires":[["48dc6c9.51e3694"]]},{"id":"48dc6c9.51e3694","type":"switch","z":"aff9cdb5.1ba04","name":"","property":"payload.zone-name","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":990,"y":380,"wires":[["c17682ee.48568"]]},{"id":"c17682ee.48568","type":"join","z":"aff9cdb5.1ba04","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"5","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1130,"y":380,"wires":[[]]},{"id":"a1aefb6a.38dee8","type":"switch","z":"aff9cdb5.1ba04","name":"","property":"payload.room-name","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":990,"y":300,"wires":[["fb43fcd6.f6b8c"]]},{"id":"fb43fcd6.f6b8c","type":"join","z":"aff9cdb5.1ba04","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"3","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1130,"y":300,"wires":[[]]},{"id":"d783c4a0.a134f8","type":"split","z":"aff9cdb5.1ba04","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":840,"y":300,"wires":[["a1aefb6a.38dee8"]]},{"id":"f2b9624783dc3e90","type":"subflow","name":"HUE Motion Receiver","info":"","category":"HUE v2","in":[{"x":40,"y":440,"wires":[{"id":"60a83618012eb9c9"}]}],"out":[{"x":870,"y":360,"wires":[{"id":"341dec26f895500c","port":0}]},{"x":890,"y":440,"wires":[{"id":"341dec26f895500c","port":0},{"id":"7c509fd93507f730","port":0}]},{"x":870,"y":520,"wires":[{"id":"7c509fd93507f730","port":0}]}],"env":[{"name":"motion_ID","type":"str","value":"replace with discovered Motion Sensor ID"}],"meta":{},"color":"#9876D3","outputLabels":["motion true","motion true / false","motion false"],"icon":"node-red/bridge-dash.svg"},{"id":"acaa8ed3a1a9fc07","type":"switch","z":"f2b9624783dc3e90","name":"payload.data.0.motion.motion","property":"payload.data.0.motion.motion","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":450,"y":440,"wires":[["341dec26f895500c"],["7c509fd93507f730"]]},{"id":"341dec26f895500c","type":"change","z":"f2b9624783dc3e90","name":"true","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":400,"wires":[[]]},{"id":"7c509fd93507f730","type":"change","z":"f2b9624783dc3e90","name":"false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":480,"wires":[[]]},{"id":"60a83618012eb9c9","type":"switch","z":"f2b9624783dc3e90","name":"Motion Sensor ID","property":"payload.data.0.id","propertyType":"msg","rules":[{"t":"cont","v":"motion_ID","vt":"env"}],"checkall":"true","repair":false,"outputs":1,"x":190,"y":440,"wires":[["acaa8ed3a1a9fc07"]]},{"id":"ec665fa1fdcedbac","type":"comment","z":"f2b9624783dc3e90","name":"HUE - Motion Sensor Event Filter \\n \\n Output 1: Will send just an **true** when Motion is detected \\n \\n Output 2: Will send an **true** when Motion is detected and a **false** if no motion is detected any longer. \\n \\n Output 3: Will send just an **false** when no Motion is detected any longer. \\n \\n ----------------------- \\n All outputs are boolean \\n ----------------------- \\n \\n Most easy Subflow, but convinient when lots of sensors need to be set up.","info":"Output 1:\nWill send just an **true** when Motion is detected\n\nOutput 2:\nWill send an **true** when Motion is detected and a **false** if no motion is detected any longer.\n\nOutput 3:\nWill send just an **false** when no Motion is detected any longer.\n\n-----------------------\nAll outputs are boolean\n-----------------------\n\nMost easy Subflow, but convinient when lots of sensors need to be set up.","x":380,"y":180,"wires":[]},{"id":"06d15551bcfcd5b5","type":"subflow","name":"HUE Light Receiver","info":"","category":"HUE v2","in":[{"x":40,"y":580,"wires":[{"id":"2e987bc45c0292d9"}]}],"out":[{"x":1020,"y":500,"wires":[{"id":"8a31e5a84336cd35","port":0}]},{"x":1040,"y":580,"wires":[{"id":"8a31e5a84336cd35","port":0},{"id":"b3628c4839c46f6f","port":0}]},{"x":1020,"y":660,"wires":[{"id":"b3628c4839c46f6f","port":0}]}],"env":[{"name":"light_ID","type":"str","value":"replace with discovered Lamp / Group ID"}],"meta":{},"color":"#86E3FF","outputLabels":["On","On / Off","Off"],"icon":"node-red/light.svg"},{"id":"e3cee5b6a050c2a2","type":"rbe","z":"06d15551bcfcd5b5","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":730,"y":500,"wires":[["8a31e5a84336cd35"]]},{"id":"8a31e5a84336cd35","type":"switch","z":"06d15551bcfcd5b5","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":850,"y":500,"wires":[[]]},{"id":"081d6ed872820712","type":"change","z":"06d15551bcfcd5b5","name":"false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":460,"wires":[["33073fdb56049c7b"]]},{"id":"33073fdb56049c7b","type":"delay","z":"06d15551bcfcd5b5","name":"2s","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":850,"y":460,"wires":[["e3cee5b6a050c2a2"]]},{"id":"3217a6fbc9bdc0e0","type":"change","z":"06d15551bcfcd5b5","name":"True","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":540,"wires":[["e3cee5b6a050c2a2"]]},{"id":"980510f1c771a4a5","type":"delay","z":"06d15551bcfcd5b5","name":"2s","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":850,"y":700,"wires":[["67c2e061e7aff1be"]]},{"id":"67c2e061e7aff1be","type":"rbe","z":"06d15551bcfcd5b5","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","x":730,"y":660,"wires":[["b3628c4839c46f6f"]]},{"id":"1d41a53aa14399c7","type":"change","z":"06d15551bcfcd5b5","name":"false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":620,"wires":[["67c2e061e7aff1be"]]},{"id":"7daef9e2afc3c77a","type":"change","z":"06d15551bcfcd5b5","name":"true","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":700,"wires":[["980510f1c771a4a5"]]},{"id":"b3628c4839c46f6f","type":"switch","z":"06d15551bcfcd5b5","name":"","property":"payload","propertyType":"msg","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":850,"y":660,"wires":[[]]},{"id":"c5515472208800e5","type":"switch","z":"06d15551bcfcd5b5","name":"payload.data.0.on.on","property":"payload.data.0.on.on","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":480,"y":580,"wires":[["3217a6fbc9bdc0e0","081d6ed872820712"],["1d41a53aa14399c7","7daef9e2afc3c77a"]]},{"id":"ea87f9721cfde4c1","type":"comment","z":"06d15551bcfcd5b5","name":"HUE light / grouped_light Event Filter \\n \\n Output 1: This output will send a **true** when Lights or Groups are turned on. \\n \\n Output 2: This output will send a **true** when Lights or Groups are turned on AND a **false** when Lights or Groups are turned off. \\n \\n Output 3: This output will send a **false** when Lights or Groups are turned off \\n \\n Depending on your Situation it can be useful just to have a **true** OR **false** OR **both** states in your Flow. Thats the reason i built this Subflow. \\n Just use the Output that makes you happy :) \\n \\n ----------------------- \\n All outputs are boolean \\n ----------------------- \\n \\n The delays will reset the RBE nodes. \\n You can adjust the times for your needs, but this worked for me prefectly.","info":"Output 1:\nThis output will send a **true** when Lights or Groups are turned on.\n\nOutput 2:\nThis output will send a **true** when Lights or Groups are turned on AND a **false** when Lights or Groups are turned off.\n\nOutput 3:\nThis output will send a **false** when Lights or Groups are turned off\n\nDepending on your Situation it can be useful just to have a **true** OR **false** OR **both** states in your Flow. Thats the reason i built this Subflow.\nJust use the Output that makes you happy :)\n\n-----------------------\nAll outputs are boolean \n-----------------------\n\nThe delays will reset the RBE nodes.\nYou can adjust the times for your needs, but this worked for me prefectly.","x":510,"y":220,"wires":[]},{"id":"2e987bc45c0292d9","type":"switch","z":"06d15551bcfcd5b5","name":"light / grouped_light ID","property":"payload.data.0.id","propertyType":"msg","rules":[{"t":"cont","v":"light_ID","vt":"env"}],"checkall":"true","repair":false,"outputs":1,"x":200,"y":580,"wires":[["c5515472208800e5"]]},{"id":"1b9462200f30effc","type":"subflow","name":"HUE Button Receiver","info":"","category":"HUE v2","in":[{"x":40,"y":500,"wires":[{"id":"95ddb4cb6d33ef4b"}]}],"out":[{"x":1230,"y":240,"wires":[{"id":"f9110fa213c2ab10","port":0}]},{"x":1240,"y":440,"wires":[{"id":"07fc32fc6b1b6dc3","port":0}]},{"x":1210,"y":600,"wires":[{"id":"6c27f1a1e501b9e0","port":0}]},{"x":1230,"y":760,"wires":[{"id":"7d7e9fd254989b3e","port":0}]}],"env":[{"name":"button_ID","type":"str","value":"replace with discovered button ID","ui":{"type":"input","opts":{"types":["str"]}}}],"meta":{},"color":"#E6E0F8","outputLabels":["initial_press","short_release","repeat","long_release"],"icon":"font-awesome/fa-toggle-on"},{"id":"03dfed0e2424b710","type":"rbe","z":"1b9462200f30effc","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":950,"y":240,"wires":[["f9110fa213c2ab10"]]},{"id":"f9110fa213c2ab10","type":"switch","z":"1b9462200f30effc","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":1070,"y":240,"wires":[[]]},{"id":"dd22e26c14e343c6","type":"change","z":"1b9462200f30effc","name":"false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":200,"wires":[["271860dec4c0f9d0"]]},{"id":"271860dec4c0f9d0","type":"delay","z":"1b9462200f30effc","name":"2s","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":1070,"y":200,"wires":[["03dfed0e2424b710"]]},{"id":"59a612a2e090cf9e","type":"change","z":"1b9462200f30effc","name":"true","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":280,"wires":[["03dfed0e2424b710"]]},{"id":"eaa792ab298364e4","type":"delay","z":"1b9462200f30effc","name":"2s","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":1070,"y":720,"wires":[["369a46516051f95d"]]},{"id":"369a46516051f95d","type":"rbe","z":"1b9462200f30effc","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","x":950,"y":760,"wires":[["7d7e9fd254989b3e"]]},{"id":"676a2053d12be8b5","type":"change","z":"1b9462200f30effc","name":"false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":720,"wires":[["eaa792ab298364e4"]]},{"id":"f1c8a0f5e3028ae1","type":"change","z":"1b9462200f30effc","name":"true","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":800,"wires":[["369a46516051f95d"]]},{"id":"7d7e9fd254989b3e","type":"switch","z":"1b9462200f30effc","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":1070,"y":760,"wires":[[]]},{"id":"698fd0a7fe32b7dc","type":"switch","z":"1b9462200f30effc","name":"payload.data.0.button.last_event","property":"payload.data.0.button.last_event","propertyType":"msg","rules":[{"t":"cont","v":"initial_press","vt":"str"},{"t":"cont","v":"short_release","vt":"str"},{"t":"cont","v":"repeat","vt":"str"},{"t":"cont","v":"long_release","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":660,"y":500,"wires":[["dd22e26c14e343c6","59a612a2e090cf9e"],["4ec9d73d640eb554","47debee3db33fa19"],["6c27f1a1e501b9e0"],["f1c8a0f5e3028ae1","676a2053d12be8b5"]]},{"id":"caf938617a122c7b","type":"rbe","z":"1b9462200f30effc","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","x":950,"y":440,"wires":[["07fc32fc6b1b6dc3"]]},{"id":"07fc32fc6b1b6dc3","type":"switch","z":"1b9462200f30effc","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":1070,"y":440,"wires":[[]]},{"id":"47debee3db33fa19","type":"change","z":"1b9462200f30effc","name":"false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":400,"wires":[["4d3a9381622076b8"]]},{"id":"4d3a9381622076b8","type":"delay","z":"1b9462200f30effc","name":"2s","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":1070,"y":400,"wires":[["caf938617a122c7b"]]},{"id":"4ec9d73d640eb554","type":"change","z":"1b9462200f30effc","name":"true","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":480,"wires":[["caf938617a122c7b"]]},{"id":"6c27f1a1e501b9e0","type":"change","z":"1b9462200f30effc","name":"true","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":600,"wires":[[]]},{"id":"fc3ad5de03aa0dc6","type":"comment","z":"1b9462200f30effc","name":"HUE Button Event Filter \\n \\n Output 1: The **initial_press** comes ALWAYS directly after you push the Button. Quickest response possible! \\n \\n Output 2: The **short_release** will just appear after the **initial_press**, when you pushed the Button quick. \\n \\n Output 3: The **repeat** will appear if you hold the button, and will send a message every second until you release it. \\n \\n Output 4: The **long_release** will appear after the **repeat** ENDED! \\n \\n -------------------------------- \\n All outputs are boolean **true** \\n -------------------------------- \\n \\n The delays will reset the RBE node with a false. \\n You can adjust the times for your needs, but this worked for me prefectly.","info":"Output 1:\nThe **initial_press** comes ALWAYS directly after you push the Button. Quickest response possible!\n\nOutput 2:\nThe **short_release** will just appear after the **initial_press**, when you pushed the Button quick.\n\nOutput 3:\nThe **repeat** will appear if you hold the button, and will send a message every second until you release it.\n\nOutput 4:\nThe **long_release** will appear after the **repeat** ENDED!\n\n\n--------------------------------\nAll outputs are boolean **true**\n--------------------------------\n\n\nThe delays will reset the RBE node with a false.\nYou can adjust the times for your needs, but this worked for me prefectly.","x":420,"y":200,"wires":[]},{"id":"95ddb4cb6d33ef4b","type":"switch","z":"1b9462200f30effc","name":"Button ID","property":"payload.data.0.id","propertyType":"msg","rules":[{"t":"cont","v":"button_ID","vt":"env"}],"checkall":"true","repair":false,"outputs":1,"x":260,"y":500,"wires":[["698fd0a7fe32b7dc"]]},{"id":"0e0fd1a97350597a","type":"tab","label":"HUE API V2","disabled":false,"info":"","env":[]},{"id":"bc13569d4ade655e","type":"link out","z":"0e0fd1a97350597a","name":"EventStream","mode":"link","links":["502d2cc6c810a3a7","7d8478cbef873f0c","fa82325fe55e72bb"],"x":1050,"y":360,"wires":[],"l":true},{"id":"97253bedabd51221","type":"debug","z":"0e0fd1a97350597a","name":"HUE monitor","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":830,"y":360,"wires":[]},{"id":"71b4116aa31e8955","type":"link in","z":"0e0fd1a97350597a","d":true,"name":"HUE API INPUT","links":["cc265bc2392bbe4b","8d0b43fbf3fb1bb7"],"x":220,"y":780,"wires":[["ebd21ba0d066358b"]],"l":true},{"id":"016fe7b862b86be7","type":"http request","z":"0e0fd1a97350597a","name":"HUE API V2","method":"use","ret":"obj","paytoqs":"ignore","url":"","tls":"4bc31af9bd03bbdc","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":830,"y":780,"wires":[["00279367b1be3bb9"]]},{"id":"6633742b3d9ae451","type":"link out","z":"0e0fd1a97350597a","d":true,"name":"API Response OUT","mode":"link","links":["80202a0de7b91b2e"],"x":1290,"y":800,"wires":[],"l":true},{"id":"069a46c8d2f6a8b7","type":"function","z":"0e0fd1a97350597a","name":"Take snapshot \\n - or - \\n Restore snapshot \\n (retry processing) \\n +set rate max 1/250ms","func":"// Take a copy of payload & headers as they are now to be able to re-use it on retry\nif (msg.retryInfo === undefined) {\n // msg was never processed befor, take a copy (snapshot) of key values to be re-applied in case of retry\n msg.retryInfo = {}\n msg.retryInfo.payload = msg.payload;\n msg.retryInfo.headers = msg.headers;\n msg.retryInfo.retryCount = 0;\n} else {\n // msg was processed at least once before, apply snapshot'd values back\n msg.payload = msg.retryInfo.payload;\n msg.headers = msg.retryInfo.headers;\n msg.statusCode = undefined;\n msg.retryInfo.retryCount++\n}\n\n// Set maximum rate to 1/200ms\nmsg.rate = 200;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":800,"wires":[["47a3b797b89126ce"]],"outputLabels":["Blocked msg to send to repeater"],"icon":"font-awesome/fa-copy"},{"id":"ca28a7c4d1b42f5a","type":"delay","z":"0e0fd1a97350597a","name":"(0.25s - 0.5s)","pauseType":"random","timeout":"1100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"250","randomLast":"500","randomUnits":"milliseconds","drop":false,"allowrate":false,"outputs":1,"x":410,"y":820,"wires":[["069a46c8d2f6a8b7"]]},{"id":"86a19657b55dd68b","type":"debug","z":"0e0fd1a97350597a","name":"HUE API error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1300,"y":840,"wires":[]},{"id":"c415dfc7209ff6d0","type":"link in","z":"0e0fd1a97350597a","name":"Retry...","links":["0a33879b937b8da5"],"x":285,"y":820,"wires":[["ca28a7c4d1b42f5a"]]},{"id":"0a33879b937b8da5","type":"link out","z":"0e0fd1a97350597a","name":"Try to retry...","mode":"link","links":["c415dfc7209ff6d0"],"x":1195,"y":760,"wires":[]},{"id":"00279367b1be3bb9","type":"switch","z":"0e0fd1a97350597a","name":"Catch Error \\n 429+503","property":"statusCode","propertyType":"msg","rules":[{"t":"eq","v":"429","vt":"str"},{"t":"eq","v":"503","vt":"num"},{"t":"regex","v":"2\\d\\d","vt":"str","case":false},{"t":"else"}],"checkall":"true","repair":false,"outputs":4,"x":1030,"y":820,"wires":[["53182dc082f21dc6"],["53182dc082f21dc6"],["6633742b3d9ae451"],["6633742b3d9ae451","86a19657b55dd68b"]],"outputLabels":[null,"503 : too many calls sent","2xx : all OK","others (Error)"]},{"id":"47a3b797b89126ce","type":"delay","z":"0e0fd1a97350597a","name":"Limit 1msg/s","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":true,"outputs":1,"x":830,"y":820,"wires":[["016fe7b862b86be7"]]},{"id":"53182dc082f21dc6","type":"switch","z":"0e0fd1a97350597a","name":"Max 10 retries","property":"retryInfo.retryCount","propertyType":"msg","rules":[{"t":"lt","v":"10","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1040,"y":760,"wires":[["0a33879b937b8da5"],["6633742b3d9ae451","86a19657b55dd68b"]],"outputLabels":["Less than 10 errors, keep retrying...","More than 10 errors, abord retries"]},{"id":"294a1b6a1b06c985","type":"philipshue-events","z":"0e0fd1a97350597a","bridge":"","x":360,"y":360,"wires":[["c8d8fc683c679870"]]},{"id":"f763f3abcf18387a","type":"subflow:1b9462200f30effc","z":"0e0fd1a97350597a","name":"","env":[{"name":"button_ID","value":"replace with discovered button <<ID>>","type":"str"}],"x":320,"y":1920,"wires":[["49932ebf7074d6a6"],["e5f651f408c7c03c"],["e6acdb1053599fd0"],["df4650786822d29b"]]},{"id":"24ca190c09e4b20b","type":"subflow:06d15551bcfcd5b5","z":"0e0fd1a97350597a","name":"","env":[{"name":"light_ID","value":"replace with discovered Lamp ID / Group RID","type":"str"}],"x":330,"y":1440,"wires":[["15824fdb73d9464b"],["aa1ac1fa95a14093"],["3c75f26864ac7271"]]},{"id":"6bcea81ced18c213","type":"subflow:f2b9624783dc3e90","z":"0e0fd1a97350597a","name":"","env":[{"name":"motion_ID","value":"replace with discovered Motion Sensor <<ID>>","type":"str"}],"x":320,"y":1680,"wires":[["1f34356a85ca78e9"],["1bcdae3f2d1174fc"],["ae0cf3f1ef91363d"]]},{"id":"49932ebf7074d6a6","type":"debug","z":"0e0fd1a97350597a","name":"initial","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":550,"y":1860,"wires":[]},{"id":"e5f651f408c7c03c","type":"debug","z":"0e0fd1a97350597a","name":"short","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":550,"y":1900,"wires":[]},{"id":"e6acdb1053599fd0","type":"debug","z":"0e0fd1a97350597a","name":"holded","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":550,"y":1940,"wires":[]},{"id":"df4650786822d29b","type":"debug","z":"0e0fd1a97350597a","name":"long","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":550,"y":1980,"wires":[]},{"id":"1f34356a85ca78e9","type":"debug","z":"0e0fd1a97350597a","name":"motion true","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":570,"y":1640,"wires":[]},{"id":"1bcdae3f2d1174fc","type":"debug","z":"0e0fd1a97350597a","name":"motion true + false","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":590,"y":1680,"wires":[]},{"id":"ae0cf3f1ef91363d","type":"debug","z":"0e0fd1a97350597a","name":"motion false","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":570,"y":1720,"wires":[]},{"id":"15824fdb73d9464b","type":"debug","z":"0e0fd1a97350597a","name":"On (true)","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":560,"y":1400,"wires":[]},{"id":"aa1ac1fa95a14093","type":"debug","z":"0e0fd1a97350597a","name":"On / Off (true/false)","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":590,"y":1440,"wires":[]},{"id":"3c75f26864ac7271","type":"debug","z":"0e0fd1a97350597a","name":"Off (false)","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":560,"y":1480,"wires":[]},{"id":"fa82325fe55e72bb","type":"link in","z":"0e0fd1a97350597a","name":"HUE IN","links":["bc13569d4ade655e"],"x":150,"y":1680,"wires":[["6bcea81ced18c213"]],"l":true},{"id":"7d8478cbef873f0c","type":"link in","z":"0e0fd1a97350597a","name":"HUE IN","links":["bc13569d4ade655e"],"x":150,"y":1920,"wires":[["f763f3abcf18387a"]],"l":true},{"id":"502d2cc6c810a3a7","type":"link in","z":"0e0fd1a97350597a","name":"HUE IN","links":["bc13569d4ade655e"],"x":150,"y":1440,"wires":[["24ca190c09e4b20b"]],"l":true},{"id":"c8d8fc683c679870","type":"function","z":"0e0fd1a97350597a","name":"Array Splitter","func":"for (var i = 0; i < msg.payload.data.length; i++) {\n // Create a deep copy of msg object\n let splitmsg = JSON.parse(JSON.stringify(msg));\n\n // Reset data of new message to its single data part\n splitmsg.payload.data = [msg.payload.data[i]];\n \n // send using node\n node.send(splitmsg);\n}\n\nreturn;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":590,"y":360,"wires":[["bc13569d4ade655e","97253bedabd51221"]]},{"id":"d323c26e7e815be8","type":"link out","z":"0e0fd1a97350597a","name":"API Response OUT","mode":"link","links":["80202a0de7b91b2e"],"x":1070,"y":520,"wires":[],"l":true},{"id":"80202a0de7b91b2e","type":"link in","z":"0e0fd1a97350597a","name":"BRIDGE DATA RESPONSE IN","links":["d323c26e7e815be8","3f6d2329.8027ec","29cb5ec00b633749","6633742b3d9ae451"],"x":2245,"y":740,"wires":[["ccb5810d7d65d63d","87ee96e9cfc165df","c2f53355dd029549","3192fb3264e67710","ab838c6ea04cc73f","60e42d97ebbe9235","bb82ec1cca30b5ff"]]},{"id":"ccb5810d7d65d63d","type":"switch","z":"0e0fd1a97350597a","name":"Room","property":"endpoint","propertyType":"msg","rules":[{"t":"eq","v":"room","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":2550,"y":560,"wires":[["fc285a8bd6771d1b","7207a6e426862283"]]},{"id":"102315f9e7545dbf","type":"inject","z":"0e0fd1a97350597a","name":"Scenes Zone (seperately)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"split","payload":"zone_scenes","payloadType":"flow","x":1810,"y":900,"wires":[["42ca1a04ee56584e"]]},{"id":"a5b3b952ba888aba","type":"change","z":"0e0fd1a97350597a","name":"rooms","rules":[{"t":"set","p":"rooms","pt":"flow","to":"keys","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2890,"y":500,"wires":[[]]},{"id":"87ee96e9cfc165df","type":"switch","z":"0e0fd1a97350597a","name":"Scene","property":"endpoint","propertyType":"msg","rules":[{"t":"eq","v":"scene","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":2550,"y":740,"wires":[["ed07220d6193848e","4617516d6f9fd3a6"]]},{"id":"c2f53355dd029549","type":"switch","z":"0e0fd1a97350597a","name":"Light","property":"endpoint","propertyType":"msg","rules":[{"t":"eq","v":"light","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":2550,"y":1140,"wires":[["213626fb8ff1954e"]]},{"id":"3192fb3264e67710","type":"switch","z":"0e0fd1a97350597a","name":"Zone","property":"endpoint","propertyType":"msg","rules":[{"t":"eq","v":"zone","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":2550,"y":400,"wires":[["9d36d8a780c253a5","da76490a975ce4da"]]},{"id":"ed07220d6193848e","type":"function","z":"0e0fd1a97350597a","name":"Scene Name, ID, Zone Name","func":"var response = [];\nvar zones = flow.get(\"zones\") || {};\nvar size = Object.keys(zones).length;\nif(size <= 0) {\n node.error(\"Please Update Zones First\");\n}\nmsg.payload.data.forEach(function(item){\n var pair = {\n \"name\": item.metadata.name,\n \"id\": item.id,\n // \"rid\": item.group.rid,\n // \"rtype\": item.group.rtype,\n \"zone-name\": zones[item.group.rid]\n };\n response.push(pair);\n});\nreturn {\n \"payload\": response,\n \"topic\": \"Scene name/rids\"\n};","outputs":1,"noerr":0,"initialize":"","finalize":"","x":2810,"y":700,"wires":[["3788426cd354af17"]]},{"id":"37fbc6d748d64b59","type":"change","z":"0e0fd1a97350597a","name":"zones","rules":[{"t":"set","p":"zones","pt":"flow","to":"keys","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2890,"y":340,"wires":[[]]},{"id":"3788426cd354af17","type":"subflow:aff9cdb5.1ba04","z":"0e0fd1a97350597a","name":"","env":[],"x":2840,"y":740,"wires":[["5998a72d5e8edfd9","dfe2afedf6931e76"],["e357f0348ee8893b","4836fcee8db6f559"]]},{"id":"5998a72d5e8edfd9","type":"debug","z":"0e0fd1a97350597a","name":"Room Scenes","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":3120,"y":700,"wires":[]},{"id":"e357f0348ee8893b","type":"debug","z":"0e0fd1a97350597a","name":"Zone Scenes","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":3110,"y":780,"wires":[]},{"id":"b4058872d129361e","type":"debug","z":"0e0fd1a97350597a","name":"Rooms","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":3100,"y":540,"wires":[]},{"id":"82a59594306afa2b","type":"debug","z":"0e0fd1a97350597a","name":"Zones","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":3090,"y":380,"wires":[]},{"id":"579b668f9dcdd935","type":"inject","z":"0e0fd1a97350597a","name":"Request all Data","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":1840,"y":200,"wires":[["bb1f2705f8c82a60","083e5a046cd1aa80"]]},{"id":"dfe2afedf6931e76","type":"change","z":"0e0fd1a97350597a","name":"room_scenes","rules":[{"t":"set","p":"room_scenes","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2860,"y":660,"wires":[[]]},{"id":"083e5a046cd1aa80","type":"subflow:d1abcd4.10bc03","z":"0e0fd1a97350597a","name":"Request","env":[],"x":2040,"y":200,"wires":[["cc265bc2392bbe4b"]]},{"id":"4836fcee8db6f559","type":"change","z":"0e0fd1a97350597a","name":"zone scene","rules":[{"t":"set","p":"zone_scenes","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2870,"y":820,"wires":[[]]},{"id":"8425b08008fdf0ce","type":"inject","z":"0e0fd1a97350597a","name":"Scenes Zone (an array)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"array","payload":"zone_scenes","payloadType":"flow","x":1820,"y":860,"wires":[["42ca1a04ee56584e"]]},{"id":"c3b6f9f1240cc9f7","type":"inject","z":"0e0fd1a97350597a","name":"Scenes Room (an array)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"array","payload":"room_scenes","payloadType":"flow","x":1810,"y":620,"wires":[["42ca1a04ee56584e"]]},{"id":"d18ad3f3f2519a2b","type":"inject","z":"0e0fd1a97350597a","name":"Scenes Room (seperately)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"split","payload":"room_scenes","payloadType":"flow","x":1810,"y":660,"wires":[["42ca1a04ee56584e"]]},{"id":"42ca1a04ee56584e","type":"subflow:7a14643a.75260c","z":"0e0fd1a97350597a","name":"","env":[],"x":2220,"y":740,"wires":[["beafe38cb6162d26"]]},{"id":"bb1f2705f8c82a60","type":"change","z":"0e0fd1a97350597a","name":"DELETE","rules":[{"t":"delete","p":"zones","pt":"flow"},{"t":"delete","p":"rooms","pt":"flow"},{"t":"delete","p":"lights","pt":"flow"},{"t":"delete","p":"zone_scenes","pt":"flow"},{"t":"delete","p":"room_scenes","pt":"flow"},{"t":"delete","p":"rooms_array","pt":"flow"},{"t":"delete","p":"zones_array","pt":"flow"},{"t":"delete","p":"devices","pt":"flow"},{"t":"delete","p":"motion","pt":"flow"},{"t":"delete","p":"lights","pt":"flow"},{"t":"delete","p":"button","pt":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":2040,"y":240,"wires":[[]]},{"id":"173fb2fb6e56fa8f","type":"inject","z":"0e0fd1a97350597a","d":true,"name":"Delete Data","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":1850,"y":240,"wires":[["bb1f2705f8c82a60"]]},{"id":"6d47cca266294bea","type":"change","z":"0e0fd1a97350597a","name":"lights","rules":[{"t":"set","p":"lights","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2890,"y":1100,"wires":[[]]},{"id":"ca4faf603a563f85","type":"debug","z":"0e0fd1a97350597a","name":"Lights","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":3090,"y":1140,"wires":[]},{"id":"213626fb8ff1954e","type":"function","z":"0e0fd1a97350597a","name":"Light Name, ID, Abilities","func":"var response = [];\nvar rooms = flow.get(\"rooms\") || {};\nvar size = Object.keys(rooms).length;\nif(size <= 0) {\n node.error(\"Please Update Rooms First\");\n}\nmsg.payload.data.forEach(function(item){\n var pair = {\n \"name\": item.metadata.name,\n \"type\": item.metadata.archetype,\n \"id\": item.id,\n \"color\": item.hasOwnProperty(\"color\") ? true : false,\n \"temp\": item.hasOwnProperty(\"color_temperature\") ? true : false\n };\n response.push(pair);\n});\nreturn {\n \"payload\": response,\n \"topic\": \"Lights\"\n};","outputs":1,"noerr":0,"initialize":"","finalize":"","x":2830,"y":1140,"wires":[["6d47cca266294bea","ca4faf603a563f85"]]},{"id":"14927202c421162c","type":"inject","z":"0e0fd1a97350597a","name":"Buttons (an Array)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"array","payload":"button","payloadType":"flow","x":1830,"y":1100,"wires":[["42ca1a04ee56584e"]]},{"id":"388869b8eb4a99c2","type":"inject","z":"0e0fd1a97350597a","name":"Buttons (seperately)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"split","payload":"button","payloadType":"flow","x":1830,"y":1140,"wires":[["42ca1a04ee56584e"]]},{"id":"c3ba171edf7cda1e","type":"inject","z":"0e0fd1a97350597a","name":"Rooms (seperately)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"split","payload":"rooms_array","payloadType":"flow","x":1830,"y":540,"wires":[["42ca1a04ee56584e"]]},{"id":"fc285a8bd6771d1b","type":"function","z":"0e0fd1a97350597a","name":"Room Name and ID","func":"var response = [];\nvar roomkeys = {};\nmsg.payload.data.forEach(function(item){\n if(item.services.length > 0) {\n var pair = {\n \"name\": item.metadata.name,\n \"id\": item.id,\n \"rid\": item.services[0].rid,\n \"rtype\": item.services[0].rtype\n };\n roomkeys[item.id] = item.metadata.name;\n response.push(pair);\n }\n});\n\nreturn {\n \"payload\": response,\n \"topic\": \"rooms name/rid\",\n \"keys\": roomkeys\n};","outputs":1,"noerr":0,"initialize":"","finalize":"","x":2840,"y":540,"wires":[["a5b3b952ba888aba","b4058872d129361e"]]},{"id":"ab838c6ea04cc73f","type":"switch","z":"0e0fd1a97350597a","name":"Device","property":"endpoint","propertyType":"msg","rules":[{"t":"eq","v":"device","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":2550,"y":900,"wires":[["549717e38950938e"]]},{"id":"549717e38950938e","type":"function","z":"0e0fd1a97350597a","name":"Devices Button and Motion","func":"// NOTE: Devices have multipe rtypes in the services\n// This script grabs the first one, so a motion sensor may show\n// up as \"temperature\" as it also does temp. don't worry\n// this script is more to get the name of the devices to help\n// with the button/motion scripts.\nvar response = [];\nvar devices = {};\nmsg.payload.data.forEach(function(item){\n try {\n if(item.metadata.archetype == \"unknown_archetype\") {\n var pair = {\n \"name\": item.metadata.name,\n \"id\": item.id,\n \"rid\": item.services[0].rid,\n \"rtype\": item.services[0].rtype\n };\n devices[item.id] = item.metadata.name;\n response.push(pair);\n }\n } catch(err) {\n node.warn(err);\n }\n});\n\nreturn {\n \"payload\": response,\n \"topic\": \"devices name/rid\",\n \"keys\": devices\n};","outputs":1,"noerr":0,"initialize":"","finalize":"","x":2820,"y":900,"wires":[["ea32f8ee62565eb0","c70b0f09175d9d71"]]},{"id":"ea32f8ee62565eb0","type":"change","z":"0e0fd1a97350597a","name":"devices","rules":[{"t":"set","p":"devices","pt":"flow","to":"keys","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2880,"y":860,"wires":[[]]},{"id":"da76490a975ce4da","type":"function","z":"0e0fd1a97350597a","name":"Zone Name and ID","func":"var response = [];\nvar roomkeys = {};\nmsg.payload.data.forEach(function(item){\n if(item.hasOwnProperty(\"services\")) {\n var pair = {\n \"name\": item.metadata.name,\n \"id\": item.id,\n \"rid\": item.services[0].rid,\n \"rtype\": item.services[0].rtype\n };\n roomkeys[item.id] = item.metadata.name;\n response.push(pair);\n }\n});\n\nreturn {\n \"payload\": response,\n \"topic\": \"zones name/rid\",\n \"keys\": roomkeys\n};","outputs":1,"noerr":0,"initialize":"","finalize":"","x":2850,"y":380,"wires":[["37fbc6d748d64b59","82a59594306afa2b"]]},{"id":"9d36d8a780c253a5","type":"function","z":"0e0fd1a97350597a","name":"Zone Name and ID (array)","func":"var response = [];\nmsg.payload.data.forEach(function(item){\n if(item.services.length > 0) {\n var pair = {\n \"name\": item.metadata.name,\n \"id\": item.id,\n \"rid\": item.services[0].rid,\n \"rtype\": item.services[0].rtype\n };\n response.push(pair);\n }\n});\n\nreturn {\n \"payload\": response,\n \"topic\": \"zones name/rid\",\n};","outputs":1,"noerr":0,"initialize":"","finalize":"","x":2830,"y":420,"wires":[["ec0c34d210422b7c"]]},{"id":"4617516d6f9fd3a6","type":"function","z":"0e0fd1a97350597a","name":"Scene Name, ID, Room Name","func":"var response = [];\nvar rooms = flow.get(\"rooms\") || {};\nvar size = Object.keys(rooms).length;\nif(size <= 0) {\n node.error(\"Please Update Rooms First\");\n}\nmsg.payload.data.forEach(function(item){\n var pair = {\n \"name\": item.metadata.name,\n \"id\": item.id,\n // \"rid\": item.group.rid,\n // \"rtype\": item.group.rtype,\n \"room-name\": rooms[item.group.rid]\n };\n response.push(pair);\n});\nreturn {\n \"payload\": response,\n \"topic\": \"Scene name/rids\"\n};","outputs":1,"noerr":0,"initialize":"","finalize":"","x":2810,"y":780,"wires":[["3788426cd354af17"]]},{"id":"7207a6e426862283","type":"function","z":"0e0fd1a97350597a","name":"Room Name and ID (array)","func":"var response = [];\nmsg.payload.data.forEach(function(item){\n if(item.services.length > 0) {\n var pair = {\n \"name\": item.metadata.name,\n \"id\": item.id,\n \"rid\": item.services[0].rid,\n \"rtype\": item.services[0].rtype\n };\n response.push(pair);\n }\n});\n\nreturn {\n \"payload\": response,\n \"topic\": \"rooms name/rid\",\n};","outputs":1,"noerr":0,"initialize":"","finalize":"","x":2820,"y":580,"wires":[["757b7f0cb38a4943"]]},{"id":"757b7f0cb38a4943","type":"change","z":"0e0fd1a97350597a","name":"rooms_array","rules":[{"t":"set","p":"rooms_array","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2870,"y":620,"wires":[[]]},{"id":"ec0c34d210422b7c","type":"change","z":"0e0fd1a97350597a","name":"zones_array","rules":[{"t":"set","p":"zones_array","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2870,"y":460,"wires":[[]]},{"id":"3db2ea4221a5634e","type":"inject","z":"0e0fd1a97350597a","name":"Rooms (an array)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"array","payload":"rooms_array","payloadType":"flow","x":1840,"y":500,"wires":[["42ca1a04ee56584e"]]},{"id":"beafe38cb6162d26","type":"debug","z":"0e0fd1a97350597a","name":"API V2 DATA","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":2230,"y":700,"wires":[]},{"id":"6fc63466383f3eb3","type":"inject","z":"0e0fd1a97350597a","name":"Zones (seperately)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"split","payload":"zones_array","payloadType":"flow","x":1830,"y":780,"wires":[["42ca1a04ee56584e"]]},{"id":"a3eadcd481ea50bf","type":"inject","z":"0e0fd1a97350597a","name":"Zones (an array)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"array","payload":"zones_array","payloadType":"flow","x":1840,"y":740,"wires":[["42ca1a04ee56584e"]]},{"id":"c70b0f09175d9d71","type":"debug","z":"0e0fd1a97350597a","name":"Devices","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":3100,"y":900,"wires":[]},{"id":"60e42d97ebbe9235","type":"switch","z":"0e0fd1a97350597a","name":"Motion","property":"endpoint","propertyType":"msg","rules":[{"t":"eq","v":"motion","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":2550,"y":980,"wires":[["86639e15164186b2"]]},{"id":"86639e15164186b2","type":"function","z":"0e0fd1a97350597a","name":"Motion Name, ID, Device Name","func":"var response = [];\nvar devices = flow.get(\"devices\") || {};\nvar size = Object.keys(devices).length;\nif(size <= 0) {\n node.error(\"Please Update Devices First\");\n}\nmsg.payload.data.forEach(function(item){\n var pair = {\n \"Device\": devices[item.owner.rid],\n \"id\": item.id,\n \"type\": item.type,\n };\n response.push(pair);\n});\nreturn {\n \"payload\": response,\n \"topic\": \"Motion name/rids\"\n};","outputs":1,"noerr":0,"initialize":"","finalize":"","x":2810,"y":980,"wires":[["12869f206e6dc282","7fa4b416e5dea4ac"]]},{"id":"12869f206e6dc282","type":"debug","z":"0e0fd1a97350597a","name":"Motion","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":3090,"y":980,"wires":[]},{"id":"7fa4b416e5dea4ac","type":"change","z":"0e0fd1a97350597a","name":"motion","rules":[{"t":"set","p":"motion","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2890,"y":940,"wires":[[]]},{"id":"0b752e50ab59ee2e","type":"inject","z":"0e0fd1a97350597a","name":"Motion Senors (seperately)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"split","payload":"motion","payloadType":"flow","x":1810,"y":1020,"wires":[["42ca1a04ee56584e"]]},{"id":"d1b3d76012f748e3","type":"inject","z":"0e0fd1a97350597a","name":"Motion Sensors (an array)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"array","payload":"motion","payloadType":"flow","x":1810,"y":980,"wires":[["42ca1a04ee56584e"]]},{"id":"bb82ec1cca30b5ff","type":"switch","z":"0e0fd1a97350597a","name":"Button","property":"endpoint","propertyType":"msg","rules":[{"t":"eq","v":"button","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":2550,"y":1060,"wires":[["ee4ce528e8e0d74a"]]},{"id":"5010505c8c734cc8","type":"inject","z":"0e0fd1a97350597a","name":"Lights (seperately)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"split","payload":"lights","payloadType":"flow","x":1830,"y":420,"wires":[["42ca1a04ee56584e"]]},{"id":"5c599d058cb00ae8","type":"inject","z":"0e0fd1a97350597a","name":"Lights (an array)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"array","payload":"lights","payloadType":"flow","x":1840,"y":380,"wires":[["42ca1a04ee56584e"]]},{"id":"ee4ce528e8e0d74a","type":"function","z":"0e0fd1a97350597a","name":"Button Name, ID, Device Name","func":"var response = [];\nvar devices = flow.get(\"devices\") || {};\nvar size = Object.keys(devices).length;\nif(size <= 0) {\n node.error(\"Please Update Devices First\");\n}\nmsg.payload.data.forEach(function(item){\n var pair = {\n \"Device\": devices[item.owner.rid],\n \"id\": item.id,\n \"type\": item.type,\n };\n response.push(pair);\n});\nreturn {\n \"payload\": response,\n \"topic\": \"Motion name/rids\"\n};","outputs":1,"noerr":0,"initialize":"","finalize":"","x":2810,"y":1060,"wires":[["e37952d0dc3706e8","9d751f195b97ab97"]]},{"id":"e37952d0dc3706e8","type":"change","z":"0e0fd1a97350597a","name":"button","rules":[{"t":"set","p":"button","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2890,"y":1020,"wires":[[]]},{"id":"9d751f195b97ab97","type":"debug","z":"0e0fd1a97350597a","name":"Button","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":3090,"y":1060,"wires":[]},{"id":"d1c907c5153ecc83","type":"comment","z":"0e0fd1a97350597a","name":"Bridge Data","info":"","x":2230,"y":740,"wires":[]},{"id":"c98c5a8aa22daced","type":"comment","z":"0e0fd1a97350597a","name":"DO NOT CHANGE ANYTHING HERE","info":"","x":2210,"y":560,"wires":[]},{"id":"aa38ff4f229bb7e6","type":"debug","z":"0e0fd1a97350597a","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1050,"y":480,"wires":[]},{"id":"cae65ba0dd1b5031","type":"http request","z":"0e0fd1a97350597a","name":"HUE API V2","method":"use","ret":"obj","paytoqs":"ignore","url":"","tls":"4bc31af9bd03bbdc","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":830,"y":520,"wires":[["aa38ff4f229bb7e6","d323c26e7e815be8"]]},{"id":"d91afc3c3de16ebf","type":"comment","z":"0e0fd1a97350597a","name":"Add your Data here \\n IP and Username","info":"","x":590,"y":460,"wires":[]},{"id":"14e1f1d135b7e9d1","type":"function","z":"0e0fd1a97350597a","name":"HEADER V2","func":"// var user is your discovered username, var ip the IP adress of your bridge\nvar user = \"API USERNAME\";\nvar ip = \"YOUR IP\"\n\nif(msg.endpoint === undefined)\n msg.url = \"https://\" + ip + \"/clip/v2/resource\";\nelse if(msg.topic === undefined)\n msg.url = \"https://\" + ip + \"/clip/v2/resource/\" + msg.endpoint;\nelse\n msg.url = \"https://\" + ip + \"/clip/v2/resource/\" + msg.endpoint + \"/\" + msg.topic;\n\nmsg.headers = {};\n\nmsg.headers['hue-application-key'] = user;\nmsg.headers['Content-Type'] = 'application/json';\nmsg.headers['Accept'] = 'application/json';\n\nif(msg.payload != undefined)\n msg.headers['ContentLength'] = JSON.stringify(msg.payload).length;\n\nif(msg.verb === undefined)\n msg.method = \"get\";\nelse\n msg.method = msg.verb;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":590,"y":520,"wires":[["cae65ba0dd1b5031"]]},{"id":"cc265bc2392bbe4b","type":"link out","z":"0e0fd1a97350597a","name":"Discover Out","mode":"link","links":["e3e317032b97d1a9","71b4116aa31e8955"],"x":2145,"y":200,"wires":[]},{"id":"e3e317032b97d1a9","type":"link in","z":"0e0fd1a97350597a","name":"HUE API INPUT","links":["cc265bc2392bbe4b","8d0b43fbf3fb1bb7"],"x":360,"y":520,"wires":[["14e1f1d135b7e9d1"]],"l":true},{"id":"ebd21ba0d066358b","type":"function","z":"0e0fd1a97350597a","name":"HEADER V2","func":"// you can copy the user key from the hue config node out of Huemagic\nvar user = \"API USERNAME\";\nvar ip = \"YOUR IP\"\n\nif(msg.endpoint === undefined)\n msg.url = \"https://\" + ip + \"/clip/v2/resource\";\nelse if(msg.topic === undefined)\n msg.url = \"https://\" + ip + \"/clip/v2/resource/\" + msg.endpoint;\nelse\n msg.url = \"https://\" + ip + \"/clip/v2/resource/\" + msg.endpoint + \"/\" + msg.topic;\n\nmsg.headers = {};\n\nmsg.headers['hue-application-key'] = user;\nmsg.headers['Content-Type'] = 'application/json';\nmsg.headers['Accept'] = 'application/json';\n\nif(msg.payload != undefined)\n msg.headers['ContentLength'] = JSON.stringify(msg.payload).length;\n\nif(msg.verb === undefined)\n msg.method = \"get\";\nelse\n msg.method = msg.verb;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":410,"y":780,"wires":[["069a46c8d2f6a8b7"]]},{"id":"d9cb6bc90a13dd82","type":"comment","z":"0e0fd1a97350597a","name":"Add your Data here","info":"","x":410,"y":740,"wires":[]},{"id":"81698a59853e1aa9","type":"change","z":"0e0fd1a97350597a","name":"API KEY","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"devicetype\":\"nodered\",\"generateclientkey\":true}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":200,"wires":[["48c40913cdf7422f"]]},{"id":"7e756ec9ff3182d0","type":"inject","z":"0e0fd1a97350597a","name":"Request","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":360,"y":200,"wires":[["81698a59853e1aa9"]]},{"id":"4f8778ebd9bdeae3","type":"debug","z":"0e0fd1a97350597a","name":"API KEY","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1040,"y":200,"wires":[]},{"id":"48c40913cdf7422f","type":"http request","z":"0e0fd1a97350597a","name":"HUE Bridge IP","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://your.IP.here/api","tls":"4bc31af9bd03bbdc","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":840,"y":200,"wires":[["4f8778ebd9bdeae3"]]},{"id":"1f29d5fb6e032a9d","type":"comment","z":"0e0fd1a97350597a","name":"Add your IP here","info":"","x":840,"y":160,"wires":[]},{"id":"9366e4e0d508eab8","type":"comment","z":"0e0fd1a97350597a","name":"Request new API KEY (username) \\n press the button on your Bridge and request \\n !! ADD IP FIRST !! -------------------------->>> ","info":"","x":430,"y":120,"wires":[]},{"id":"c24278f83f931d3a","type":"comment","z":"0e0fd1a97350597a","name":"This is a different approach that can be used when \\n the step3 http request causes connection issues","info":"","x":690,"y":680,"wires":[]},{"id":"0d67eaeb449be56f","type":"comment","z":"0e0fd1a97350597a","name":"username","info":"","x":1040,"y":160,"wires":[]},{"id":"70b2ad02a12e950d","type":"comment","z":"0e0fd1a97350597a","name":"Step 1","info":"","x":150,"y":200,"wires":[]},{"id":"acac2066de3ed018","type":"comment","z":"0e0fd1a97350597a","name":"Step 2","info":"","x":150,"y":360,"wires":[]},{"id":"55c2a64760b792aa","type":"comment","z":"0e0fd1a97350597a","name":"Step 3","info":"","x":150,"y":520,"wires":[]},{"id":"b53b57516fc70331","type":"comment","z":"0e0fd1a97350597a","name":"Step 4","info":"","x":1930,"y":80,"wires":[]},{"id":"a6d3a6be5176bbbb","type":"comment","z":"0e0fd1a97350597a","name":"Step 3.b","info":"","x":160,"y":720,"wires":[]},{"id":"f009f96a46efdc3b","type":"comment","z":"0e0fd1a97350597a","name":"Configure this Node \\n IP and Username","info":"","x":350,"y":300,"wires":[]},{"id":"e5603bce935e14e5","type":"comment","z":"0e0fd1a97350597a","name":"This will request all Data fron the Bridge, \\n just click the Inject node and wait 15 seconds","info":"","x":1930,"y":140,"wires":[]},{"id":"0cb8c3010fd6feac","type":"comment","z":"0e0fd1a97350597a","name":"After you requested the Data \\n use the Inject Nodes to get ID / RID \\n the Data will apear in the Debug Window","info":"","x":2220,"y":480,"wires":[]},{"id":"cfb5443d41e0477f","type":"comment","z":"0e0fd1a97350597a","name":"To get responses from lamps / rooms / \\n zones add your discovered ID / RID here \\n - for a lamp you need to add the ID \\n - for a room / zone you need to add the RID \\n you need one subflow for every lamp or room","info":"","x":270,"y":1340,"wires":[]},{"id":"f9db2c5de26764a3","type":"comment","z":"0e0fd1a97350597a","name":"Step 5","info":"","x":2230,"y":400,"wires":[]},{"id":"ac2cc96383b1dde1","type":"comment","z":"0e0fd1a97350597a","name":"To get responses from motion sensors\\n add your discovered ID here \\n you need one subflow for every sensor ","info":"","x":250,"y":1600,"wires":[]},{"id":"f7da7af6f1282c45","type":"comment","z":"0e0fd1a97350597a","name":"To get responses from buttons \\n add your discovered ID here \\n you need one subflow for every button","info":"","x":250,"y":1840,"wires":[]},{"id":"e77a424ccae8a980","type":"change","z":"0e0fd1a97350597a","name":"Dimming 10% down / 1s transition","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Replace with your discovered ID","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"dynamics\":{\"duration\":1000},\"dimming_delta\":{\"action\":\"down\",\"brightness_delta\":10}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1440,"y":1380,"wires":[["e45b4438868f47df"]]},{"id":"1b6443113dc91621","type":"change","z":"0e0fd1a97350597a","name":"Light off / 1s transition","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Replace with your discovered ID","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"on\":{\"on\":false},\"dynamics\":{\"duration\":1000}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1480,"y":1460,"wires":[["e45b4438868f47df"]]},{"id":"d39f4b303d23739e","type":"inject","z":"0e0fd1a97350597a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1080,"y":1380,"wires":[["e77a424ccae8a980"]]},{"id":"0ec7e35ad8d9f2c2","type":"inject","z":"0e0fd1a97350597a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1080,"y":1340,"wires":[["587a51ce6a1303ce"]]},{"id":"45f1d6c3bfac899b","type":"inject","z":"0e0fd1a97350597a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1080,"y":1460,"wires":[["1b6443113dc91621"]]},{"id":"587a51ce6a1303ce","type":"change","z":"0e0fd1a97350597a","name":"Light on / 100% / orange / 1s transition","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Replace with your discovered ID","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"on\":{\"on\":true},\"dimming\":{\"brightness\":100},\"dynamics\":{\"duration\":1000},\"color\":{\"xy\":{\"x\":0.6101,\"y\":0.3662}}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1420,"y":1340,"wires":[["e45b4438868f47df"]]},{"id":"a669637935852ff2","type":"change","z":"0e0fd1a97350597a","name":"Dimming 10% up / 1s transition","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Replace with your discovered ID","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"dynamics\":{\"duration\":1000},\"dimming_delta\":{\"action\":\"up\",\"brightness_delta\":10}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1450,"y":1420,"wires":[["e45b4438868f47df"]]},{"id":"96551ef1cab665d3","type":"inject","z":"0e0fd1a97350597a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1080,"y":1420,"wires":[["a669637935852ff2"]]},{"id":"e43318a9e6108e03","type":"change","z":"0e0fd1a97350597a","name":"Light on / 100% / red / alert flashing","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Replace with your discovered ID","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"on\":{\"on\":true},\"dimming\":{\"brightness\":100},\"color\":{\"xy\":{\"x\":0.7,\"y\":0.25}},\"alert\":{\"action\":\"breathe\"}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1430,"y":1500,"wires":[["e45b4438868f47df"]]},{"id":"8188436c58bde60a","type":"inject","z":"0e0fd1a97350597a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1080,"y":1500,"wires":[["e43318a9e6108e03"]]},{"id":"0d2fac5552f0ee72","type":"change","z":"0e0fd1a97350597a","name":"Light on / 80% / 2s transition / color temp cold 153","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Replace with your discovered ID","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"on\":{\"on\":true},\"dimming\":{\"brightness\":80},\"dynamics\":{\"duration\":2000},\"color_temperature\":{\"mirek\":153}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1390,"y":1540,"wires":[["e45b4438868f47df"]]},{"id":"76020afc9b2e8495","type":"inject","z":"0e0fd1a97350597a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1080,"y":1540,"wires":[["0d2fac5552f0ee72"]]},{"id":"43c180b65c8edbaf","type":"change","z":"0e0fd1a97350597a","name":"Light on / 50% / 1s transition / color temp warm 500","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Replace with your discovered ID","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"on\":{\"on\":true},\"dimming\":{\"brightness\":50},\"dynamics\":{\"duration\":1000},\"color_temperature\":{\"mirek\":500}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1380,"y":1580,"wires":[["e45b4438868f47df"]]},{"id":"ee32905b22ea4703","type":"inject","z":"0e0fd1a97350597a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1080,"y":1580,"wires":[["43c180b65c8edbaf"]]},{"id":"3918ae1d48f02496","type":"change","z":"0e0fd1a97350597a","name":"Room or Zone on / 100% / orange / 1s transition","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"grouped_light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"replace with discovered !!!>> RID <<!!!","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"on\":{\"on\":true},\"dimming\":{\"brightness\":100},\"dynamics\":{\"duration\":1000},\"color\":{\"xy\":{\"x\":0.6101,\"y\":0.3662}}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1390,"y":1700,"wires":[["e45b4438868f47df"]]},{"id":"d671213ce25650e3","type":"inject","z":"0e0fd1a97350597a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1080,"y":1700,"wires":[["3918ae1d48f02496"]]},{"id":"2766e908d9c939b1","type":"comment","z":"0e0fd1a97350597a","name":"grouped_light - DOUBLE CLICK FOR INFO","info":"(Rooms & Zones) can be controlled in almost the samme way as lights. \n\nJust the endpoint in the change node is different and instead of \nusing the ID of a Room / Zone you need to use the discoverd **rid **\n\ngrouped_light is a service (rid) that is connected to the group/zone ID","x":1180,"y":1660,"wires":[]},{"id":"07679c9355bfe0c5","type":"change","z":"0e0fd1a97350597a","name":"Motion Sensor DISABLED","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"motion","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Replace with your discovered ID","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"enabled\":false}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1470,"y":2040,"wires":[["e45b4438868f47df"]]},{"id":"92d5e19cbf20b7a6","type":"change","z":"0e0fd1a97350597a","name":"Motion Sensor ENABLED","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"motion","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Replace with your discovered ID","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"enabled\":true}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1470,"y":2000,"wires":[["e45b4438868f47df"]]},{"id":"c40b2306a78285a3","type":"inject","z":"0e0fd1a97350597a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1080,"y":2040,"wires":[["07679c9355bfe0c5"]]},{"id":"367eb75b3364208e","type":"inject","z":"0e0fd1a97350597a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1080,"y":2000,"wires":[["92d5e19cbf20b7a6"]]},{"id":"8036b7c5c5ca661c","type":"comment","z":"0e0fd1a97350597a","name":"Motion Sensor ENABLED / DISABLED","info":"","x":1170,"y":1960,"wires":[]},{"id":"89877aa385eb78ba","type":"change","z":"0e0fd1a97350597a","name":"Recall a Scene","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"scene","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Replace with your discovered ID","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"recall\":{\"action\":\"active\"}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1500,"y":1780,"wires":[["e45b4438868f47df"]],"icon":"font-awesome/fa-star"},{"id":"be1a9c8b5809695a","type":"change","z":"0e0fd1a97350597a","name":"Room or Zone off","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"grouped_light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"replace with discovered !!!>> RID <<!!!","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"on\":{\"on\":false}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1490,"y":1740,"wires":[["e45b4438868f47df"]]},{"id":"90f187014f6d1223","type":"inject","z":"0e0fd1a97350597a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1080,"y":1740,"wires":[["be1a9c8b5809695a"]]},{"id":"18513689a97dbb27","type":"inject","z":"0e0fd1a97350597a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1080,"y":1780,"wires":[["89877aa385eb78ba"]]},{"id":"c10eaad8c9b3d371","type":"comment","z":"0e0fd1a97350597a","name":"Recall a Scene - DOUBLE CLICK FOR INFO","info":"I highly recommend to use Scenes to turn on Rooms/Zones. \nThis is just one request to the Bridge and the rest is \nprocessed in the bridge. When 4 lights are turned on simultanious, \nthe bridge possible wont be able to handle these requests at once.\n\nIf you have a setup where it is needed to turn on seperate lights, \nthen add delay nodes i front of the chhange node. \n\nExample: 4 Lights need to be tunes on, \nlight 1 = no delay\nlight 2 = 200ms delay\nlight 3 = 400ms delay\nlight 4 = 600ms delay\n\nwhen turning light off simultanious, this should be done in this way.\nBetter is to turn off Rooms or Zones with one request.","x":1190,"y":1820,"wires":[]},{"id":"c22374ba33e4323e","type":"change","z":"0e0fd1a97350597a","name":"Get State","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"grouped_light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"ADD GROUP RID","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"get","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1520,"y":2160,"wires":[["e45b4438868f47df"]]},{"id":"54004784967d796c","type":"inject","z":"0e0fd1a97350597a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1080,"y":2160,"wires":[["c22374ba33e4323e"]]},{"id":"95a0ca83e79d96f4","type":"comment","z":"0e0fd1a97350597a","name":"Get state of a Group","info":"","x":1110,"y":2120,"wires":[]},{"id":"f63ead3d9d8ff68a","type":"comment","z":"0e0fd1a97350597a","name":"Step 6","info":"","x":150,"y":1220,"wires":[]},{"id":"4a469d3ffe0e059d","type":"comment","z":"0e0fd1a97350597a","name":"These are pre-configured actions \\n add the ID / RID and try it out \\n with this samples it should be easy \\n to create all the actions you need","info":"","x":1480,"y":1900,"wires":[]},{"id":"093b72ef3b0f464a","type":"comment","z":"0e0fd1a97350597a","name":"----- CONTROLLING -----","info":"","x":1250,"y":1220,"wires":[]},{"id":"db212266972d486e","type":"comment","z":"0e0fd1a97350597a","name":"----- STATUS UPDATES -----","info":"","x":340,"y":1220,"wires":[]},{"id":"623859251fa31909","type":"change","z":"0e0fd1a97350597a","name":"Gradient Stripe","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"on\":{\"on\":true},\"dimming\":{\"brightness\":100},\"gradient\":{\"points\":[{\"color\":{\"xy\":{\"x\":0.6712,\"y\":0.2984}}},{\"color\":{\"xy\":{\"x\":0.4975,\"y\":0.3572}}},{\"color\":{\"xy\":{\"x\":0.4028,\"y\":0.3948}}},{\"color\":{\"xy\":{\"x\":0.424,\"y\":0.4396}}},{\"color\":{\"xy\":{\"x\":0.28,\"y\":0.6174}}}]}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":1500,"y":2280,"wires":[["e45b4438868f47df"]]},{"id":"0e4ca24be2c9eb20","type":"comment","z":"0e0fd1a97350597a","name":"Gradient Stripe","info":"","x":1100,"y":2240,"wires":[]},{"id":"d754f7a1a6f2a98e","type":"inject","z":"0e0fd1a97350597a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1080,"y":2280,"wires":[["623859251fa31909"]]},{"id":"0c5d170ddc767822","type":"comment","z":"0e0fd1a97350597a","name":"Lights - Node name describes what it does, add your IDs","info":"","x":1230,"y":1300,"wires":[]},{"id":"29ede7afcd9f6efb","type":"comment","z":"0e0fd1a97350597a","name":"Step 7","info":"","x":1070,"y":1220,"wires":[]},{"id":"e45b4438868f47df","type":"function","z":"0e0fd1a97350597a","name":"HEADER V2","func":"// var user is your discovered username, var ip the IP adress of your bridge\nvar user = \"API USERNAME\";\nvar ip = \"YOUR IP\"\n\nif(msg.endpoint === undefined)\n msg.url = \"https://\" + ip + \"/clip/v2/resource\";\nelse if(msg.topic === undefined)\n msg.url = \"https://\" + ip + \"/clip/v2/resource/\" + msg.endpoint;\nelse\n msg.url = \"https://\" + ip + \"/clip/v2/resource/\" + msg.endpoint + \"/\" + msg.topic;\n\nmsg.headers = {};\n\nmsg.headers['hue-application-key'] = user;\nmsg.headers['Content-Type'] = 'application/json';\nmsg.headers['Accept'] = 'application/json';\n\nif(msg.payload != undefined)\n msg.headers['ContentLength'] = JSON.stringify(msg.payload).length;\n\nif(msg.verb === undefined)\n msg.method = \"get\";\nelse\n msg.method = msg.verb;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1910,"y":1780,"wires":[["791f18c3a2f3eab3"]]},{"id":"791f18c3a2f3eab3","type":"http request","z":"0e0fd1a97350597a","name":"HUE API V2","method":"use","ret":"obj","paytoqs":"ignore","url":"","tls":"4bc31af9bd03bbdc","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":2070,"y":1780,"wires":[["4b838e5533944638"]]},{"id":"9fc2dd11abdbccf9","type":"comment","z":"0e0fd1a97350597a","name":"Add your Data here \\n IP and Username","info":"","x":1930,"y":1720,"wires":[]},{"id":"4b838e5533944638","type":"debug","z":"0e0fd1a97350597a","name":"Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":2090,"y":1740,"wires":[]},{"id":"4bc31af9bd03bbdc","type":"tls-config","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":false}]