[{"id":"988f4c1b.cfac3","type":"http in","z":"b8ce5e67.23af6","name":"IFTTT Trigger","url":"/alarm/md/areas","method":"post","upload":false,"swaggerDoc":"","x":90,"y":316,"wires":[["df518ee6.55111","abbe68ec.a4bc08"]]},{"id":"df518ee6.55111","type":"http response","z":"b8ce5e67.23af6","name":"","x":274,"y":278,"wires":[]},{"id":"6796404f.412508","type":"function","z":"b8ce5e67.23af6","name":"Enable Area 1","func":"var ip = \"192.168.2.116\";\nvar user = \"admin\";\nvar password = \"instar\";\n\n// Update the status with current timestamp\nvar now = new Date();\nvar yyyy = now.getFullYear();\nvar mm = now.getMonth() < 9 ? \"0\" + (now.getMonth() + 1) : (now.getMonth() + 1); // getMonth() is zero-based\nvar dd  = now.getDate() < 10 ? \"0\" + now.getDate() : now.getDate();\nvar hh = now.getHours() < 10 ? \"0\" + now.getHours() : now.getHours();\nvar mmm  = now.getMinutes() < 10 ? \"0\" + now.getMinutes() : now.getMinutes();\nvar ss  = now.getSeconds() < 10 ? \"0\" + now.getSeconds() : now.getSeconds();\nvar currenttime= hh + \":\" + mmm + \":\" + ss;\nvar currentdate= dd + \".\" + mm + \".\" + yyyy;\n\nnode.status({fill:\"blue\",shape:\"ring\",text:\"Last update: \" + currentdate + \" - \" + currenttime});\n\nmsg.topic = \"area 1\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdattr&-name=1&-enable=1&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":455,"y":166,"wires":[["596342f5.701f0c"]]},{"id":"7677c834.9232f8","type":"function","z":"b8ce5e67.23af6","name":"Disable Area 1","func":"var ip = \"192.168.2.116\";\nvar user = \"admin\";\nvar password = \"instar\";\n\n// Update the status with current timestamp\nvar now = new Date();\nvar yyyy = now.getFullYear();\nvar mm = now.getMonth() < 9 ? \"0\" + (now.getMonth() + 1) : (now.getMonth() + 1); // getMonth() is zero-based\nvar dd  = now.getDate() < 10 ? \"0\" + now.getDate() : now.getDate();\nvar hh = now.getHours() < 10 ? \"0\" + now.getHours() : now.getHours();\nvar mmm  = now.getMinutes() < 10 ? \"0\" + now.getMinutes() : now.getMinutes();\nvar ss  = now.getSeconds() < 10 ? \"0\" + now.getSeconds() : now.getSeconds();\nvar currenttime= hh + \":\" + mmm + \":\" + ss;\nvar currentdate= dd + \".\" + mm + \".\" + yyyy;\n\nnode.status({fill:\"blue\",shape:\"ring\",text:\"Last update: \" + currentdate + \" - \" + currenttime});\n\nmsg.topic = \"area 1\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdattr&-name=1&-enable=0&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":455,"y":346,"wires":[["b718ec81.ddc16"]]},{"id":"b718ec81.ddc16","type":"change","z":"b8ce5e67.23af6","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":346,"wires":[["e0dc2146.faa298"]]},{"id":"596342f5.701f0c","type":"change","z":"b8ce5e67.23af6","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":166,"wires":[["b1bc083.3dbd6f8"]]},{"id":"e0dc2146.faa298","type":"http request","z":"b8ce5e67.23af6","name":"m1_disable","method":"GET","ret":"txt","url":"","tls":"","x":754,"y":346,"wires":[["c1f1cf55.56403"]]},{"id":"b1bc083.3dbd6f8","type":"http request","z":"b8ce5e67.23af6","name":"m1_enable","method":"GET","ret":"txt","url":"","tls":"","x":754,"y":166,"wires":[["c1f1cf55.56403"]]},{"id":"b0d8167b.59b588","type":"switch","z":"b8ce5e67.23af6","name":"Push","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"{\"val\":\"on\"}","vt":"str"},{"t":"eq","v":"{\"val\":\"off\"}","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":273,"y":316,"wires":[["6796404f.412508","1212dd87.b931f2","9294e148.9019b8","be6468f1.f60ed"],["7677c834.9232f8","c7ff3b38.1807f8","ea89f119.089b4","b295842.eec8e78"]]},{"id":"c1f1cf55.56403","type":"debug","z":"b8ce5e67.23af6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":959,"y":314,"wires":[]},{"id":"1212dd87.b931f2","type":"function","z":"b8ce5e67.23af6","name":"Enable Area 2","func":"var ip = \"192.168.2.116\";\nvar user = \"admin\";\nvar password = \"instar\";\n\n// Update the status with current timestamp\nvar now = new Date();\nvar yyyy = now.getFullYear();\nvar mm = now.getMonth() < 9 ? \"0\" + (now.getMonth() + 1) : (now.getMonth() + 1); // getMonth() is zero-based\nvar dd  = now.getDate() < 10 ? \"0\" + now.getDate() : now.getDate();\nvar hh = now.getHours() < 10 ? \"0\" + now.getHours() : now.getHours();\nvar mmm  = now.getMinutes() < 10 ? \"0\" + now.getMinutes() : now.getMinutes();\nvar ss  = now.getSeconds() < 10 ? \"0\" + now.getSeconds() : now.getSeconds();\nvar currenttime= hh + \":\" + mmm + \":\" + ss;\nvar currentdate= dd + \".\" + mm + \".\" + yyyy;\n\nnode.status({fill:\"blue\",shape:\"ring\",text:\"Last update: \" + currentdate + \" - \" + currenttime});\n\nmsg.topic = \"area 2\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdattr&-name=2&-enable=1&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":455,"y":208,"wires":[["2c4abc4a.977dfc"]]},{"id":"2c4abc4a.977dfc","type":"change","z":"b8ce5e67.23af6","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":208,"wires":[["ac1b1298.d661f8"]]},{"id":"ac1b1298.d661f8","type":"http request","z":"b8ce5e67.23af6","name":"m1_enable","method":"GET","ret":"txt","url":"","tls":"","x":754,"y":208,"wires":[["c1f1cf55.56403"]]},{"id":"9294e148.9019b8","type":"function","z":"b8ce5e67.23af6","name":"Enable Area 3","func":"var ip = \"192.168.2.116\";\nvar user = \"admin\";\nvar password = \"instar\";\n\n// Update the status with current timestamp\nvar now = new Date();\nvar yyyy = now.getFullYear();\nvar mm = now.getMonth() < 9 ? \"0\" + (now.getMonth() + 1) : (now.getMonth() + 1); // getMonth() is zero-based\nvar dd  = now.getDate() < 10 ? \"0\" + now.getDate() : now.getDate();\nvar hh = now.getHours() < 10 ? \"0\" + now.getHours() : now.getHours();\nvar mmm  = now.getMinutes() < 10 ? \"0\" + now.getMinutes() : now.getMinutes();\nvar ss  = now.getSeconds() < 10 ? \"0\" + now.getSeconds() : now.getSeconds();\nvar currenttime= hh + \":\" + mmm + \":\" + ss;\nvar currentdate= dd + \".\" + mm + \".\" + yyyy;\n\nnode.status({fill:\"blue\",shape:\"ring\",text:\"Last update: \" + currentdate + \" - \" + currenttime});\n\nmsg.topic = \"area 3\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdattr&-name=3&-enable=1&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":455,"y":248,"wires":[["b0702b77.166658"]]},{"id":"b0702b77.166658","type":"change","z":"b8ce5e67.23af6","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":248,"wires":[["f6048f6b.79e9c"]]},{"id":"f6048f6b.79e9c","type":"http request","z":"b8ce5e67.23af6","name":"m1_enable","method":"GET","ret":"txt","url":"","tls":"","x":754,"y":248,"wires":[["c1f1cf55.56403"]]},{"id":"be6468f1.f60ed","type":"function","z":"b8ce5e67.23af6","name":"Enable Area 4","func":"var ip = \"192.168.2.116\";\nvar user = \"admin\";\nvar password = \"instar\";\n\n// Update the status with current timestamp\nvar now = new Date();\nvar yyyy = now.getFullYear();\nvar mm = now.getMonth() < 9 ? \"0\" + (now.getMonth() + 1) : (now.getMonth() + 1); // getMonth() is zero-based\nvar dd  = now.getDate() < 10 ? \"0\" + now.getDate() : now.getDate();\nvar hh = now.getHours() < 10 ? \"0\" + now.getHours() : now.getHours();\nvar mmm  = now.getMinutes() < 10 ? \"0\" + now.getMinutes() : now.getMinutes();\nvar ss  = now.getSeconds() < 10 ? \"0\" + now.getSeconds() : now.getSeconds();\nvar currenttime= hh + \":\" + mmm + \":\" + ss;\nvar currentdate= dd + \".\" + mm + \".\" + yyyy;\n\nnode.status({fill:\"blue\",shape:\"ring\",text:\"Last update: \" + currentdate + \" - \" + currenttime});\n\nmsg.topic = \"area 4\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdattr&-name=4&-enable=1&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":455,"y":288,"wires":[["66cbc5cc.ba4dbc"]]},{"id":"66cbc5cc.ba4dbc","type":"change","z":"b8ce5e67.23af6","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":288,"wires":[["1eba1b8e.c883ac"]]},{"id":"1eba1b8e.c883ac","type":"http request","z":"b8ce5e67.23af6","name":"m1_enable","method":"GET","ret":"txt","url":"","tls":"","x":754,"y":288,"wires":[["c1f1cf55.56403"]]},{"id":"c7ff3b38.1807f8","type":"function","z":"b8ce5e67.23af6","name":"Disable Area 2","func":"var ip = \"192.168.2.116\";\nvar user = \"admin\";\nvar password = \"instar\";\n\n// Update the status with current timestamp\nvar now = new Date();\nvar yyyy = now.getFullYear();\nvar mm = now.getMonth() < 9 ? \"0\" + (now.getMonth() + 1) : (now.getMonth() + 1); // getMonth() is zero-based\nvar dd  = now.getDate() < 10 ? \"0\" + now.getDate() : now.getDate();\nvar hh = now.getHours() < 10 ? \"0\" + now.getHours() : now.getHours();\nvar mmm  = now.getMinutes() < 10 ? \"0\" + now.getMinutes() : now.getMinutes();\nvar ss  = now.getSeconds() < 10 ? \"0\" + now.getSeconds() : now.getSeconds();\nvar currenttime= hh + \":\" + mmm + \":\" + ss;\nvar currentdate= dd + \".\" + mm + \".\" + yyyy;\n\nnode.status({fill:\"blue\",shape:\"ring\",text:\"Last update: \" + currentdate + \" - \" + currenttime});\n\nmsg.topic = \"area 2\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdattr&-name=2&-enable=0&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":455,"y":388,"wires":[["ada1ac69.33bf48"]]},{"id":"ada1ac69.33bf48","type":"change","z":"b8ce5e67.23af6","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":388,"wires":[["864c32.ee4b9bd"]]},{"id":"864c32.ee4b9bd","type":"http request","z":"b8ce5e67.23af6","name":"m1_disable","method":"GET","ret":"txt","url":"","tls":"","x":754,"y":388,"wires":[["c1f1cf55.56403"]]},{"id":"ea89f119.089b4","type":"function","z":"b8ce5e67.23af6","name":"Disable Area 3","func":"var ip = \"192.168.2.116\";\nvar user = \"admin\";\nvar password = \"instar\";\n\n// Update the status with current timestamp\nvar now = new Date();\nvar yyyy = now.getFullYear();\nvar mm = now.getMonth() < 9 ? \"0\" + (now.getMonth() + 1) : (now.getMonth() + 1); // getMonth() is zero-based\nvar dd  = now.getDate() < 10 ? \"0\" + now.getDate() : now.getDate();\nvar hh = now.getHours() < 10 ? \"0\" + now.getHours() : now.getHours();\nvar mmm  = now.getMinutes() < 10 ? \"0\" + now.getMinutes() : now.getMinutes();\nvar ss  = now.getSeconds() < 10 ? \"0\" + now.getSeconds() : now.getSeconds();\nvar currenttime= hh + \":\" + mmm + \":\" + ss;\nvar currentdate= dd + \".\" + mm + \".\" + yyyy;\n\nnode.status({fill:\"blue\",shape:\"ring\",text:\"Last update: \" + currentdate + \" - \" + currenttime});\n\nmsg.topic = \"area 3\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdattr&-name=3&-enable=0&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":455,"y":428,"wires":[["34f260b4.8ca6d"]]},{"id":"34f260b4.8ca6d","type":"change","z":"b8ce5e67.23af6","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":428,"wires":[["cd5bf67c.f228f8"]]},{"id":"cd5bf67c.f228f8","type":"http request","z":"b8ce5e67.23af6","name":"m1_disable","method":"GET","ret":"txt","url":"","tls":"","x":754,"y":428,"wires":[["c1f1cf55.56403"]]},{"id":"b295842.eec8e78","type":"function","z":"b8ce5e67.23af6","name":"Disable Area 4","func":"var ip = \"192.168.2.116\";\nvar user = \"admin\";\nvar password = \"instar\";\n\n// Update the status with current timestamp\nvar now = new Date();\nvar yyyy = now.getFullYear();\nvar mm = now.getMonth() < 9 ? \"0\" + (now.getMonth() + 1) : (now.getMonth() + 1); // getMonth() is zero-based\nvar dd  = now.getDate() < 10 ? \"0\" + now.getDate() : now.getDate();\nvar hh = now.getHours() < 10 ? \"0\" + now.getHours() : now.getHours();\nvar mmm  = now.getMinutes() < 10 ? \"0\" + now.getMinutes() : now.getMinutes();\nvar ss  = now.getSeconds() < 10 ? \"0\" + now.getSeconds() : now.getSeconds();\nvar currenttime= hh + \":\" + mmm + \":\" + ss;\nvar currentdate= dd + \".\" + mm + \".\" + yyyy;\n\nnode.status({fill:\"blue\",shape:\"ring\",text:\"Last update: \" + currentdate + \" - \" + currenttime});\n\nmsg.topic = \"area 4\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdattr&-name=4&-enable=0&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":455,"y":468,"wires":[["4d772fa7.a25528"]]},{"id":"4d772fa7.a25528","type":"change","z":"b8ce5e67.23af6","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":468,"wires":[["e1d7cf09.ca5958"]]},{"id":"e1d7cf09.ca5958","type":"http request","z":"b8ce5e67.23af6","name":"m1_disable","method":"GET","ret":"txt","url":"","tls":"","x":754,"y":468,"wires":[["c1f1cf55.56403"]]},{"id":"abbe68ec.a4bc08","type":"json","z":"b8ce5e67.23af6","name":"","property":"payload","action":"","pretty":false,"x":267,"y":359,"wires":[["b0d8167b.59b588"]]}]