+[{"id":"84340862.8b252","type":"subflow","name":"MS Event","info":"","category":"","in":[{"x":440,"y":160,"wires":[{"id":"341e5aca.62fa6e"}]}],"out":[{"x":1200,"y":160,"wires":[{"id":"4132b570.49b064","port":0},{"id":"4ff27623.4e521","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"3237c682.b353ba","type":"switch","z":"84340862.8b252","name":"payload.data.0.motion.motion","property":"payload.data.0.motion.motion","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":830,"y":160,"wires":[["4132b570.49b064"],["4ff27623.4e521"]]},{"id":"4132b570.49b064","type":"change","z":"84340862.8b252","name":"true","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1070,"y":140,"wires":[[]]},{"id":"4ff27623.4e521","type":"change","z":"84340862.8b252","name":"false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1070,"y":180,"wires":[[]]},{"id":"341e5aca.62fa6e","type":"rbe","z":"84340862.8b252","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","x":590,"y":160,"wires":[["3237c682.b353ba"]]},{"id":"2f013cac.bbb514","type":"subflow","name":"Motion Sensor Logic","info":"","category":"","in":[{"x":400,"y":380,"wires":[{"id":"b39cf1d4.20897"}]}],"out":[{"x":1400,"y":280,"wires":[{"id":"ead089f1.2f4ea8","port":0}]},{"x":1400,"y":320,"wires":[{"id":"ead089f1.2f4ea8","port":1}]},{"x":1400,"y":360,"wires":[{"id":"79f32db.6f9b2d4","port":0}]},{"x":1400,"y":400,"wires":[{"id":"79f32db.6f9b2d4","port":1}]},{"x":1400,"y":440,"wires":[{"id":"4daacf0.3530a3","port":0}]}],"env":[],"meta":{},"color":"#DDAA99"},{"id":"2591be76.7863f2","type":"switch","z":"2f013cac.bbb514","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":790,"y":380,"wires":[["ead089f1.2f4ea8","5eac6333.d048bc"],["2debf3c6.275bbc"]]},{"id":"ead089f1.2f4ea8","type":"within-time-switch","z":"2f013cac.bbb514","name":"","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,"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,"tsCompare":"0","x":1250,"y":300,"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":1030,"y":380,"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":790,"y":440,"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":1030,"y":440,"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":380,"wires":[["bc1312c8.026aa"],["a550736d.af7a3"],["5eac6333.d048bc","5327e2b2.7c8aac"]]},{"id":"79f32db.6f9b2d4","type":"within-time-switch","z":"2f013cac.bbb514","name":"","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,"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,"tsCompare":"0","x":1250,"y":380,"wires":[[],[]]},{"id":"a550736d.af7a3","type":"InterruptFlowUltimate","z":"2f013cac.bbb514","name":"Interrupt Flow","triggertopic":"trigger","initializewith":"1","x":800,"y":320,"wires":[["2591be76.7863f2"]]},{"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":440,"wires":[["5eac6333.d048bc"]]},{"id":"bc1312c8.026aa","type":"switch","z":"2f013cac.bbb514","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":510,"y":320,"wires":[["8cdfb2c8.498a5"],["a550736d.af7a3"]]},{"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,"outputs":1,"x":510,"y":260,"wires":[["a550736d.af7a3"]]},{"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":"ec0a9a1bd3abfd32","type":"tab","label":"Motion Sensor Behaviour","disabled":false,"info":"","env":[]},{"id":"e2085a055d88f621","type":"subflow:2f013cac.bbb514","z":"ec0a9a1bd3abfd32","name":"","env":[],"x":1180,"y":640,"wires":[["7a6304cefab609c6"],["83678f1c7170e0fe"],["fc4fdc398e84adf9"],["8b0c256149c49efb"],["c3e250dc0fe1c3fc"]]},{"id":"fc4fdc398e84adf9","type":"change","z":"ec0a9a1bd3abfd32","name":"Dim down Day","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"grouped_light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"00f2d3cf-d939-4340-be46-3b944cd09153","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"dimming_delta\":{\"action\":\"down\",\"brightness_delta\":50},\"dynamics\":{\"duration\":1500}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1480,"y":660,"wires":[["48b96c5bf5047d6b"]]},{"id":"8b0c256149c49efb","type":"change","z":"ec0a9a1bd3abfd32","name":"Dim down Evening","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"grouped_light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"00f2d3cf-d939-4340-be46-3b944cd09153","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"dimming_delta\":{\"action\":\"down\",\"brightness_delta\":20},\"dynamics\":{\"duration\":1500}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1490,"y":700,"wires":[["48b96c5bf5047d6b"]]},{"id":"7a6304cefab609c6","type":"change","z":"ec0a9a1bd3abfd32","name":"Room Day","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"scene","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"54e6d08c-3019-45b7-9383-5486bd92f53e","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":1470,"y":540,"wires":[["48b96c5bf5047d6b"]],"icon":"font-awesome/fa-star"},{"id":"83678f1c7170e0fe","type":"change","z":"ec0a9a1bd3abfd32","name":"Room Evening","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"scene","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"c5b1571f-51fc-4256-a70b-7a1c8213df57","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":1480,"y":580,"wires":[["48b96c5bf5047d6b"]],"icon":"font-awesome/fa-star"},{"id":"c3e250dc0fe1c3fc","type":"change","z":"ec0a9a1bd3abfd32","name":"Room off","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"grouped_light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"00f2d3cf-d939-4340-be46-3b944cd09153","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":1460,"y":740,"wires":[["48b96c5bf5047d6b"]]},{"id":"dfe143ee486c41b8","type":"switch","z":"ec0a9a1bd3abfd32","name":"Motion Sensor","property":"payload.data.0.id","propertyType":"msg","rules":[{"t":"cont","v":"your motion Sensor ID","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":800,"y":640,"wires":[["27594caab38a496a"]]},{"id":"27594caab38a496a","type":"subflow:84340862.8b252","z":"ec0a9a1bd3abfd32","name":"","x":990,"y":640,"wires":[["e2085a055d88f621"]]},{"id":"56fe4e73cb515f91","type":"link in","z":"ec0a9a1bd3abfd32","name":"to HUE Event flow (orange Node)","links":[],"x":510,"y":640,"wires":[["dfe143ee486c41b8"]],"l":true},{"id":"48b96c5bf5047d6b","type":"function","z":"ec0a9a1bd3abfd32","name":"HUE API V2","func":"\n// you can copy the user from the hue config node\nvar user = \"FS9pMDGj6x2--- YOUR DATA -- WtOYh6TTIR\";\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":1870,"y":640,"wires":[["cb69aa5c6201b8f6"]]},{"id":"cb69aa5c6201b8f6","type":"http request","z":"ec0a9a1bd3abfd32","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":1910,"y":600,"wires":[["f82cfe986872645f"]]},{"id":"f82cfe986872645f","type":"debug","z":"ec0a9a1bd3abfd32","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1970,"y":560,"wires":[]},{"id":"53d411cfe1289171","type":"comment","z":"ec0a9a1bd3abfd32","name":"Add Scene ID here","info":"","x":1490,"y":560,"wires":[]},{"id":"af24c3d4b380e570","type":"comment","z":"ec0a9a1bd3abfd32","name":"add Room ID here","info":"","x":1490,"y":720,"wires":[]},{"id":"ef55ec162667dbc4","type":"comment","z":"ec0a9a1bd3abfd32","name":"add Room ID here","info":"","x":1490,"y":680,"wires":[]},{"id":"f1b5e56413201ca2","type":"comment","z":"ec0a9a1bd3abfd32","name":"README - Double Click","info":"Please Install the contrib \nnode-red-contrib-boolean-logic-ultimate\nand\nnode-red-contrib-sun-position\nfirst!\n\nThis flow is a behaviour \"Script\" for Motion\nSensor. It works in this way:\n\nThe motion Sensor need to be not \nconfigured in the app.\n\nWhen otion is detected the first Scene \n\"Room Day\" is triggered \n(you need to setup a scene of course)\n\nAfter 25 seconds of no motion the light\ndims down, as a \"confirmation\" that no \nmotion was detected in the timespan\n\nIf motion is detected again, the scene will\nbe triggered annother time, and so on...\n\nIf still no motion is detected after 32\nseconds the light will turn off.\n\nThe Subflow is split up in two different \ntimes, so you can trigger scenes for \nday and night.\n","x":870,"y":480,"wires":[]},{"id":"92e19c45d72e1c01","type":"comment","z":"ec0a9a1bd3abfd32","name":"Read the README before deploy!!","info":"","x":880,"y":440,"wires":[]},{"id":"9fb166d81181f73b","type":"comment","z":"ec0a9a1bd3abfd32","name":"Your Data here","info":"","x":1880,"y":660,"wires":[]},{"id":"3775faf5d79de3b8","type":"comment","z":"ec0a9a1bd3abfd32","name":"add Motion Sensor ID here","info":"","x":790,"y":660,"wires":[]},{"id":"4bc31af9bd03bbdc","type":"tls-config","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":false}]
0 commit comments