├── .github ├── FUNDING.yml └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── CODE_OF_CONDUCT.md ├── HUE-CLIP-API_Node-Red-Flows.json ├── LICENSE.md ├── README.md └── flows ├── Change Node Examples.json ├── SSE_Event_Stream.json ├── Sub-Flows.json ├── V2_HUE-CLIP-API_Node-Red-Flows_Fred.Blo.json ├── array_splitter.json ├── basic_toggle_function_example ├── battery_status.json ├── get_state.json ├── gradient_stripe.json ├── header_v2.json ├── helper_functions_flow_2v.json ├── hue_effects.json ├── motion_sensor_behavior.json ├── motion_sensor_update.json ├── power_state.json └── scene_active.json /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: paypal.me/andesse 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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | As using almost only built-in NodeRed nodes, this repository has one small dependence. It is Yadomi's contrib philipshue-events or the contrib-sse, depending on the setup you prefer. 9 | 10 | https://github.com/yadomi/node-red-contrib-philipshue-events 11 | 12 | ### change! instead of using the yadomi contrib, use the approach with the "sse-event-stream" all infos below. This works flawless for me without any issues for more than a year now 13 | (Before importing this flow, it is important to install yadomi's contrib previously. Do not deploy without, this might Node-RED to stop the flows.) 14 | 15 | ——————————————— 16 | 17 | ### Installation Instructions: 18 | - Install "@yadomi/node-red-contrib-philipshue-events" in NodeRed 19 | - Import the Data from the :arrow_right: **HUE-CLIP-API_Node-Red-Flows.json** :arrow_left: into a new Flow Tab, deploy 20 | - In the flow are labels with **step1-step7**, follow step-by-step 21 | - **step1** generate a username for this flow in the Bridge, first add the Bridge IP in the labeled node, deploy. 22 | Press the button on your Bridge. Inject the Request Node, the debug window will show the username 23 | - **step2** Configure the hue-events node with your IP and just discovered username 24 | - **step3** add the same data into the HEADER V2 node, deploy 25 | - **step4** Inject the "Request all Data" node. This process will take a couple of seconds, the Data will be stored in context (memory) 26 | - **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 27 | - **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. 28 | 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. 29 | - **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. 30 | 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. 31 | - Done! You can now start to create your setup. 32 | 33 | - 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. 34 | 35 | https://github.com/andesse/hue-clip-api.node-red-flows/blob/main/HUE-CLIP-API_Node-Red-Flows.json 36 | 37 | ### Recomendations / Informations: 38 | - Do it room-by-room 39 | - Build the whole HUE-setup in a single Flow-Tab, use link-in / link-out nodes to connect it to your Rooms 40 | - Label those link-in / link-out nodes, otherwise it will be too confusing 41 | - Trigger scenes and not single lights, too much requests at once will be refused by the bridge 42 | 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) 43 | - additional flows are in the "flows" folder in this repository and can be downloaded there 44 | - 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. 45 | - For a full API Documentation you could create an Account at: https://developers.meethue.com/ 46 | 47 | ### 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. 48 | 49 | If you need help, start a discussion and when you are pleased with this repository, click donate and buy me a coffee :) Thanks 50 | 51 | ### Shoutout to everyone who participated with great ideas, code, and/or additional flows, that made this repository even better, Thank you! Credits below 52 | 53 | Main Flow (HUE-CLIP-API_Node-Red-Flows.json): 54 | ------------ 55 | ![HUE-CLIP-API_Node-Red-Flows_json](https://user-images.githubusercontent.com/76150626/188687612-092979bd-2711-4c24-9345-51c438d5056e.JPG) 56 | 57 | ______________ 58 | 59 | ## Version 5.3.2 Update 60 | 61 | **NEW:** Battery Status Subflow 62 | 63 | I created a subflow Node and made some changes at the Helper Flow, its now easy to determine the battery levels, 64 | and also to output Device Name + Battery status if the level falls under a specified value. 65 | 66 | You will find the file battery_status.json in the flows section for download. Or use this link: 67 | https://github.com/andesse/HUE-CLIP-API.Node-RED-Flows/blob/main/flows/battery_status.json 68 | 69 | All necessary infos are included in the file as comments. 70 | Please read the Instructions at top left first. 71 | 72 | ![IMG_8187](https://github.com/user-attachments/assets/620c8ae5-8359-45aa-814a-6f1b05cb23a3) 73 | 74 | ![IMG_8186](https://github.com/user-attachments/assets/49d03ee6-3803-4564-b97e-0f12397a4876) 75 | 76 | ______________ 77 | 78 | ## Version 5.3.1 Update 79 | 80 | I just discovered that it is possible to determine which scene is turned on in the eventstream. 81 | 82 | A new subflow is added in the flows folder: flows/scene_active.json 83 | Simply add the discovered scene ID and it gives you a true when the scene is turned on. 84 | This might be useful in some scenarios. 85 | 86 | 87 | ![IMG_1205](https://github.com/andesse/HUE-CLIP-API.Node-RED-Flows/assets/76150626/f23223ff-66f1-431d-92ae-e2b47450ee20) 88 | 89 | 90 | 91 | Version 5.3 92 | --- 93 | I made an all-in-one Subflow for: Candle, Fire, Alarm Light, Alarm Group, dynamic Scene effects. It is pretty convenient to use. 94 | It should work out of the box immediatly. You just need to add the ID in the subflow when you double click it. 95 | There are some description in the Flow as usual. You can find the file un the flows subfolder. hue_effects.json 96 | https://github.com/andesse/hue-clip-api.node-red-flows/blob/main/flows/hue_effects.json 97 | 98 | Edit: normal scene added as well, not shown in the picture 99 | 100 | ![IMG_2784](https://user-images.githubusercontent.com/76150626/193901650-85ff3179-56eb-4592-bac2-22e159ec6b52.jpeg) 101 | 102 | 103 | ——————————————— 104 | 105 | Version 5.2 106 | --- 107 | 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 108 | 109 | ![IMG_2773](https://user-images.githubusercontent.com/76150626/193459271-a1f7a9e7-c947-45e1-8981-3fce228231dc.jpeg) 110 | 111 | 112 | 113 | Version 5.1 114 | --- 115 | - one file added into the flows subfolder >>> motion_sensor_update.json 116 | - the updated flow for the motion endpoint receivers has a benefit, you can see the sensor state (enabled/disabled). 117 | - this is just nice to have, try it and decide if its useful for your setup. 118 | 119 | ![IMG_2726](https://user-images.githubusercontent.com/76150626/192052817-32535569-39c1-4c79-b8f9-2dbc019ca83b.jpeg) 120 | 121 | 122 | Version 5.0 123 | --- 124 | 125 | - Merged the V2 approach from FredBlo with the original flow 126 | - Complete update of the readme, with easy installation instructions 127 | - Array Splitter function node from FredBlo 128 | 129 | ### Another change is coming with upcoming Bridge Firmware, read below. (this is important for everyone already using the flow) 130 | 131 | HUE changed the Event-Flow output for groups in the API with a new Beta Firmware. I got the beta release 1.53.1953188010 132 | 133 | Instead of sending payloads for every light/group seperately they changed it into a payload with one big array. 134 | 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. 135 | Everything else seem to work like before. 136 | 137 | The array splitter is set in between your event node (SSE or Yadomi) and the output is connected to the receivers. 138 | https://github.com/andesse/hue-clip-api.node-red-flows/blob/main/flows/array_splitter.json 139 | 140 | 141 | Array Splitter separately: 142 | ----------- 143 | ![array_splitter](https://user-images.githubusercontent.com/76150626/188687682-3bceea2c-4d40-495e-9eed-42d041415508.JPG) 144 | 145 | 146 | 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. 147 | >ALWAYS BACKUP YOUR OLD FLOW BEFORE, TO AVOID DOUBLE EFFORT IF YOU HAVE AN ISSUE! 148 | 149 | ----------------------------------------------------------- 150 | 151 | Action Change Nodes: 152 | --- 153 | ![IMG_2723](https://user-images.githubusercontent.com/76150626/192001918-178e9a6e-8075-4a92-9e0d-f6bfe5792d95.jpeg) 154 | 155 | ----------------------------------------------------------- 156 | 157 | Helper Functions for RID / ID discovery (concept by user marc-gist - THANKS!) 158 | --- 159 | ![helper_functions_flow_v2](https://user-images.githubusercontent.com/76150626/174495416-dbb394b5-c012-482c-a119-eb16cd073171.PNG) 160 | 161 | 162 | SSE_Event_Stream: 163 | --- 164 | 165 | ![IMG_2261](https://user-images.githubusercontent.com/76150626/176202424-8f7e53db-bb9a-41aa-8ce4-c71f1b153fa5.jpeg) 166 | 167 | 168 | credits and thanks to: 169 | --- 170 | - ralfhille (first concept idea) 171 | - yadomi (hue-events contrib) 172 | - marc-gist (helper flow, to determine the ID/RID in a convenient way) 173 | - FredBlo (new approach, with a lot of functional improvements for the flow) 174 | 175 | Sponsor Link, buy me a coffee :) 176 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /flows/hue_effects.json: -------------------------------------------------------------------------------- 1 | [{"id":"0b11cc70275b33e9","type":"subflow","name":"HUE Effects","info":"","category":"","in":[{"x":80,"y":540,"wires":[{"id":"0caf317d93739774"}]}],"out":[{"x":920,"y":540,"wires":[{"id":"c52b5ecdf9fe6f2b","port":0},{"id":"deef39d98c46e97c","port":0},{"id":"3610563cbd918126","port":0},{"id":"c863317aef45878a","port":0},{"id":"473bdb73300fe567","port":0},{"id":"1474ea8a60d6f545","port":0},{"id":"81bede6e683a0715","port":0},{"id":"a03379a9ee3033ae","port":0},{"id":"410735b64703d92a","port":0},{"id":"7f3a4813c0bd4787","port":0},{"id":"992e13d9b41e1091","port":0}]}],"env":[{"name":"light_ID","type":"str","value":"add your light ID here"},{"name":"grouped_light_ID","type":"str","value":"add your grouped_light ID here"},{"name":"scene_ID","type":"str","value":"add your scene ID here"}],"meta":{},"color":"#3FADB5","icon":"node-red/status.svg","status":{"x":640,"y":240,"wires":[{"id":"d69f68219d838b03","port":0},{"id":"b1aba1a3fc063ec3","port":0},{"id":"0cca8bc26b3a9c77","port":0},{"id":"b32881f01c738db5","port":0},{"id":"383dfc4c0d53a80a","port":0},{"id":"b5896e14c4832b97","port":0},{"id":"546c46e8a257bb34","port":0},{"id":"5519f31153961848","port":0}]}},{"id":"0caf317d93739774","type":"switch","z":"0b11cc70275b33e9","name":"","property":"topic","propertyType":"msg","rules":[{"t":"else"},{"t":"eq","v":"group_alarm","vt":"str"},{"t":"eq","v":"dynamic","vt":"str"},{"t":"eq","v":"scene","vt":"str"},{"t":"eq","v":"alarm","vt":"str"},{"t":"eq","v":"fire","vt":"str"},{"t":"eq","v":"candle","vt":"str"},{"t":"eq","v":"effect_off","vt":"str"}],"checkall":"true","repair":false,"outputs":8,"x":190,"y":540,"wires":[["110bf511c660213d"],["383dfc4c0d53a80a","c863317aef45878a","e25ec0e72a8d2c51"],["7f3a4813c0bd4787","546c46e8a257bb34"],["992e13d9b41e1091","5519f31153961848"],["473bdb73300fe567","b32881f01c738db5","6d148f8832e6129c","ddfd96b92dd870d1"],["deef39d98c46e97c","d69f68219d838b03","6d148f8832e6129c"],["0cca8bc26b3a9c77","6d148f8832e6129c","c52b5ecdf9fe6f2b"],["3610563cbd918126","b1aba1a3fc063ec3","d870cfa25a9ac2d0","6d148f8832e6129c","a3fcf4bd75d37883"]]},{"id":"c52b5ecdf9fe6f2b","type":"change","z":"0b11cc70275b33e9","name":"Candle 20%","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"light_ID","tot":"env"},{"t":"set","p":"payload","pt":"msg","to":"{\"on\":{\"on\":true},\"dimming\":{\"brightness\":20},\"effects\":{\"effect\":\"candle\"}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":560,"wires":[[]]},{"id":"deef39d98c46e97c","type":"change","z":"0b11cc70275b33e9","name":"Fire 70%","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"light_ID","tot":"env"},{"t":"set","p":"payload","pt":"msg","to":"{\"on\":{\"on\":true},\"dimming\":{\"brightness\":70},\"effects\":{\"effect\":\"fire\"}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":520,"wires":[[]]},{"id":"3610563cbd918126","type":"change","z":"0b11cc70275b33e9","name":"Effects off","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"light_ID","tot":"env"},{"t":"set","p":"payload","pt":"msg","to":"{\"on\":{\"on\":true},\"dimming\":{\"brightness\":30},\"effects\":{\"effect\":\"no_effect\"}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":600,"wires":[[]]},{"id":"66853ce22b64a266","type":"change","z":"0b11cc70275b33e9","name":"light_on","rules":[{"t":"set","p":"light_on","pt":"flow","to":"payload.data.0.on.on","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":80,"wires":[[]]},{"id":"840b5844c8fd3bda","type":"change","z":"0b11cc70275b33e9","name":"light_temp","rules":[{"t":"set","p":"light_temp","pt":"flow","to":"payload.data.0.color_temperature.mirek","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":910,"y":160,"wires":[[]]},{"id":"728612b935b47d4d","type":"change","z":"0b11cc70275b33e9","name":"light_y","rules":[{"t":"set","p":"light_y","pt":"flow","to":"payload.data.0.color.xy.y","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":890,"y":240,"wires":[[]]},{"id":"2504f68f545674c2","type":"change","z":"0b11cc70275b33e9","name":"light_bright","rules":[{"t":"set","p":"light_bright","pt":"flow","to":"payload.data.0.dimming.brightness","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":910,"y":120,"wires":[[]]},{"id":"d69f68219d838b03","type":"change","z":"0b11cc70275b33e9","name":"fire","rules":[{"t":"set","p":"payload","pt":"msg","to":"fire","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":435,"y":240,"wires":[[]],"l":false},{"id":"b1aba1a3fc063ec3","type":"change","z":"0b11cc70275b33e9","name":"off","rules":[{"t":"set","p":"payload","pt":"msg","to":"effect off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":435,"y":240,"wires":[[]],"l":false},{"id":"0cca8bc26b3a9c77","type":"change","z":"0b11cc70275b33e9","name":"candle","rules":[{"t":"set","p":"payload","pt":"msg","to":"candle","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":435,"y":240,"wires":[[]],"l":false},{"id":"eec77edc93ef8c0a","type":"change","z":"0b11cc70275b33e9","name":"light_x","rules":[{"t":"set","p":"light_x","pt":"flow","to":"payload.data.0.color.xy.x","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":890,"y":200,"wires":[[]]},{"id":"b6feb1c93ab3470f","type":"function","z":"0b11cc70275b33e9","name":"block","func":"//variable block\nlet alarm = {\n block: flow.get(\"block\"),\n}\n// pass payload\nif (\n alarm.block === false\n )\n{\n return msg; \n} ","outputs":1,"noerr":0,"initialize":"// Der Code hier wird ausgeführt,\n// wenn der Node gestartet wird\nif (flow.get(\"block\") == null) flow.set(\"block\", false);","finalize":"","libs":[],"x":610,"y":180,"wires":[["66853ce22b64a266","728612b935b47d4d","2504f68f545674c2","eec77edc93ef8c0a","840b5844c8fd3bda","d7b6cbaa86b0c720"]]},{"id":"473bdb73300fe567","type":"change","z":"0b11cc70275b33e9","name":"Alarm ","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"light_ID","tot":"env"},{"t":"set","p":"payload","pt":"msg","to":"{\"on\":{\"on\":true},\"dimming\":{\"brightness\":100},\"color\":{\"xy\":{\"x\":0.6681,\"y\":0.3258}},\"alert\":{\"action\":\"breathe\"}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":480,"wires":[[]]},{"id":"110bf511c660213d","type":"switch","z":"0b11cc70275b33e9","name":"Light ID","property":"payload.data.0.id","propertyType":"msg","rules":[{"t":"cont","v":"light_ID","vt":"env"}],"checkall":"true","repair":false,"outputs":1,"x":380,"y":180,"wires":[["b6feb1c93ab3470f"]]},{"id":"c863317aef45878a","type":"change","z":"0b11cc70275b33e9","name":"Group Alarm ","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"grouped_light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"grouped_light_ID","tot":"env"},{"t":"set","p":"payload","pt":"msg","to":"{\"on\":{\"on\":true},\"dimming\":{\"brightness\":100},\"color\":{\"xy\":{\"x\":0.6681,\"y\":0.3258}},\"alert\":{\"action\":\"breathe\",\"duration\":5000}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":280,"wires":[[]]},{"id":"b32881f01c738db5","type":"change","z":"0b11cc70275b33e9","name":"alarm","rules":[{"t":"set","p":"payload","pt":"msg","to":"alarm","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":435,"y":240,"wires":[[]],"l":false},{"id":"1474ea8a60d6f545","type":"change","z":"0b11cc70275b33e9","name":"restore_color","rules":[{"t":"move","p":"payload","pt":"msg","to":"payload.on.on","tot":"msg"},{"t":"move","p":"payload","pt":"msg","to":"payload.dimming.brightness","tot":"msg"},{"t":"move","p":"payload","pt":"msg","to":"payload.color.xy.x","tot":"msg"},{"t":"move","p":"payload","pt":"msg","to":"payload.color.xy.y","tot":"msg"},{"t":"move","p":"payload","pt":"msg","to":"payload.dynamics.duration","tot":"msg"},{"t":"set","p":"payload.on.on","pt":"msg","to":"light_on","tot":"flow"},{"t":"set","p":"payload.dimming.brightness","pt":"msg","to":"light_bright","tot":"flow"},{"t":"set","p":"payload.color.xy.x","pt":"msg","to":"light_x","tot":"flow"},{"t":"set","p":"payload.color.xy.y","pt":"msg","to":"light_y","tot":"flow"},{"t":"set","p":"payload.dynamics.duration","pt":"msg","to":"2500","tot":"num"},{"t":"set","p":"topic","pt":"msg","to":"light_ID","tot":"env"},{"t":"set","p":"endpoint","pt":"msg","to":"light","tot":"str"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":700,"wires":[[]]},{"id":"d870cfa25a9ac2d0","type":"delay","z":"0b11cc70275b33e9","name":"2sek","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":370,"y":780,"wires":[["4e81474996a57a85"]]},{"id":"744eaa409587fc9a","type":"change","z":"0b11cc70275b33e9","name":"block","rules":[{"t":"set","p":"block","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":820,"wires":[[]]},{"id":"6d148f8832e6129c","type":"change","z":"0b11cc70275b33e9","name":"true","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":860,"wires":[["744eaa409587fc9a"]]},{"id":"4e81474996a57a85","type":"change","z":"0b11cc70275b33e9","name":"false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":820,"wires":[["744eaa409587fc9a"]]},{"id":"383dfc4c0d53a80a","type":"change","z":"0b11cc70275b33e9","name":"alarm","rules":[{"t":"set","p":"payload","pt":"msg","to":"group_alarm","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":435,"y":240,"wires":[[]],"l":false},{"id":"81bede6e683a0715","type":"change","z":"0b11cc70275b33e9","name":"restore_mirek","rules":[{"t":"move","p":"payload","pt":"msg","to":"payload.on.on","tot":"msg"},{"t":"move","p":"payload","pt":"msg","to":"payload.dimming.brightness","tot":"msg"},{"t":"move","p":"payload","pt":"msg","to":"payload.color_temperature.mirek","tot":"msg"},{"t":"move","p":"payload","pt":"msg","to":"payload.color.xy.x","tot":"msg"},{"t":"move","p":"payload","pt":"msg","to":"payload.color.xy.y","tot":"msg"},{"t":"move","p":"payload","pt":"msg","to":"payload.dynamics.duration","tot":"msg"},{"t":"set","p":"payload.on.on","pt":"msg","to":"light_on","tot":"flow"},{"t":"set","p":"payload.dimming.brightness","pt":"msg","to":"light_bright","tot":"flow"},{"t":"set","p":"payload.color_temperature.mirek","pt":"msg","to":"light_temp","tot":"flow"},{"t":"set","p":"payload.color.xy.x","pt":"msg","to":"light_x","tot":"flow"},{"t":"set","p":"payload.color.xy.y","pt":"msg","to":"light_y","tot":"flow"},{"t":"set","p":"payload.dynamics.duration","pt":"msg","to":"2500","tot":"num"},{"t":"set","p":"topic","pt":"msg","to":"light_ID","tot":"env"},{"t":"set","p":"endpoint","pt":"msg","to":"light","tot":"str"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":660,"wires":[[]]},{"id":"b5896e14c4832b97","type":"change","z":"0b11cc70275b33e9","name":"sunrise","rules":[{"t":"set","p":"payload","pt":"msg","to":"sunrise","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":435,"y":240,"wires":[[]],"l":false},{"id":"d7b6cbaa86b0c720","type":"change","z":"0b11cc70275b33e9","name":"light_mirek","rules":[{"t":"set","p":"light_mirek","pt":"flow","to":"payload.data.0.color_temperature.mirek_valid","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":910,"y":280,"wires":[[]]},{"id":"a3fcf4bd75d37883","type":"function","z":"0b11cc70275b33e9","name":"mirek valid?","func":"//variable block\nlet valid = {\n mirek: flow.get(\"light_mirek\"),\n}\n// pass payload\nif (\n valid.mirek === true\n )\n{\n return [msg, null]\n} \nif (\n valid.mirek === false\n )\n{\n return [null, msg]\n}","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":455,"y":680,"wires":[["81bede6e683a0715"],["1474ea8a60d6f545"]],"l":false},{"id":"a03379a9ee3033ae","type":"change","z":"0b11cc70275b33e9","name":"Off","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"grouped_light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"grouped_light_ID","tot":"env"},{"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":610,"y":320,"wires":[[]]},{"id":"e25ec0e72a8d2c51","type":"delay","z":"0b11cc70275b33e9","name":"15sec","pauseType":"delay","timeout":"15100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":525,"y":320,"wires":[["a03379a9ee3033ae"]],"l":false},{"id":"ddfd96b92dd870d1","type":"delay","z":"0b11cc70275b33e9","name":"15sec","pauseType":"delay","timeout":"15100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":405,"y":720,"wires":[["410735b64703d92a","4a60db64205c4b6c","d870cfa25a9ac2d0"]],"l":false},{"id":"4a60db64205c4b6c","type":"delay","z":"0b11cc70275b33e9","name":"800ms","pauseType":"delay","timeout":"800","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":405,"y":680,"wires":[["a3fcf4bd75d37883"]],"l":false},{"id":"410735b64703d92a","type":"change","z":"0b11cc70275b33e9","name":"Off","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"light_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":610,"y":760,"wires":[[]]},{"id":"7f3a4813c0bd4787","type":"change","z":"0b11cc70275b33e9","name":"Dynamic Scene","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"scene","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"scene_ID","tot":"env"},{"t":"set","p":"payload","pt":"msg","to":"{\"recall\":{\"action\":\"dynamic_palette\"},\"speed\":0.6}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":380,"wires":[[]],"icon":"font-awesome/fa-star"},{"id":"efd7efbf9df6212b","type":"comment","z":"0b11cc70275b33e9","name":"You can change the speed (0.1 - 1)","info":"","x":800,"y":380,"wires":[]},{"id":"123b86e0fa83918e","type":"comment","z":"0b11cc70275b33e9","name":"You can adjust brightness ","info":"","x":770,"y":540,"wires":[]},{"id":"546c46e8a257bb34","type":"change","z":"0b11cc70275b33e9","name":"dynamic","rules":[{"t":"set","p":"payload","pt":"msg","to":"dynamic scene","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":435,"y":240,"wires":[[]],"l":false},{"id":"992e13d9b41e1091","type":"change","z":"0b11cc70275b33e9","name":"Scene","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"scene","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"scene_ID","tot":"env"},{"t":"set","p":"payload","pt":"msg","to":"{\"recall\":{\"action\":\"active\",\"duration\":1000}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":420,"wires":[[]],"icon":"font-awesome/fa-star"},{"id":"5519f31153961848","type":"change","z":"0b11cc70275b33e9","name":"dynamic","rules":[{"t":"set","p":"payload","pt":"msg","to":"scene","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":435,"y":240,"wires":[[]],"l":false},{"id":"a0a1eb1ff08e309e","type":"tab","label":"HUE EFFECTS","disabled":false,"info":"","env":[]},{"id":"a4c6b23c81a127c9","type":"subflow:0b11cc70275b33e9","z":"a0a1eb1ff08e309e","name":"","env":[{"name":"light_ID","value":"Add light ID here","type":"str"},{"name":"grouped_light_ID","value":"Add group ID here","type":"str"},{"name":"scene_ID","value":"Add scene ID here","type":"str"}],"x":670,"y":320,"wires":[["92a831c1811ec20d"]]},{"id":"a2b80f604603c755","type":"inject","z":"a0a1eb1ff08e309e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"alarm","payload":"light endpoint","payloadType":"str","x":390,"y":220,"wires":[["a4c6b23c81a127c9"]]},{"id":"999666c47ec4fd28","type":"inject","z":"a0a1eb1ff08e309e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"group_alarm","payload":"group endpoint","payloadType":"str","x":360,"y":380,"wires":[["a4c6b23c81a127c9"]]},{"id":"aefc5ad9e324992b","type":"inject","z":"a0a1eb1ff08e309e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"dynamic","payload":"scene endpoint","payloadType":"str","x":370,"y":440,"wires":[["a4c6b23c81a127c9"]]},{"id":"37abe45f8a045f3a","type":"inject","z":"a0a1eb1ff08e309e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"effect_off","payload":"light endpoint","payloadType":"str","x":380,"y":260,"wires":[["a4c6b23c81a127c9"]]},{"id":"c223a8d51035fadb","type":"inject","z":"a0a1eb1ff08e309e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"fire","payload":"light endpoint","payloadType":"str","x":400,"y":180,"wires":[["a4c6b23c81a127c9"]]},{"id":"07524a0df6ed696a","type":"inject","z":"a0a1eb1ff08e309e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"candle","payload":"light endpoint","payloadType":"str","x":380,"y":140,"wires":[["a4c6b23c81a127c9"]]},{"id":"d5e012e0c6e1e0fd","type":"link in","z":"a0a1eb1ff08e309e","name":"to Event-Stream","links":["b8d7915d.ac729"],"x":400,"y":320,"wires":[["a4c6b23c81a127c9"]],"l":true},{"id":"92a831c1811ec20d","type":"link out","z":"a0a1eb1ff08e309e","name":"to Header (http-request)","mode":"link","links":["2befa94bc2465a71"],"x":870,"y":320,"wires":[],"l":true},{"id":"7b6bcbe007e69973","type":"comment","z":"a0a1eb1ff08e309e","name":"DESCRIPTION - DOUBLE CLICK","info":"This is a subflow for all the effects available\nat the moment. \n\nLight_Endpoints:\n-Candle\n-Fire\n-Alarm\n\nGrouped_Light Endpoints\n-Alarm\n\nScene_Endpoints\n-Dynamic Scenes\n-Scene\n\nStatus shown under the node. ","x":790,"y":200,"wires":[]},{"id":"6fa7c542c31f7a57","type":"comment","z":"a0a1eb1ff08e309e","name":"DOCUMENTATION - DOUBLE CLICK ","info":"Add Light/Group/Scene ID directly in the \nSubflow. \n\nThis works with topics, just try it out with\nthe Inject-Nodes.\n\ncandle:\nCreates a Candle Effect, effect_off will\nset it to previous state. You can adjust\nthe brightness in the subflow. \n\nfire:\nCreates a Fire Effect, effect_off will\nset it to previous state. You can adjust \nthe brightness in the subflow.\n\nalarm:\n15 Second Red-Alert for a single Light.\nAfter that it will return to the \nprevious state.\n\neffect_off:\nIt will stop the effect for Candle and Fire.\nThese two need to be stopped. \n\ngroup_alarm:\n15 Second Red-Alert for a whole Room or\nZone. After that the light will turn off.\n\ndynamic:\nStarts a dynamic scene. The colors will \nchange dynamically from your scene palette.\nIt can be turned off when another scene is \ntriggered or the room is turned off.\nWorks just with real HUE lights, 3rd party\ncontroller and lights seem to have a \nproblem with it (no reaction)\n\nscene:\njust triggers a scene, 1sec transition\n\n\nATTENTION:\nI figured out in my own system, that this is \nworking properly with last generation \nHUE Lights. Older lamps or 3rd party \nLED-Driver are not properly alerting, or using\ndynamic scenes, etc. Try it out. \n","x":790,"y":260,"wires":[]},{"id":"9dade506ad6f69bc","type":"function","z":"a0a1eb1ff08e309e","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":250,"y":320,"wires":[[]]},{"id":"239aedc951d34446","type":"comment","z":"a0a1eb1ff08e309e","name":"DOUBLE CLICK","info":"Connect it to the array-splitter.\nIf it is not working, use the splitter in this\nflow ADDITIONALLY to the one you use. \nThis is used just for the effect flow, or \nyou need to adjust the payload paths in the nodes\nthat are in the subflow. Debug it;)\nBut it should pretty much work out of the box. ","x":320,"y":300,"wires":[]},{"id":"fa3babadb746827b","type":"comment","z":"a0a1eb1ff08e309e","name":"======[ ALL IN ONE HUE EFFECT SUBFLOW ]======","info":"","x":790,"y":140,"wires":[]},{"id":"8afcd11c0584b045","type":"inject","z":"a0a1eb1ff08e309e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"scene","payload":"scene endpoint","payloadType":"str","x":380,"y":500,"wires":[["a4c6b23c81a127c9"]]}] 2 | -------------------------------------------------------------------------------- /flows/motion_sensor_behavior.json: -------------------------------------------------------------------------------- 1 | [{"id":"2f013cac.bbb514","type":"subflow","name":"Motion Sensor Logic","info":"","category":"HUE v2","in":[{"x":400,"y":360,"wires":[{"id":"b39cf1d4.20897"}]}],"out":[{"x":1180,"y":200,"wires":[{"id":"ead089f1.2f4ea8","port":0}]},{"x":1180,"y":240,"wires":[{"id":"ead089f1.2f4ea8","port":1}]},{"x":1180,"y":300,"wires":[{"id":"79f32db.6f9b2d4","port":0}]},{"x":1180,"y":340,"wires":[{"id":"79f32db.6f9b2d4","port":1}]},{"x":1180,"y":420,"wires":[{"id":"4daacf0.3530a3","port":0}]}],"env":[],"meta":{},"color":"#A6BBCF","icon":"node-red/light.svg"},{"id":"2591be76.7863f2","type":"switch","z":"2f013cac.bbb514","name":"","property":"payload","propertyType":"msg","rules":[{"t":"false"},{"t":"true"}],"checkall":"true","repair":false,"outputs":2,"x":710,"y":360,"wires":[["2debf3c6.275bbc"],["ead089f1.2f4ea8","5eac6333.d048bc"]]},{"id":"ead089f1.2f4ea8","type":"within-time-switch","z":"2f013cac.bbb514","name":"Time","nameInt":"","positionConfig":"d4cbc419.0d40e8","startTime":"07:00","startTimeType":"entered","startOffset":0,"startOffsetType":"none","startOffsetMultiplier":60000,"endTime":"22:00","endTimeType":"entered","endOffset":0,"endOffsetType":"none","endOffsetMultiplier":60000,"timeRestrictions":0,"timeRestrictionsType":"none","timeDays":"*","timeOnlyOddDays":false,"timeOnlyEvenDays":false,"timeOnlyOddWeeks":false,"timeOnlyEvenWeeks":false,"timeMonths":"*","timedatestart":"","timedateend":"","propertyStart":"","propertyStartType":"none","propertyStartCompare":"true","propertyStartThreshold":"","propertyStartThresholdType":"num","startTimeAlt":"","startTimeAltType":"entered","startOffsetAlt":0,"startOffsetAltType":"none","startOffsetAltMultiplier":60000,"propertyEnd":"","propertyEndType":"none","propertyEndCompare":"true","propertyEndThreshold":"","propertyEndThresholdType":"num","endTimeAlt":"","endTimeAltType":"entered","endOffsetAlt":0,"endOffsetAltType":"none","endOffsetAltMultiplier":60000,"withinTimeValue":"","withinTimeValueType":"msgInput","outOfTimeValue":"","outOfTimeValueType":"msgInput","tsCompare":"0","x":910,"y":240,"wires":[[],[]]},{"id":"2debf3c6.275bbc","type":"delay","z":"2f013cac.bbb514","name":"25sek","pauseType":"delay","timeout":"25","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":910,"y":360,"wires":[["4daacf0.3530a3","79f32db.6f9b2d4"]]},{"id":"5eac6333.d048bc","type":"change","z":"2f013cac.bbb514","name":"reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":420,"wires":[["2debf3c6.275bbc","4daacf0.3530a3"]]},{"id":"4daacf0.3530a3","type":"delay","z":"2f013cac.bbb514","name":"7sek","pauseType":"delay","timeout":"7","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":910,"y":420,"wires":[[]]},{"id":"b39cf1d4.20897","type":"switch","z":"2f013cac.bbb514","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"trigger","vt":"str"},{"t":"else"},{"t":"eq","v":"reset","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":510,"y":360,"wires":[["bc1312c8.026aa"],["12c2b6ec70fa576f"],["5eac6333.d048bc","5327e2b2.7c8aac"]]},{"id":"79f32db.6f9b2d4","type":"within-time-switch","z":"2f013cac.bbb514","name":"Time","nameInt":"","positionConfig":"d4cbc419.0d40e8","startTime":"07:00","startTimeType":"entered","startOffset":0,"startOffsetType":"none","startOffsetMultiplier":60000,"endTime":"22:00","endTimeType":"entered","endOffset":0,"endOffsetType":"none","endOffsetMultiplier":60000,"timeRestrictions":0,"timeRestrictionsType":"none","timeDays":"*","timeOnlyOddDays":false,"timeOnlyEvenDays":false,"timeOnlyOddWeeks":false,"timeOnlyEvenWeeks":false,"timeMonths":"*","timedatestart":"","timedateend":"","propertyStart":"","propertyStartType":"none","propertyStartCompare":"true","propertyStartThreshold":"","propertyStartThresholdType":"num","startTimeAlt":"","startTimeAltType":"entered","startOffsetAlt":0,"startOffsetAltType":"none","startOffsetAltMultiplier":60000,"propertyEnd":"","propertyEndType":"none","propertyEndCompare":"true","propertyEndThreshold":"","propertyEndThresholdType":"num","endTimeAlt":"","endTimeAltType":"entered","endOffsetAlt":0,"endOffsetAltType":"none","endOffsetAltMultiplier":60000,"withinTimeValue":"","withinTimeValueType":"msgInput","outOfTimeValue":"","outOfTimeValueType":"msgInput","tsCompare":"0","x":910,"y":300,"wires":[[],[]]},{"id":"5327e2b2.7c8aac","type":"delay","z":"2f013cac.bbb514","name":"2sek","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":510,"y":420,"wires":[["5eac6333.d048bc"]]},{"id":"bc1312c8.026aa","type":"switch","z":"2f013cac.bbb514","name":"","property":"payload","propertyType":"msg","rules":[{"t":"false"},{"t":"true"}],"checkall":"true","repair":false,"outputs":2,"x":510,"y":300,"wires":[["8cdfb2c8.498a5"],["f2e74c75a84c7282"]]},{"id":"8cdfb2c8.498a5","type":"delay","z":"2f013cac.bbb514","name":"2sek","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":510,"y":240,"wires":[["f2e74c75a84c7282"]]},{"id":"f2e74c75a84c7282","type":"change","z":"2f013cac.bbb514","name":"stop","rules":[{"t":"set","p":"stop","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":240,"wires":[[]]},{"id":"12c2b6ec70fa576f","type":"function","z":"2f013cac.bbb514","name":"stop","func":"//fragt globale var ab\nlet func = {\n VAR: global.get(\"stop\"),\n}\n// false\nif (\n func.VAR === false\n )\n{\n return msg; \n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":710,"y":300,"wires":[["2591be76.7863f2"]]},{"id":"d4cbc419.0d40e8","type":"position-config","name":"Zeitmodul","isValide":"true","longitude":"0","latitude":"0","angleType":"deg","timeZoneOffset":"99","timeZoneDST":"0","stateTimeFormat":"3","stateDateFormat":"12","contextStore":""},{"id":"cdefec44f7aa86db","type":"tab","label":"Motion Sensor Behavior ","disabled":false,"info":"","env":[]},{"id":"d97e1a4a51210263","type":"subflow:2f013cac.bbb514","z":"cdefec44f7aa86db","name":"","x":1000,"y":600,"wires":[["672658793463b1d2","b76d06aff9385f4a"],["1f6362019841bfec","a5d56d79871aeb42"],["5913f219bbf2b9df","011bfa073bf2c185"],["c16318e8ebd4a880","91454da2d036863f"],["e06fa44fa99ae1bf","6f37e7f83f23a4bc"]]},{"id":"7b7f27a2a5074f52","type":"change","z":"cdefec44f7aa86db","name":"pass","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"},{"t":"set","p":"topic","pt":"msg","to":"trigger","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":640,"wires":[["d97e1a4a51210263","868b3759859acf09"]]},{"id":"2905529515a0cedb","type":"change","z":"cdefec44f7aa86db","name":"stop","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"},{"t":"set","p":"topic","pt":"msg","to":"trigger","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":560,"wires":[["d97e1a4a51210263","868b3759859acf09"]]},{"id":"f71af7713573d1b0","type":"inject","z":"cdefec44f7aa86db","name":"Your switch (light off)","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":490,"y":640,"wires":[["7b7f27a2a5074f52","32d82a70078bc300"]]},{"id":"89f90dad829e3017","type":"inject","z":"cdefec44f7aa86db","name":"Your switch (light on)","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":490,"y":560,"wires":[["2905529515a0cedb","93054539bf414e8a"]]},{"id":"9a607e82b0f4e6ab","type":"function","z":"cdefec44f7aa86db","name":"counter","func":"// initialise the counter to 0 if it doesn't exist already\nvar count = flow.get('count')||0;\ncount += 1;\n// store the value back\nflow.set('count',count);\n// make it part of the outgoing msg object\nmsg.payload = count;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":400,"y":420,"wires":[["4a18086bf18a2a1b"]]},{"id":"1c32c3b9208b0561","type":"change","z":"cdefec44f7aa86db","name":"count","rules":[{"t":"set","p":"count","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":380,"wires":[[]],"icon":"node-red/function.svg"},{"id":"eb2a7061475911d6","type":"change","z":"cdefec44f7aa86db","name":"reset","rules":[{"t":"set","p":"count","pt":"flow","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":460,"wires":[[]]},{"id":"4a18086bf18a2a1b","type":"switch","z":"cdefec44f7aa86db","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":530,"y":420,"wires":[["1c32c3b9208b0561","3ab5f6d599c968c3","2905529515a0cedb"],["1c32c3b9208b0561","eb2a7061475911d6","71cbd8044841facd","7b7f27a2a5074f52"]]},{"id":"3ab5f6d599c968c3","type":"debug","z":"cdefec44f7aa86db","name":"1st Push ","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":720,"y":400,"wires":[]},{"id":"71cbd8044841facd","type":"debug","z":"cdefec44f7aa86db","name":"2nd Push","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":720,"y":440,"wires":[]},{"id":"5a93300cdddd7440","type":"inject","z":"cdefec44f7aa86db","name":"Single Tap switch logic","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":220,"y":420,"wires":[["9a607e82b0f4e6ab"]]},{"id":"868b3759859acf09","type":"change","z":"cdefec44f7aa86db","name":"Reset","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"},{"t":"set","p":"topic","pt":"msg","to":"reset","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":600,"wires":[["d97e1a4a51210263"]]},{"id":"a49d5355ed2f30c1","type":"inject","z":"cdefec44f7aa86db","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":730,"y":860,"wires":[["d97e1a4a51210263","ef5b8d5e94bb3427"]]},{"id":"672658793463b1d2","type":"debug","z":"cdefec44f7aa86db","name":"Day","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1290,"y":440,"wires":[]},{"id":"5913f219bbf2b9df","type":"debug","z":"cdefec44f7aa86db","name":"Day Dim","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1300,"y":600,"wires":[]},{"id":"1f6362019841bfec","type":"debug","z":"cdefec44f7aa86db","name":"Evening","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1300,"y":520,"wires":[]},{"id":"c16318e8ebd4a880","type":"debug","z":"cdefec44f7aa86db","name":"Evening Dim","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1310,"y":680,"wires":[]},{"id":"e06fa44fa99ae1bf","type":"debug","z":"cdefec44f7aa86db","name":"Group off","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1300,"y":760,"wires":[]},{"id":"366e585926417185","type":"link in","z":"cdefec44f7aa86db","name":"connect to Motion Sensor receiver (true/false)","links":[],"x":410,"y":600,"wires":[["d97e1a4a51210263"]],"l":true},{"id":"a40614c2d6ab7a3f","type":"comment","z":"cdefec44f7aa86db","name":"Scene \"day\"","info":"","x":1290,"y":420,"wires":[]},{"id":"f7d866f9c0b7b73d","type":"comment","z":"cdefec44f7aa86db","name":"\"day\" (dim down action)","info":"","x":1320,"y":580,"wires":[]},{"id":"69ce45506bdd554b","type":"comment","z":"cdefec44f7aa86db","name":"Scene \"evening\" ","info":"","x":1300,"y":500,"wires":[]},{"id":"3a55bb763410c25d","type":"comment","z":"cdefec44f7aa86db","name":"\"evening\" (dim down action)","info":"","x":1340,"y":660,"wires":[]},{"id":"02d0e65aeb3208c9","type":"comment","z":"cdefec44f7aa86db","name":"group or light off action","info":"","x":1320,"y":740,"wires":[]},{"id":"5a6a798079461a89","type":"comment","z":"cdefec44f7aa86db","name":"Test DOUBLE CLICK","info":"This test imitates the motion sensor.\nA true for detected motion, after 15sec\nno motion is detected any longer and \na false is send. \n\nWhen the false come through you can inject\nthe true (motion is detected) again, \nthe scene is recalled and group isnt \nturning off. \n\n","x":720,"y":900,"wires":[]},{"id":"011bfa073bf2c185","type":"change","z":"cdefec44f7aa86db","name":"25% brightness down","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"grouped_light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"add group ID here","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"dimming_delta\":{\"action\":\"down\",\"brightness_delta\":25}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1660,"y":580,"wires":[["e7431e513cc1a037"]]},{"id":"91454da2d036863f","type":"change","z":"cdefec44f7aa86db","name":"15% brightness down","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"grouped_light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"add your group ID here","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"dimming_delta\":{\"action\":\"down\",\"brightness_delta\":15}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1660,"y":620,"wires":[["e7431e513cc1a037"]]},{"id":"b76d06aff9385f4a","type":"change","z":"cdefec44f7aa86db","name":"Day Scene","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"scene","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"add scene ID here","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":1630,"y":500,"wires":[["e7431e513cc1a037"]],"icon":"font-awesome/fa-star"},{"id":"6f37e7f83f23a4bc","type":"change","z":"cdefec44f7aa86db","name":"Group Off","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"grouped_light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"add group ID here","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":1620,"y":660,"wires":[["e7431e513cc1a037"]]},{"id":"a5d56d79871aeb42","type":"change","z":"cdefec44f7aa86db","name":"Evening Scene","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"scene","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"add scene ID here","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":1640,"y":540,"wires":[["e7431e513cc1a037"]],"icon":"font-awesome/fa-star"},{"id":"e7431e513cc1a037","type":"link out","z":"cdefec44f7aa86db","name":"to header and http request","mode":"link","links":[],"x":1980,"y":580,"wires":[],"l":true},{"id":"4edd0b81919cfe2c","type":"change","z":"cdefec44f7aa86db","name":"false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":780,"wires":[["d97e1a4a51210263"]]},{"id":"ef5b8d5e94bb3427","type":"delay","z":"cdefec44f7aa86db","name":"15sec","pauseType":"delay","timeout":"15","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":730,"y":820,"wires":[["4edd0b81919cfe2c"]]},{"id":"37f9d0d13c6446c3","type":"comment","z":"cdefec44f7aa86db","name":"DOUBLE CLICK","info":"The switches are not turning the motion\nsensor off, they are just blocking or\npassing the payload in the subflow.\n\nFor me it had benefits not to disable\nmy sensors, just blocking the detection. \n\nIn my setup the switches are actually a \ncontact sensor, that sends it payload when\ndoor is closed or opened. (Bathroom)\n","x":500,"y":680,"wires":[]},{"id":"33f4109be99ba5cf","type":"comment","z":"cdefec44f7aa86db","name":"DOUBLE CLICK","info":"When you just have a button with only one \nfunction, you could try to use this.\n\nOn every push it triggers 1-2-1-2-1-2 etc\n\nNo promise that it works in any condition.\nTry it out, or delete it ","x":540,"y":340,"wires":[]},{"id":"9e604d9aca485a64","type":"comment","z":"cdefec44f7aa86db","name":"READ FIRST - DOUBLE CLICK","info":"What is this for?\n\nThis is for a room with physical wall switch \nor door contact (best your switch has\ntwo functions, ON and OFF) and also a motion \nsensor.\n\nI use this for my bathroom. Normally the \nsensor triggers the light on and off,\nwhen i go inside just for washing hands, \nlooking im the mirror, etc. \nWhen i am not enough moving for ~25sec\nthe light dims down 25%, to remind me \nthat the light will turn of soon.\nWhen I move, motion is detected and\nthe scene is triggered again, running\nthe timer from the start and so on...\n\nIf I leave the room light turns off shortly.\n\nThis subflow has the option for Day and\nEvening scenes. If you need just one,\nconnect the outputs to the same scenes\nand dim down actions.\n\nYou can adjust the timers and delays for \nyour needs,but this had be good for\nsome weeks testing.\n\nIt has the benefit, that the sensor is \nenabled all the time and I have almost\nno long delays, when i go back into the \nroom after i left and maybe want to go \nback because i forgot my phone. \n\nIf you use this with a switch and not \na door contact, dont forget to press \nthe switch when leaving the room.\n\nMore infos in the DOUBLE CLICKS\n\n","x":930,"y":200,"wires":[]},{"id":"93054539bf414e8a","type":"change","z":"cdefec44f7aa86db","name":"Day Scene","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"scene","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"add scene ID here","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":1290,"y":360,"wires":[["e7431e513cc1a037"]],"icon":"font-awesome/fa-star"},{"id":"32d82a70078bc300","type":"change","z":"cdefec44f7aa86db","name":"Group Off","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"grouped_light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"add group ID here","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":1300,"y":840,"wires":[["e7431e513cc1a037"]]},{"id":"b405d8d45f792d3c","type":"comment","z":"cdefec44f7aa86db","name":"Your normal scene turning on the light using the switch","info":"","x":1300,"y":320,"wires":[]},{"id":"d2a153288bc7382d","type":"comment","z":"cdefec44f7aa86db","name":"turning off the light, using your switch","info":"","x":1290,"y":880,"wires":[]},{"id":"a41a1a3b0034b20d","type":"catch","z":"cdefec44f7aa86db","name":"","scope":null,"uncaught":false,"x":740,"y":200,"wires":[[]]},{"id":"530f6d6c12bfe2b0","type":"catch","z":"cdefec44f7aa86db","name":"","scope":null,"uncaught":false,"x":1120,"y":200,"wires":[[]]}] 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 | -------------------------------------------------------------------------------- /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/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 | --------------------------------------------------------------------------------