├── .github ├── FUNDING.yml └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── flows ├── get_state.json ├── gradient_stripe.json ├── header_v2.json ├── array_splitter.json ├── scene_active.json ├── power_state.json ├── motion_sensor_update.json ├── SSE_Event_Stream.json ├── basic_toggle_function_example ├── Change Node Examples.json ├── Sub-Flows.json ├── motion_sensor_behavior.json ├── hue_effects.json ├── battery_status.json └── helper_functions_flow_2v.json ├── LICENSE.md ├── CODE_OF_CONDUCT.md └── README.md /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: paypal.me/andesse 2 | -------------------------------------------------------------------------------- /flows/get_state.json: -------------------------------------------------------------------------------- 1 | [{"id":"b74f58013a96f441","type":"change","z":"56a9ddfc.0001f4","name":"Get State","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"grouped_light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"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":660,"y":280,"wires":[[]]}] 2 | -------------------------------------------------------------------------------- /flows/gradient_stripe.json: -------------------------------------------------------------------------------- 1 | [{"id":"7e239d49f59bf21d","type":"change","z":"fe62da1.b2b0828","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":1320,"y":3740,"wires":[[]]}] 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /flows/header_v2.json: -------------------------------------------------------------------------------- 1 | [{"id":"edc180cc.926a8","type":"function","z":"56a9ddfc.0001f4","name":"HUE CLIP API","func":"// you can copy the user key from the hue config node out of Huemagic\nvar user = \"YOUR CODE\";\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":"","x":580,"y":180,"wires":[[]]}] 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /flows/array_splitter.json: -------------------------------------------------------------------------------- 1 | [{"id":"9ea544c10139c347","type":"link out","z":"cdb52ede208a8b09","name":"EventStream","mode":"link","links":[],"x":1730,"y":3300,"wires":[],"l":true},{"id":"38132742fc417f3e","type":"debug","z":"cdb52ede208a8b09","name":"HUE monitor","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1510,"y":3300,"wires":[]},{"id":"5063b899db82e765","type":"philipshue-events","z":"cdb52ede208a8b09","bridge":"9201a46f772e1bc2","x":1040,"y":3300,"wires":[["c8cc09b1d87dd5c7"]]},{"id":"c8cc09b1d87dd5c7","type":"function","z":"cdb52ede208a8b09","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":1270,"y":3300,"wires":[["9ea544c10139c347","38132742fc417f3e"]]},{"id":"9201a46f772e1bc2","type":"philipshue-events-config","address":"192.168.0.31","applicationkey":"FxL-Wdqi8bjU5H71MMwKvFxigaJhZMdhsTpAMuDb"}] 2 | -------------------------------------------------------------------------------- /flows/scene_active.json: -------------------------------------------------------------------------------- 1 | [{"id":"0bf2d511ae90c353","type":"subflow","name":"Scene Active","info":"","category":"","in":[{"x":320,"y":160,"wires":[{"id":"5ee9c9ec0c023e96"}]}],"out":[{"x":600,"y":160,"wires":[{"id":"e7fe122127d0a8fc","port":0}]}],"env":[{"name":"scene_ID","type":"str","value":"discovered scene ID"}],"meta":{},"color":"#C7E9C0","icon":"node-red/light.svg"},{"id":"717ac2cf5a81ff10","type":"switch","z":"0bf2d511ae90c353","name":"","property":"payload.data.0.status.active","propertyType":"msg","rules":[{"t":"eq","v":"static","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":465,"y":160,"wires":[["e7fe122127d0a8fc"]],"l":false},{"id":"e7fe122127d0a8fc","type":"change","z":"0bf2d511ae90c353","name":"true","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":535,"y":160,"wires":[[]],"l":false},{"id":"5ee9c9ec0c023e96","type":"switch","z":"0bf2d511ae90c353","name":"","property":"payload.data.0.id","propertyType":"msg","rules":[{"t":"eq","v":"scene_ID","vt":"env"}],"checkall":"true","repair":false,"outputs":1,"x":395,"y":160,"wires":[["717ac2cf5a81ff10"]],"l":false},{"id":"3d918a0cce364f4e","type":"subflow:0bf2d511ae90c353","z":"ad3a171395c53733","name":"","x":1350,"y":1840,"wires":[[]]}] 2 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /flows/power_state.json: -------------------------------------------------------------------------------- 1 | [{"id":"cb5c8b2f988954a0","type":"tab","label":"power_state","disabled":false,"info":"","env":[]},{"id":"bfbaf08abd1ca30d","type":"function","z":"cb5c8b2f988954a0","name":"HUE API V2 - Header","func":"\n// you can copy the user from the hue config node\nvar user = \"your Api key\";\n\n\nif(msg.endpoint === undefined)\n msg.url = \"https://192.168.0.xx/clip/v2/resource\";\nelse if(msg.topic === undefined)\n msg.url = \"https://192.168.0.xx/clip/v2/resource/\" + msg.endpoint;\nelse\n msg.url = \"https://192.168.0.xx/clip/v2/resource/\" + msg.endpoint + \"/\" + msg.topic;\n\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\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":700,"y":220,"wires":[["c42ab8e0bb689946"]]},{"id":"c42ab8e0bb689946","type":"http request","z":"cb5c8b2f988954a0","name":"https request HUE API V2","method":"use","ret":"obj","paytoqs":"ignore","url":"","tls":"4bc31af9bd03bbdc","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":710,"y":260,"wires":[["4b0554890dfadc2c"]]},{"id":"99ace1711ae9f41c","type":"change","z":"cb5c8b2f988954a0","name":"power_state","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"topic","pt":"msg"},{"t":"set","p":"endpoint","pt":"msg","to":"device_power","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":180,"wires":[["bfbaf08abd1ca30d"]]},{"id":"d448f7c696ee6817","type":"debug","z":"cb5c8b2f988954a0","name":"power_state","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1070,"y":340,"wires":[]},{"id":"4b0554890dfadc2c","type":"change","z":"cb5c8b2f988954a0","name":"payload.data","rules":[{"t":"move","p":"payload.data","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":300,"wires":[["5b14c3767ec2dc52"]]},{"id":"5b14c3767ec2dc52","type":"split","z":"cb5c8b2f988954a0","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":650,"y":340,"wires":[["d448f7c696ee6817","dca3c7a2eebdda6a"]]},{"id":"1ffa97ab4cf25c4b","type":"inject","z":"cb5c8b2f988954a0","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":460,"y":180,"wires":[["99ace1711ae9f41c"]]},{"id":"dca3c7a2eebdda6a","type":"switch","z":"cb5c8b2f988954a0","name":"","property":"payload.power_state.battery_level","propertyType":"msg","rules":[{"t":"btwn","v":"0","vt":"num","v2":"20","v2t":"num"},{"t":"btwn","v":"21","vt":"num","v2":"50","v2t":"num"},{"t":"btwn","v":"51","vt":"num","v2":"80","v2t":"num"},{"t":"btwn","v":"81","vt":"num","v2":"100","v2t":"num"}],"checkall":"true","repair":false,"outputs":4,"x":810,"y":540,"wires":[["9a1bedd5d5482427"],["9933c4facfbb6bd9"],["3779f7e3dd9ed294"],["b18ad927e31f47b0"]]},{"id":"9a1bedd5d5482427","type":"debug","z":"cb5c8b2f988954a0","name":"0-20","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1050,"y":480,"wires":[]},{"id":"9933c4facfbb6bd9","type":"debug","z":"cb5c8b2f988954a0","name":"21-50","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1050,"y":520,"wires":[]},{"id":"3779f7e3dd9ed294","type":"debug","z":"cb5c8b2f988954a0","name":"51-80","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1050,"y":560,"wires":[]},{"id":"b18ad927e31f47b0","type":"debug","z":"cb5c8b2f988954a0","name":"81-100","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1060,"y":600,"wires":[]},{"id":"11b95f63f995afff","type":"comment","z":"cb5c8b2f988954a0","name":"All Battery Data","info":"","x":1080,"y":300,"wires":[]},{"id":"89d8609162c4e3e1","type":"comment","z":"cb5c8b2f988954a0","name":"Sorted by Battery state","info":"","x":1100,"y":440,"wires":[]},{"id":"cbec37d0aef4b037","type":"comment","z":"cb5c8b2f988954a0","name":"Add your Data here, or replace","info":"","x":730,"y":240,"wires":[]},{"id":"4bc31af9bd03bbdc","type":"tls-config","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":false}] 2 | -------------------------------------------------------------------------------- /flows/motion_sensor_update.json: -------------------------------------------------------------------------------- 1 | [{"id":"4370100e69d29882","type":"subflow","name":"Enabled","info":"","category":"","in":[{"x":140,"y":260,"wires":[{"id":"a9d5cb1ef8ce73b0"}]}],"out":[],"env":[],"meta":{},"color":"#C7E900","icon":"node-red/feed.svg","status":{"x":460,"y":260,"wires":[{"id":"a9d5cb1ef8ce73b0","port":0},{"id":"a9d5cb1ef8ce73b0","port":1}]}},{"id":"a9d5cb1ef8ce73b0","type":"switch","z":"4370100e69d29882","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":290,"y":260,"wires":[[],[]]},{"id":"55a74390e1c251fb","type":"subflow","name":"HUE Motion (Receiver)","info":"","category":"HUE v2","in":[{"x":40,"y":440,"wires":[{"id":"27fffc1774c07397"}]}],"out":[{"x":1090,"y":380,"wires":[{"id":"d03a5382fae59395","port":0},{"id":"321f867083c0e761","port":0}]},{"x":1100,"y":500,"wires":[{"id":"ecfe4b625af78b92","port":0},{"id":"e3197255f3d59ca0","port":0}]}],"env":[{"name":"motion_ID","type":"str","value":"replace with discovered Motion Sensor ID"}],"meta":{},"color":"#C7E9C0","outputLabels":["motion","enabled"],"icon":"node-red/bridge-dash.svg"},{"id":"4f8d9c73725ad07b","type":"switch","z":"55a74390e1c251fb","name":"payload.motion.motion","property":"payload.data.0.motion.motion","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":590,"y":400,"wires":[["d03a5382fae59395"],["321f867083c0e761"]]},{"id":"d03a5382fae59395","type":"change","z":"55a74390e1c251fb","name":"true","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":380,"wires":[[]]},{"id":"321f867083c0e761","type":"change","z":"55a74390e1c251fb","name":"false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":420,"wires":[[]]},{"id":"27fffc1774c07397","type":"switch","z":"55a74390e1c251fb","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":[["407d4a27886b89cb"]]},{"id":"407d4a27886b89cb","type":"rbe","z":"55a74390e1c251fb","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":370,"y":440,"wires":[["4f8d9c73725ad07b","ab6f3bb318571142"]]},{"id":"ab6f3bb318571142","type":"switch","z":"55a74390e1c251fb","name":"payload.data.0.enabled","property":"payload.data.0.enabled","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":590,"y":480,"wires":[["ecfe4b625af78b92"],["e3197255f3d59ca0"]]},{"id":"ecfe4b625af78b92","type":"change","z":"55a74390e1c251fb","name":"true","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":460,"wires":[[]]},{"id":"e3197255f3d59ca0","type":"change","z":"55a74390e1c251fb","name":"false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":500,"wires":[[]]},{"id":"cb31a68d00adaafb","type":"tab","label":"Motion Sensor Update","disabled":false,"info":"","env":[]},{"id":"f7531cbca4724f0f","type":"subflow:55a74390e1c251fb","z":"cb31a68d00adaafb","name":"","env":[{"name":"motion_ID","value":"add Sensor ID here","type":"str"}],"x":580,"y":520,"wires":[["b6353977bf3437e5","18e1c555544ec8c6"],["1407f8e67832a924"]]},{"id":"1407f8e67832a924","type":"subflow:4370100e69d29882","z":"cb31a68d00adaafb","name":"","x":900,"y":580,"wires":[]},{"id":"3fd131b50d90da0d","type":"link in","z":"cb31a68d00adaafb","name":"connection to EventStream","links":[],"x":330,"y":520,"wires":[["f7531cbca4724f0f"]],"l":true},{"id":"b6353977bf3437e5","type":"link out","z":"cb31a68d00adaafb","name":"Motion Sensor Events (true / false)","mode":"link","links":[],"x":980,"y":460,"wires":[],"l":true},{"id":"18e1c555544ec8c6","type":"debug","z":"cb31a68d00adaafb","name":"Motion","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":900,"y":420,"wires":[]},{"id":"b81d6e11d91acea2","type":"comment","z":"cb31a68d00adaafb","name":"- Shows Sensor Enable / Disable state (true/false)","info":"","x":1020,"y":620,"wires":[]},{"id":"324e0f0c503beafe","type":"comment","z":"cb31a68d00adaafb","name":"Add Sensor ID here","info":"","x":570,"y":480,"wires":[]},{"id":"4881678c229d017c","type":"comment","z":"cb31a68d00adaafb","name":"Comments - DOUBLE CLICK","info":"I use the Sensor Subflow node in every\nroom flow-tab. It is mostly informative. \n\nTHERE IS NO NEED TO CHANGE\nYOUR EXISTING FLOW. THIS IS NICE TO HAVE!\n\nIt makes in node-red easy to determine what \nstate the sensors have.\n\nMaybe you find this useful as well :)","x":960,"y":520,"wires":[]}] 2 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | . 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /flows/SSE_Event_Stream.json: -------------------------------------------------------------------------------- 1 | [{"id":"7b3fcb1.35bfa34","type":"subflow","name":"Event Flow","info":"","category":"","in":[{"x":180,"y":200,"wires":[{"id":"5887e8c4.48e338"}]}],"out":[{"x":440,"y":100,"wires":[{"id":"d5d2e8d5.444e18","port":0}]},{"x":440,"y":200,"wires":[{"id":"983e6b20.ba90b8","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"5887e8c4.48e338","type":"json","z":"7b3fcb1.35bfa34","name":"","property":"payload","action":"","pretty":false,"x":295,"y":200,"wires":[["983e6b20.ba90b8","983e6b20.ba90b8"]],"l":false},{"id":"983e6b20.ba90b8","type":"split","z":"7b3fcb1.35bfa34","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"id","x":295,"y":140,"wires":[["d2c4499f.07e4e","d2c4499f.07e4e"]],"l":false},{"id":"d2c4499f.07e4e","type":"change","z":"7b3fcb1.35bfa34","name":"","rules":[{"t":"move","p":"payload.data","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":375,"y":140,"wires":[["7851ee43.5d9f68","7851ee43.5d9f68"]],"l":false},{"id":"7851ee43.5d9f68","type":"split","z":"7b3fcb1.35bfa34","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"id","x":295,"y":100,"wires":[["d5d2e8d5.444e18"]],"l":false},{"id":"d5d2e8d5.444e18","type":"rbe","z":"7b3fcb1.35bfa34","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","x":375,"y":100,"wires":[[]],"l":false},{"id":"e753ceb7.d083a","type":"sse-client","z":"af40bef6.327ce","name":"HUE CLIP API","url":"https://192.168.0.40/eventstream/clip/v2","events":[],"headers":{},"proxy":"","restart":true,"rejectUnauthorized":false,"withCredentials":true,"timeout":"120","x":1600,"y":1460,"wires":[["2b1294d4.46822c"]]},{"id":"dbda83db.d0634","type":"inject","z":"af40bef6.327ce","name":"(Re-)start stream","props":[{"p":"ip","v":"192.168.0.40","vt":"str"},{"p":"headers","v":"{\"hue-application-key\":\"FS9pMDGj6x2D3p1Kv2VZuh6TTIR\"}","vt":"json"}],"repeat":"","crontab":"","once":true,"onceDelay":"0.7","topic":"","x":1270,"y":1460,"wires":[["e753ceb7.d083a","e753ceb7.d083a"]]},{"id":"5efb8925.edcb28","type":"inject","z":"af40bef6.327ce","name":"Stop stream","props":[{"p":"stop","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":1250,"y":1520,"wires":[["e753ceb7.d083a","e753ceb7.d083a"]]},{"id":"e6afee7b.4364d","type":"inject","z":"af40bef6.327ce","name":"Pause stream","props":[{"p":"pause","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":1250,"y":1580,"wires":[["e753ceb7.d083a","e753ceb7.d083a"]]},{"id":"8736735b.9afbe8","type":"comment","z":"af40bef6.327ce","name":"HUE Key & Bridge IP here","info":"","x":1270,"y":1420,"wires":[]},{"id":"5c560ad4.495cfc","type":"comment","z":"af40bef6.327ce","name":"Bridge IP here","info":"","x":1590,"y":1420,"wires":[]},{"id":"632a0ea1.df8b5","type":"comment","z":"af40bef6.327ce","name":"DO NOT DEPLOY WITHOUT THE SSE NODE!","info":"","x":1690,"y":1520,"wires":[]},{"id":"bc923af0.00cd7","type":"debug","z":"af40bef6.327ce","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":2010,"y":1420,"wires":[]},{"id":"2b1294d4.46822c","type":"subflow:7b3fcb1.35bfa34","z":"af40bef6.327ce","name":"","env":[],"x":1790,"y":1460,"wires":[["bc923af0.00cd7"],["83375cee.7a928"]]},{"id":"b050d52a.117e","type":"catch","z":"af40bef6.327ce","name":"","scope":["e753ceb7.d083a"],"uncaught":false,"x":1240,"y":1700,"wires":[["bdbf0313.69651"]]},{"id":"bdbf0313.69651","type":"change","z":"af40bef6.327ce","name":"(Re-)start","rules":[{"t":"set","p":"ip","pt":"msg","to":"192.168.0.40","tot":"str"},{"t":"set","p":"headers","pt":"msg","to":"{\"hue-application-key\":\"FS9pMDGj6x2D3p1Kv2VZu5l5qhIp\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":1240,"y":1740,"wires":[["e753ceb7.d083a"]]},{"id":"9f86b085.406fa","type":"comment","z":"af40bef6.327ce","name":"HUE Key & IP here","info":"","x":1250,"y":1780,"wires":[]},{"id":"65e73541.e6622c","type":"comment","z":"af40bef6.327ce","name":"!! IMPORTANT - DOUBLE CLICK !!","info":"The red CATCH node will catch errors from the SSE-Node in case it has an error.\n\nPlease be aware that this can cause a loop when for example the IP for the Bridge changed.\n(SSE-Node can't connect any longer and cause an error, CATCH node sends a restart and so on...)\n\nThis could - depending on your setup - to a high CPU load and could cause overheating / restarting your system.\n\nYou need to decide by yourself if this funtion should be used or not. If youre not sure, dont use it.","x":1260,"y":1820,"wires":[]},{"id":"83375cee.7a928","type":"debug","z":"af40bef6.327ce","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":2010,"y":1500,"wires":[]},{"id":"c2d41975.1e115","type":"comment","z":"af40bef6.327ce","name":"Original Event Stream","info":"","x":2040,"y":1540,"wires":[]},{"id":"b7b6fed0.b07cd8","type":"comment","z":"af40bef6.327ce","name":"Filtered Event Stream","info":"","x":2040,"y":1380,"wires":[]},{"id":"3edaa0ac.4de2a8","type":"comment","z":"af40bef6.327ce","name":"DOUBLE CLICK for Info","info":"The original Event Stream contains the same Data as the Contrib from Yadomi HUE Events and can replace the Node. \n\nThe filtered output contains the payload that is behind the data part of the payload.\n\nTry it out what you like more :)","x":2040,"y":1460,"wires":[]},{"id":"eecea4d9.dff31","type":"comment","z":"af40bef6.327ce","name":"DOUBLE CLICK for Info","info":"The SSE node has a setup for timeouts. \nI have set this to 120seconds after that it will directly connect again by itself in a couple of Milliseconds. \n\nIf there is need or something is not working try different timeouts. \n\nKeep the blue inject Node in any Case, these activates the Eventflow after deploy / node red start, etc.","x":1620,"y":1560,"wires":[]}] 2 | -------------------------------------------------------------------------------- /flows/basic_toggle_function_example: -------------------------------------------------------------------------------- 1 | [{"id":"3fd1fcdf.36063c","type":"subflow","name":"Light Response","info":"","category":"HUE v2","in":[{"x":100,"y":380,"wires":[{"id":"88eac1bd4d2ab5b7"}]}],"out":[{"x":1020,"y":380,"wires":[{"id":"3b007fc2.9f0448","port":0},{"id":"a5f5c653.282a7","port":0}]}],"env":[{"name":"light_ID","type":"str","value":"replace with discovered Lamp / Group ID"}],"meta":{},"color":"#C0DEED","icon":"node-red/light.svg"},{"id":"edb5df72.69def8","type":"rbe","z":"3fd1fcdf.36063c","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","x":730,"y":300,"wires":[["3b007fc2.9f0448"]]},{"id":"3b007fc2.9f0448","type":"switch","z":"3fd1fcdf.36063c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":850,"y":300,"wires":[[]]},{"id":"6eab42b7.86eab4","type":"change","z":"3fd1fcdf.36063c","name":"False","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":260,"wires":[["dc3e64b5.ab74e8"]]},{"id":"dc3e64b5.ab74e8","type":"delay","z":"3fd1fcdf.36063c","name":"1s","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":850,"y":260,"wires":[["edb5df72.69def8"]]},{"id":"bc246720.a972d","type":"change","z":"3fd1fcdf.36063c","name":"True","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":340,"wires":[["edb5df72.69def8"]]},{"id":"3581683f.6598d","type":"delay","z":"3fd1fcdf.36063c","name":"1s","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":850,"y":500,"wires":[["d6d75391.dccac8"]]},{"id":"d6d75391.dccac8","type":"rbe","z":"3fd1fcdf.36063c","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","x":730,"y":460,"wires":[["a5f5c653.282a7"]]},{"id":"6bdd0583.7c75e4","type":"change","z":"3fd1fcdf.36063c","name":"false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":420,"wires":[["d6d75391.dccac8"]]},{"id":"cf0d42b2.ad37e8","type":"change","z":"3fd1fcdf.36063c","name":"true","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":500,"wires":[["3581683f.6598d"]]},{"id":"a5f5c653.282a7","type":"switch","z":"3fd1fcdf.36063c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":850,"y":460,"wires":[[]]},{"id":"9fc6225e.6421c8","type":"switch","z":"3fd1fcdf.36063c","name":"true / false","property":"payload.data.0.on.on","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":380,"wires":[["bc246720.a972d","6eab42b7.86eab4"],["6bdd0583.7c75e4","cf0d42b2.ad37e8"]]},{"id":"88eac1bd4d2ab5b7","type":"switch","z":"3fd1fcdf.36063c","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":260,"y":380,"wires":[["9fc6225e.6421c8"]]},{"id":"3b0871a1c702fcf9","type":"tab","label":"Toggle example ","disabled":false,"info":"","env":[]},{"id":"a33a38011820efd8","type":"function","z":"3b0871a1c702fcf9","name":"On/Off","func":"//VARIABLE\nlet light = {\n state: global.get(\"light1\")\n}\n// ON\nif (\n light.state === false\n )\n{\n return [msg, null];\n}\n// OFF\nif (\n light.state === true\n )\n{\n return [null, msg]\n} \n ","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":540,"wires":[["054e8b86eac5722a"],["7c5541462c01a874"]]},{"id":"2264c299e6f445e5","type":"change","z":"3b0871a1c702fcf9","name":"light1","rules":[{"t":"set","p":"light1","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":220,"wires":[[]]},{"id":"40fe4b83ab14c00c","type":"subflow:3fd1fcdf.36063c","z":"3b0871a1c702fcf9","name":"Light","env":[{"name":"light_ID","value":"Add your ID here","type":"str"}],"x":370,"y":220,"wires":[["2264c299e6f445e5"]]},{"id":"dde1fcbd70a56a29","type":"inject","z":"3b0871a1c702fcf9","name":"Restart","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":140,"y":120,"wires":[["ba55a125578150d5"]]},{"id":"ba55a125578150d5","type":"change","z":"3b0871a1c702fcf9","name":"Variable ","rules":[{"t":"set","p":"light1","pt":"global","to":"false","tot":"bool"},{"t":"set","p":"light2","pt":"global","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":120,"wires":[[]]},{"id":"3349b1febcc012d7","type":"inject","z":"3b0871a1c702fcf9","name":"Your Switch","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":170,"y":540,"wires":[["a33a38011820efd8"]]},{"id":"c14caabf9f0952d2","type":"link in","z":"3b0871a1c702fcf9","name":"Connect to Event Stream","links":[],"x":170,"y":220,"wires":[["40fe4b83ab14c00c"]],"l":true},{"id":"054e8b86eac5722a","type":"change","z":"3b0871a1c702fcf9","name":"Light On","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Add your Light ID here","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"on\":{\"on\":true},\"dynamics\":{\"duration\":1000}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":520,"wires":[["8da70e30f15aeb3f","0cf9beb06e47cd2b"]]},{"id":"7c5541462c01a874","type":"change","z":"3b0871a1c702fcf9","name":"Light Off","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Add your Light ID here","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":500,"y":560,"wires":[["8da70e30f15aeb3f","a178def84514b559"]]},{"id":"8da70e30f15aeb3f","type":"link out","z":"3b0871a1c702fcf9","name":"Connect to Header Node for Http request","mode":"link","links":[],"x":800,"y":540,"wires":[],"l":true},{"id":"0cf9beb06e47cd2b","type":"debug","z":"3b0871a1c702fcf9","name":"On","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":690,"y":500,"wires":[]},{"id":"a178def84514b559","type":"debug","z":"3b0871a1c702fcf9","name":"Off","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":690,"y":580,"wires":[]},{"id":"ebbd29639c2b17a7","type":"inject","z":"3b0871a1c702fcf9","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":230,"y":340,"wires":[["2264c299e6f445e5"]]},{"id":"79a0045257203dc2","type":"inject","z":"3b0871a1c702fcf9","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":230,"y":380,"wires":[["2264c299e6f445e5"]]},{"id":"e6a18204c90be438","type":"comment","z":"3b0871a1c702fcf9","name":"for testing","info":"","x":220,"y":300,"wires":[]},{"id":"b963d18207d84cd3","type":"comment","z":"3b0871a1c702fcf9","name":"DOUBLE CLICK","info":"This will set the variables to false on \nNodeRed restart. cause they are memory\nstored and get lost. \n\nyou need to add all your individual variable\nfor light/groups here","x":160,"y":80,"wires":[]},{"id":"4e2937742d14568e","type":"comment","z":"3b0871a1c702fcf9","name":"DOUBLE CLICK","info":"you need to use a individual variable for\neach light / group. copy this and change the\nvariable name. \n\ni modified my light receiver a bit, cause \ni always need true/false. you can use this\none, or that comes with the flow.\n\nadd your light / group ID inside that \nyou want to trigger","x":440,"y":180,"wires":[]},{"id":"87b73e85ef740e45","type":"comment","z":"3b0871a1c702fcf9","name":"DOUBLE CLICK","info":"connect this to your switch, the function \nwill ask for the global variable.\n\nthe variable get changed by the light state\n\nif the light is on, it will use second \noutput to the change node. \nif your light is off, it use the first output\nto the change node. \n\nin the change node use the code that you\nneed, i just added a simple on/off with\n1 second transition.\n\nThis works for lights and groups\n\nyou need to replace the var in the function\nnode for individual lights. (light1, lights2) \n","x":360,"y":480,"wires":[]}] 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![IMG_2180](https://user-images.githubusercontent.com/76150626/174133694-50b4d23b-7ee6-42a3-8d64-24de60890dde.jpeg) 2 | 3 | # Please read the readme before use! 4 | 5 | This respository is an example flow how to communicate using https-request with the HUE-Bridge, using HUE's Restful API V2 (Clip API) 6 | It includes various sample flows, sub-flows, descriptions and a lot more. 7 | 8 | ——————————————— 9 | 10 | ### Installation Instructions: 11 | - Install node-red-contrib-sse-client in NodeRed 12 | - Import the Data from the :arrow_right: **HUE-CLIP-API_Node-Red-Flows.json** :arrow_left: into a new Flow Tab, deploy 13 | - In the flow are labels with **step1-step7**, follow step-by-step 14 | - **step1** generate a username for this flow in the Bridge, first add the Bridge IP in the labeled node, deploy. 15 | Press the button on your Bridge. Inject the Request Node, the debug window will show the username 16 | - **step2** Configure the hue-events node with your IP and just discovered username 17 | - **step3** add the same data into the HEADER V2 node, deploy 18 | - **step4** Inject the "Request all Data" node. This process will take a couple of seconds, the Data will be stored in context (memory) 19 | - **step5** Now you can use the Inject nodes for different API Endpoints. The data will be shown in the debug window. Discover lights or rooms for the next step 20 | - **step6** Double click on the blue "HUE Light Receiver" Node. Add the ID (for a light) or the RID (for a Room) inside the node, deploy. 21 | Now use your App, turn on / off the light in the room, the subflow will output true/false. Repeat for all lights and rooms / zones, that need to have status events for your flows. Do the same for motion sensors and buttons. 22 | - **step7** In the flow are several examples how to send actions to the bridge. You can just try it out and see what happens. The description is the node name. 23 | Discover your scenes, (like in step 5) and add a scene ID into the "Recall a Scene" Node, deploy. Use the inject to activate the scene, repeat for all scenes that are needed. 24 | - Done! You can now start to create your setup. 25 | 26 | - Worth to mention: There are some flow examples for special things in the flows subfolder of this repository. Some are described here in the readme, others are not. The name is a hint what it is, just try it out. 27 | 28 | https://github.com/andesse/hue-clip-api.node-red-flows/blob/main/HUE-CLIP-API_Node-Red-Flows.json 29 | 30 | ### Recomendations / Informations: 31 | - Do it room-by-room 32 | - Build the whole HUE-setup in a single Flow-Tab, use link-in / link-out nodes to connect it to your Rooms 33 | - Label those link-in / link-out nodes, otherwise it will be too confusing 34 | - Trigger scenes and not single lights, too much requests at once will be refused by the bridge 35 | The Bridge is just able to receive max! 5 light / 1 group request per second, less is better. If problems do occure, use the alternative request flow (step3) 36 | - additional flows are in the "flows" folder in this repository and can be downloaded there 37 | - Colors get more complicated. These are x/y values now. To determine the right value I recommend to change the color in the app and watch the EventStream. Open the color payload until you find the x/y values and use these. 38 | - For a full API Documentation you could create an Account at: https://developers.meethue.com/ 39 | 40 | ### If your Bridge stops sending Events from yadomi's node (this can be related to Network connectivity loss) try to re-deploy the node, or get a new api token. Restarting Node-RED might work as well. 41 | 42 | If you need help, start a discussion and when you are pleased with this repository, click donate and buy me a coffee :) Thanks 43 | 44 | ### Shoutout to everyone who participated with great ideas, code, and/or additional flows, that made this repository even better, Thank you! Credits below 45 | 46 | Main Flow (HUE-CLIP-API_Node-Red-Flows.json): 47 | ------------ 48 | ![HUE-CLIP-API_Node-Red-Flows_json](https://user-images.githubusercontent.com/76150626/188687612-092979bd-2711-4c24-9345-51c438d5056e.JPG) 49 | 50 | ______________ 51 | 52 | ## Version 5.3.2 Update 53 | 54 | **NEW:** Battery Status Subflow 55 | 56 | I created a subflow Node and made some changes at the Helper Flow, its now easy to determine the battery levels, 57 | and also to output Device Name + Battery status if the level falls under a specified value. 58 | 59 | You will find the file battery_status.json in the flows section for download. Or use this link: 60 | https://github.com/andesse/HUE-CLIP-API.Node-RED-Flows/blob/main/flows/battery_status.json 61 | 62 | All necessary infos are included in the file as comments. 63 | Please read the Instructions at top left first. 64 | 65 | ![IMG_8187](https://github.com/user-attachments/assets/620c8ae5-8359-45aa-814a-6f1b05cb23a3) 66 | 67 | ![IMG_8186](https://github.com/user-attachments/assets/49d03ee6-3803-4564-b97e-0f12397a4876) 68 | 69 | ______________ 70 | 71 | ## Version 5.3.1 Update 72 | 73 | I just discovered that it is possible to determine which scene is turned on in the eventstream. 74 | 75 | A new subflow is added in the flows folder: flows/scene_active.json 76 | Simply add the discovered scene ID and it gives you a true when the scene is turned on. 77 | This might be useful in some scenarios. 78 | 79 | 80 | ![IMG_1205](https://github.com/andesse/HUE-CLIP-API.Node-RED-Flows/assets/76150626/f23223ff-66f1-431d-92ae-e2b47450ee20) 81 | 82 | 83 | 84 | Version 5.3 85 | --- 86 | I made an all-in-one Subflow for: Candle, Fire, Alarm Light, Alarm Group, dynamic Scene effects. It is pretty convenient to use. 87 | It should work out of the box immediatly. You just need to add the ID in the subflow when you double click it. 88 | There are some description in the Flow as usual. You can find the file un the flows subfolder. hue_effects.json 89 | https://github.com/andesse/hue-clip-api.node-red-flows/blob/main/flows/hue_effects.json 90 | 91 | Edit: normal scene added as well, not shown in the picture 92 | 93 | ![IMG_2784](https://user-images.githubusercontent.com/76150626/193901650-85ff3179-56eb-4592-bac2-22e159ec6b52.jpeg) 94 | 95 | 96 | ——————————————— 97 | 98 | Version 5.2 99 | --- 100 | The motion_sensor_bahavior.json flow got replaced, you can find it in the flows folder.It would be a super long text to explain it here, short: this controls a motion sensor thats not configurized in the app. I made it to define the times more accurately. Import it and have a look, there are quite a lot of comments in the flow. No additional contrib needed like before. Looks super big on the picture, but when everything is in place and with link in / out nodes its fine. There are also some additional things as well, probably not needed 101 | 102 | ![IMG_2773](https://user-images.githubusercontent.com/76150626/193459271-a1f7a9e7-c947-45e1-8981-3fce228231dc.jpeg) 103 | 104 | 105 | 106 | Version 5.1 107 | --- 108 | - one file added into the flows subfolder >>> motion_sensor_update.json 109 | - the updated flow for the motion endpoint receivers has a benefit, you can see the sensor state (enabled/disabled). 110 | - this is just nice to have, try it and decide if its useful for your setup. 111 | 112 | ![IMG_2726](https://user-images.githubusercontent.com/76150626/192052817-32535569-39c1-4c79-b8f9-2dbc019ca83b.jpeg) 113 | 114 | 115 | Version 5.0 116 | --- 117 | 118 | - Merged the V2 approach from FredBlo with the original flow 119 | - Complete update of the readme, with easy installation instructions 120 | - Array Splitter function node from FredBlo 121 | 122 | ### Another change is coming with upcoming Bridge Firmware, read below. (this is important for everyone already using the flow) 123 | 124 | HUE changed the Event-Flow output for groups in the API with a new Beta Firmware. I got the beta release 1.53.1953188010 125 | 126 | Instead of sending payloads for every light/group seperately they changed it into a payload with one big array. 127 | For the reason that the response data for the group is not always at the same position the array need to be split to single payloads first. 128 | Everything else seem to work like before. 129 | 130 | The array splitter is set in between your event node (SSE or Yadomi) and the output is connected to the receivers. 131 | https://github.com/andesse/hue-clip-api.node-red-flows/blob/main/flows/array_splitter.json 132 | 133 | 134 | Array Splitter separately: 135 | ----------- 136 | ![array_splitter](https://user-images.githubusercontent.com/76150626/188687682-3bceea2c-4d40-495e-9eed-42d041415508.JPG) 137 | 138 | 139 | These change can be done already, even when you dont have this Firmware. You just need to add the node into your setup to be prepared before the public Firmware rollout. 140 | >ALWAYS BACKUP YOUR OLD FLOW BEFORE, TO AVOID DOUBLE EFFORT IF YOU HAVE AN ISSUE! 141 | 142 | ----------------------------------------------------------- 143 | 144 | Action Change Nodes: 145 | --- 146 | ![IMG_2723](https://user-images.githubusercontent.com/76150626/192001918-178e9a6e-8075-4a92-9e0d-f6bfe5792d95.jpeg) 147 | 148 | ----------------------------------------------------------- 149 | 150 | Helper Functions for RID / ID discovery (concept by user marc-gist - THANKS!) 151 | --- 152 | ![helper_functions_flow_v2](https://user-images.githubusercontent.com/76150626/174495416-dbb394b5-c012-482c-a119-eb16cd073171.PNG) 153 | 154 | 155 | SSE_Event_Stream: 156 | --- 157 | 158 | ![IMG_2261](https://user-images.githubusercontent.com/76150626/176202424-8f7e53db-bb9a-41aa-8ce4-c71f1b153fa5.jpeg) 159 | 160 | 161 | credits and thanks to: 162 | --- 163 | - ralfhille (first concept idea) 164 | - yadomi (hue-events contrib) 165 | - marc-gist (helper flow, to determine the ID/RID in a convenient way) 166 | - FredBlo (new approach, with a lot of functional improvements for the flow) 167 | 168 | Sponsor Link, buy me a coffee :) 169 | -------------------------------------------------------------------------------- /flows/Change Node Examples.json: -------------------------------------------------------------------------------- 1 | [{"id":"1f9acf83.9006e","type":"change","z":"c4bb6fdc.f0e168","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":600,"y":1600,"wires":[["2565a4db.f6564c"]]},{"id":"fe7a9c3.9f0086","type":"change","z":"c4bb6fdc.f0e168","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":640,"y":1680,"wires":[["2565a4db.f6564c"]]},{"id":"d633674f.d88018","type":"inject","z":"c4bb6fdc.f0e168","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":240,"y":1600,"wires":[["1f9acf83.9006e"]]},{"id":"f499cb89.8de808","type":"inject","z":"c4bb6fdc.f0e168","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":240,"y":1560,"wires":[["e6553522.6f6c08"]]},{"id":"f8681d08.e3e3","type":"inject","z":"c4bb6fdc.f0e168","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":240,"y":1680,"wires":[["fe7a9c3.9f0086"]]},{"id":"e6553522.6f6c08","type":"change","z":"c4bb6fdc.f0e168","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":590,"y":1560,"wires":[["2565a4db.f6564c"]]},{"id":"4ef7e467.ceb65c","type":"change","z":"c4bb6fdc.f0e168","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":610,"y":1640,"wires":[["2565a4db.f6564c"]]},{"id":"6d4c8dc9.3fd1a4","type":"inject","z":"c4bb6fdc.f0e168","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":240,"y":1640,"wires":[["4ef7e467.ceb65c"]]},{"id":"3137bc6e.379034","type":"change","z":"c4bb6fdc.f0e168","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":600,"y":1720,"wires":[["2565a4db.f6564c"]]},{"id":"f2935ffd.f56e9","type":"inject","z":"c4bb6fdc.f0e168","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":240,"y":1720,"wires":[["3137bc6e.379034"]]},{"id":"2d820094.04ff7","type":"change","z":"c4bb6fdc.f0e168","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":550,"y":1760,"wires":[["2565a4db.f6564c"]]},{"id":"1eadd878.5437a8","type":"inject","z":"c4bb6fdc.f0e168","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":240,"y":1760,"wires":[["2d820094.04ff7"]]},{"id":"c062e60a.efec68","type":"change","z":"c4bb6fdc.f0e168","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":550,"y":1800,"wires":[["2565a4db.f6564c"]]},{"id":"be9c7dfe.0196e","type":"inject","z":"c4bb6fdc.f0e168","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":240,"y":1800,"wires":[["c062e60a.efec68"]]},{"id":"bcf5eb02.5eed18","type":"comment","z":"c4bb6fdc.f0e168","name":"lights - DOUBLE CLICK FOR INFO","info":"","x":320,"y":1520,"wires":[]},{"id":"e4e239bb.b444c8","type":"change","z":"c4bb6fdc.f0e168","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 <> RID <>> No need to change anything in this Flow <<<\n\n- By clicking \"Get all Data\" Inject Node, you also refresh the stored Data. \n\n- The \"Delete\" Inject Node is for deleting the storead Data if needed at some point.\n\n","x":2220,"y":1040,"wires":[]},{"id":"93fb11ca.c149b","type":"change","z":"56a9ddfc.0001f4","name":"zone scene","rules":[{"t":"set","p":"zone_scenes","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":3330,"y":1680,"wires":[[]]},{"id":"df8fd5f9.59db08","type":"inject","z":"56a9ddfc.0001f4","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":2140,"y":1700,"wires":[["1adff996.f43ed6"]]},{"id":"5a3ac02d.42096","type":"inject","z":"56a9ddfc.0001f4","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":2130,"y":1440,"wires":[["1adff996.f43ed6"]]},{"id":"8be2de1d.232f2","type":"inject","z":"56a9ddfc.0001f4","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":2130,"y":1480,"wires":[["1adff996.f43ed6"]]},{"id":"1adff996.f43ed6","type":"subflow:7a14643a.75260c","z":"56a9ddfc.0001f4","name":"","env":[],"x":2500,"y":1600,"wires":[["3e0417af.770258"]]},{"id":"e3ea92e5.cc115","type":"change","z":"56a9ddfc.0001f4","name":"DELETE STORED CONTEXT","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":2550,"y":1000,"wires":[[]]},{"id":"4a4a0367.b3df5c","type":"inject","z":"56a9ddfc.0001f4","name":"Delete","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":2190,"y":1000,"wires":[["e3ea92e5.cc115"]]},{"id":"ab31bc05.77c0c","type":"change","z":"56a9ddfc.0001f4","name":"lights","rules":[{"t":"set","p":"lights","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":3350,"y":2080,"wires":[[]]},{"id":"bc6de8ba.6fe0a8","type":"debug","z":"56a9ddfc.0001f4","name":"Lights","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":3590,"y":2120,"wires":[]},{"id":"c184b3ad.f0547","type":"function","z":"56a9ddfc.0001f4","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":3290,"y":2120,"wires":[["ab31bc05.77c0c","bc6de8ba.6fe0a8"]]},{"id":"29f74ca9.125ba4","type":"inject","z":"56a9ddfc.0001f4","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":2150,"y":2020,"wires":[["1adff996.f43ed6"]]},{"id":"8b2e2ac7.3015b8","type":"inject","z":"56a9ddfc.0001f4","name":"Buttons (seperately)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"split","payload":"button","payloadType":"flow","x":2150,"y":2060,"wires":[["1adff996.f43ed6"]]},{"id":"c1c632c6.7c459","type":"inject","z":"56a9ddfc.0001f4","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":2150,"y":1380,"wires":[["1adff996.f43ed6"]]},{"id":"5281ce31.81651","type":"function","z":"56a9ddfc.0001f4","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":3300,"y":1360,"wires":[["b0c1c08f.cd09","1c2578db.96e2c7"]]},{"id":"ab0eaa70.e72fb8","type":"switch","z":"56a9ddfc.0001f4","name":"Device","property":"endpoint","propertyType":"msg","rules":[{"t":"eq","v":"device","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":3010,"y":1780,"wires":[["8b5bcae6.1e48c8"]]},{"id":"8b5bcae6.1e48c8","type":"function","z":"56a9ddfc.0001f4","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":3280,"y":1780,"wires":[["d6d0e3ed.3456","ed685ba8.78f468"]]},{"id":"d6d0e3ed.3456","type":"change","z":"56a9ddfc.0001f4","name":"devices","rules":[{"t":"set","p":"devices","pt":"flow","to":"keys","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":3340,"y":1740,"wires":[[]]},{"id":"11c52499.8a819b","type":"function","z":"56a9ddfc.0001f4","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":3310,"y":1160,"wires":[["4ce2bfd3.60447","5bf4d24f.d7f07c"]]},{"id":"9da74eb5.c82d4","type":"function","z":"56a9ddfc.0001f4","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":3290,"y":1200,"wires":[["ed3f26cb.0cf278"]]},{"id":"9d108223.484bb","type":"function","z":"56a9ddfc.0001f4","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":3270,"y":1640,"wires":[["745bd723.b4cb48"]]},{"id":"18ca2231.e3138e","type":"function","z":"56a9ddfc.0001f4","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":3280,"y":1400,"wires":[["9088582b.14ed48"]]},{"id":"9088582b.14ed48","type":"change","z":"56a9ddfc.0001f4","name":"rooms_array","rules":[{"t":"set","p":"rooms_array","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":3330,"y":1440,"wires":[[]]},{"id":"ed3f26cb.0cf278","type":"change","z":"56a9ddfc.0001f4","name":"zones_array","rules":[{"t":"set","p":"zones_array","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":3330,"y":1240,"wires":[[]]},{"id":"461c6f4.a8ac19","type":"inject","z":"56a9ddfc.0001f4","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":2160,"y":1340,"wires":[["1adff996.f43ed6"]]},{"id":"3e0417af.770258","type":"debug","z":"56a9ddfc.0001f4","name":"API V2 DATA","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":2510,"y":1560,"wires":[]},{"id":"9a001341.31be3","type":"inject","z":"56a9ddfc.0001f4","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":2150,"y":1640,"wires":[["1adff996.f43ed6"]]},{"id":"a35b7a0f.1afe08","type":"inject","z":"56a9ddfc.0001f4","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":2160,"y":1600,"wires":[["1adff996.f43ed6"]]},{"id":"ed685ba8.78f468","type":"debug","z":"56a9ddfc.0001f4","name":"Devices","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":3600,"y":1780,"wires":[]},{"id":"6515ee56.e8bbb","type":"switch","z":"56a9ddfc.0001f4","name":"Motion","property":"endpoint","propertyType":"msg","rules":[{"t":"eq","v":"motion","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":3010,"y":1900,"wires":[["eb88fcc7.fe913"]]},{"id":"eb88fcc7.fe913","type":"function","z":"56a9ddfc.0001f4","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":3270,"y":1900,"wires":[["ebecd6ca.f71978","ca64ff94.37462"]]},{"id":"ebecd6ca.f71978","type":"debug","z":"56a9ddfc.0001f4","name":"Motion","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":3590,"y":1900,"wires":[]},{"id":"ca64ff94.37462","type":"change","z":"56a9ddfc.0001f4","name":"motion","rules":[{"t":"set","p":"motion","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":3350,"y":1860,"wires":[[]]},{"id":"5f661afe.7ce084","type":"inject","z":"56a9ddfc.0001f4","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":2130,"y":1900,"wires":[["1adff996.f43ed6"]]},{"id":"a6af15b0.378138","type":"inject","z":"56a9ddfc.0001f4","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":2130,"y":1860,"wires":[["1adff996.f43ed6"]]},{"id":"77339fcc.c76a8","type":"switch","z":"56a9ddfc.0001f4","name":"Button","property":"endpoint","propertyType":"msg","rules":[{"t":"eq","v":"button","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":3010,"y":2000,"wires":[["e95d779a.615128"]]},{"id":"e17c6a61.df9538","type":"inject","z":"56a9ddfc.0001f4","name":"Lights (seperately)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"split","payload":"lights","payloadType":"flow","x":2150,"y":1220,"wires":[["1adff996.f43ed6"]]},{"id":"c50458a6.d2c7c8","type":"inject","z":"56a9ddfc.0001f4","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":2160,"y":1180,"wires":[["1adff996.f43ed6"]]},{"id":"e95d779a.615128","type":"function","z":"56a9ddfc.0001f4","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":3270,"y":2000,"wires":[["20712c19.2fb934","34885ffc.14396"]]},{"id":"20712c19.2fb934","type":"change","z":"56a9ddfc.0001f4","name":"button","rules":[{"t":"set","p":"button","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":3350,"y":1960,"wires":[[]]},{"id":"34885ffc.14396","type":"debug","z":"56a9ddfc.0001f4","name":"Button","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":3590,"y":2000,"wires":[]},{"id":"9843e319.dcf13","type":"link out","z":"56a9ddfc.0001f4","name":"API Wohnung HTTP response ","links":["473a4cdc.593674"],"x":2775,"y":2060,"wires":[]},{"id":"c0ea44d8.8272a8","type":"link in","z":"56a9ddfc.0001f4","name":"Timer IN","links":["c639e802.9a6c78"],"x":2775,"y":1920,"wires":[[]]},{"id":"7d85ebf.dbd1d14","type":"comment","z":"56a9ddfc.0001f4","name":"connect to \"https request HUE API V2\" (light green node)","info":"","x":2530,"y":2060,"wires":[]},{"id":"aff276d1.d02bd8","type":"comment","z":"56a9ddfc.0001f4","name":"connect to \"HUE API V2\" (orange node)","info":"","x":2590,"y":1920,"wires":[]},{"id":"c3a2bcd7.4dde4","type":"comment","z":"56a9ddfc.0001f4","name":"2 - Readme - DOUBLE CLICK","info":"After you got all Data stored, you can easily access it here again, by clicking the inject nodes.\n\nDepending on your favorite way to do it, you can get an array in response or seperate payloads for every device. \n\nTry it out!","x":2220,"y":1140,"wires":[]},{"id":"3ae04357.a572ec","type":"comment","z":"56a9ddfc.0001f4","name":"DONT CHANGE ANY OF THESE NODES","info":"","x":3060,"y":1480,"wires":[]}] 2 | --------------------------------------------------------------------------------