[{"id":"80fce41e.4db188","type":"tab","label":"SET Alarm Office","disabled":false,"info":""},{"id":"e6c1edcb.dc0f4","type":"mqtt in","z":"80fce41e.4db188","name":"Set Alarm Email","topic":"ipcam/office/alarm/setmdalarm/email","qos":"1","broker":"40415d07.67dd94","x":90,"y":293,"wires":[["e16624e4.cede08"]]},{"id":"813aba98.fc6908","type":"switch","z":"80fce41e.4db188","name":"Push","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":399,"y":293,"wires":[["1e4ed0ee.ed17cf"],["c00b756b.bf0fe8"]]},{"id":"1e4ed0ee.ed17cf","type":"function","z":"80fce41e.4db188","name":"Email Enabled","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"emailsnap\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdalarm&-aname=emailsnap&-switch=on&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":549,"y":270,"wires":[["e42c6b90.ff6718"]]},{"id":"b0f7975e.9f1148","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{\"val\" : \"ON\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":949,"y":270,"wires":[["62b93d9c.a9ea04"]]},{"id":"62b93d9c.a9ea04","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":1117,"y":309,"wires":[["7a3106d5.dac298"]]},{"id":"e42c6b90.ff6718","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":689,"y":270,"wires":[["ead4aad7.5dd168"]]},{"id":"ead4aad7.5dd168","type":"http request","z":"80fce41e.4db188","name":"emailsnap","method":"GET","ret":"txt","url":"","tls":"","x":819,"y":270,"wires":[["b0f7975e.9f1148"]]},{"id":"3c20758e.742e0a","type":"mqtt out","z":"80fce41e.4db188","name":"Set Alarm Email","topic":"ipcam/office/alarm/setmdalarm/email","qos":"1","retain":"","broker":"40415d07.67dd94","x":260,"y":233,"wires":[]},{"id":"e16624e4.cede08","type":"function","z":"80fce41e.4db188","name":"process value","func":"msg.payload = JSON.parse(msg.payload).val;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":293,"wires":[["813aba98.fc6908"]]},{"id":"af8067e3.80cc08","type":"ui_button","z":"80fce41e.4db188","name":"Enable Email","group":"6a969f3d.e1ed1","order":0,"width":0,"height":0,"passthru":true,"label":"Enable Email","color":"#ffffff","bgcolor":"#f17c35","icon":"fa-bell","payload":"{\"val\" : \"ON\"}","payloadType":"json","topic":"emailsnap","x":92,"y":213,"wires":[["3c20758e.742e0a"]]},{"id":"11f147ae.f0e8d8","type":"ui_button","z":"80fce41e.4db188","name":"Disable Email","group":"6a969f3d.e1ed1","order":0,"width":0,"height":0,"passthru":true,"label":"Disable Email","color":"#000000","bgcolor":"#dddddd","icon":"fa-bell","payload":"{\"val\" : \"OFF\"}","payloadType":"json","topic":"emailsnap","x":92,"y":253,"wires":[["3c20758e.742e0a"]]},{"id":"c00b756b.bf0fe8","type":"function","z":"80fce41e.4db188","name":"Email Disabled","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"emailsnap\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdalarm&-aname=emailsnap&-switch=off&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":549,"y":310,"wires":[["c1f249c6.038218"]]},{"id":"c1f249c6.038218","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":689,"y":310,"wires":[["f1f3c618.1cdc88"]]},{"id":"f1f3c618.1cdc88","type":"http request","z":"80fce41e.4db188","name":"emailsnap","method":"GET","ret":"txt","url":"","tls":"","x":819,"y":310,"wires":[["4e0a180d.20b468"]]},{"id":"4e0a180d.20b468","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{\"val\" : \"OFF\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":948,"y":310,"wires":[["62b93d9c.a9ea04"]]},{"id":"b1eb4038.339bc","type":"mqtt in","z":"80fce41e.4db188","name":"Set Alarm Snap","topic":"ipcam/office/alarm/setmdalarm/snap","qos":"1","broker":"40415d07.67dd94","x":90,"y":489,"wires":[["ee0d8412.4765d8"]]},{"id":"26f0e486.40f7cc","type":"switch","z":"80fce41e.4db188","name":"Push","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":420,"y":489,"wires":[["90d7b237.02a93"],["a19b821b.9aa2d"]]},{"id":"90d7b237.02a93","type":"function","z":"80fce41e.4db188","name":"Snap Enabled","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"snap\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdalarm&-aname=snap&-switch=on&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":466,"wires":[["9c9fcfd6.c6a7c"]]},{"id":"6e6c0838.8b4468","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{ \"val\": \"ON\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":957,"y":466,"wires":[["fd9bc83c.d2bfd8"]]},{"id":"fd9bc83c.d2bfd8","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":1110,"y":506,"wires":[["9e9a2e13.40ba7"]]},{"id":"9c9fcfd6.c6a7c","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":466,"wires":[["e64c9f6f.c0e5"]]},{"id":"e64c9f6f.c0e5","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":830,"y":466,"wires":[["6e6c0838.8b4468"]]},{"id":"ccf27702.367238","type":"mqtt out","z":"80fce41e.4db188","name":"Set Alarm Snap","topic":"ipcam/office/alarm/setmdalarm/snap","qos":"1","retain":"false","broker":"40415d07.67dd94","x":270,"y":429,"wires":[]},{"id":"ee0d8412.4765d8","type":"function","z":"80fce41e.4db188","name":"process value","func":"msg.payload = JSON.parse(msg.payload).val;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":489,"wires":[["26f0e486.40f7cc"]]},{"id":"d881a06f.e65f6","type":"ui_button","z":"80fce41e.4db188","name":"Enable Snap","group":"b6272f67.feb2c","order":0,"width":0,"height":0,"passthru":true,"label":"Enable Snap","color":"#ffffff","bgcolor":"#f17c35","icon":"fa-bell","payload":"{\"val\" : \"ON\"}","payloadType":"json","topic":"snap","x":90,"y":406,"wires":[["ccf27702.367238"]]},{"id":"64e26ee3.8e1f8","type":"ui_button","z":"80fce41e.4db188","name":"Disable Snap","group":"b6272f67.feb2c","order":0,"width":0,"height":0,"passthru":true,"label":"Disable Snap","color":"#000000","bgcolor":"#dddddd","icon":"fa-bell","payload":"{\"val\" : \"OFF\"}","payloadType":"json","topic":"snap","x":90,"y":449,"wires":[["ccf27702.367238"]]},{"id":"a19b821b.9aa2d","type":"function","z":"80fce41e.4db188","name":"Snap Disabled","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"snap\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdalarm&-aname=snap&-switch=off&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":506,"wires":[["496be368.427aec"]]},{"id":"496be368.427aec","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":506,"wires":[["24f19709.664488"]]},{"id":"24f19709.664488","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":830,"y":506,"wires":[["bfd2a9c4.16ebb8"]]},{"id":"bfd2a9c4.16ebb8","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{ \"val\": \"OFF\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":956,"y":506,"wires":[["fd9bc83c.d2bfd8"]]},{"id":"18b69904.979737","type":"mqtt in","z":"80fce41e.4db188","name":"Set Alarm Snap","topic":"ipcam/office/alarm/setmdalarm/ftpsnap","qos":"1","broker":"40415d07.67dd94","x":90,"y":686,"wires":[["3aec6b69.089804"]]},{"id":"1b95da91.b50585","type":"switch","z":"80fce41e.4db188","name":"Push","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":411,"y":686,"wires":[["aa3f30a6.ed139"],["f922685c.2e4c38"]]},{"id":"aa3f30a6.ed139","type":"function","z":"80fce41e.4db188","name":"FTPSnap Enabled","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"ftpsnap\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdalarm&-aname=ftpsnap&-switch=on&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":566,"y":663,"wires":[["be3d3c0f.317bb"]]},{"id":"7698056b.de626c","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{ \"val\": \"ON\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":957,"y":663,"wires":[["abdbe440.176a18"]]},{"id":"abdbe440.176a18","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":1100,"y":703,"wires":[["fd4bfe1.b17ad"]]},{"id":"be3d3c0f.317bb","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":716,"y":663,"wires":[["d4fefb83.ab3628"]]},{"id":"d4fefb83.ab3628","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":836,"y":663,"wires":[["7698056b.de626c"]]},{"id":"dd891281.db2a8","type":"mqtt out","z":"80fce41e.4db188","name":"Set Alarm Snap","topic":"ipcam/office/alarm/setmdalarm/ftpsnap","qos":"1","retain":"","broker":"40415d07.67dd94","x":271,"y":626,"wires":[]},{"id":"3aec6b69.089804","type":"function","z":"80fce41e.4db188","name":"process value","func":"msg.payload = JSON.parse(msg.payload).val;\nreturn msg;","outputs":1,"noerr":0,"x":273,"y":686,"wires":[["1b95da91.b50585"]]},{"id":"4a68685d.170f08","type":"ui_button","z":"80fce41e.4db188","name":"Disable FTP Snap","group":"a56fe2.dc4e902","order":3,"width":0,"height":0,"passthru":true,"label":"Disable FTP Snap","color":"#000000","bgcolor":"#dddddd","icon":"fa-bell","payload":"{\"val\" : \"OFF\"}","payloadType":"json","topic":"snap","x":101,"y":646,"wires":[["dd891281.db2a8"]]},{"id":"f922685c.2e4c38","type":"function","z":"80fce41e.4db188","name":"FTPSnap Disabled","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"ftpsnap\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdalarm&-aname=ftpsnap&-switch=off&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":566,"y":703,"wires":[["3b63492e.dce626"]]},{"id":"3b63492e.dce626","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":716,"y":703,"wires":[["2e85aa34.c001f6"]]},{"id":"2e85aa34.c001f6","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":836,"y":703,"wires":[["8a2f3707.9f3378"]]},{"id":"8a2f3707.9f3378","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{ \"val\": \"OFF\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":956,"y":703,"wires":[["abdbe440.176a18"]]},{"id":"8ed52568.8bcbe8","type":"ui_button","z":"80fce41e.4db188","name":"Enable FTP Snap","group":"a56fe2.dc4e902","order":2,"width":0,"height":0,"passthru":true,"label":"Enable FTP Snap","color":"#ffffff","bgcolor":"#f17c35","icon":"fa-bell","payload":"{\"val\" : \"ON\"}","payloadType":"json","topic":"snap","x":101,"y":606,"wires":[["dd891281.db2a8"]]},{"id":"9c554694.9e7088","type":"mqtt in","z":"80fce41e.4db188","name":"Set Alarm Rec","topic":"ipcam/office/alarm/setmdalarm/rec","qos":"1","broker":"40415d07.67dd94","x":90,"y":875,"wires":[["78a88d67.b7a1e4"]]},{"id":"58c79d5f.252724","type":"switch","z":"80fce41e.4db188","name":"Push","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":411,"y":875,"wires":[["4596c0f9.edf4f"],["492d2f06.c3d0f"]]},{"id":"4596c0f9.edf4f","type":"function","z":"80fce41e.4db188","name":"Recording Enabled","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"record\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdalarm&-aname=record&-switch=on&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":566,"y":852,"wires":[["7752736c.8b448c"]]},{"id":"46b17578.021f1c","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{\"val\" : \"ON\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":957,"y":852,"wires":[["6acd934f.b493ac"]]},{"id":"6acd934f.b493ac","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":1107,"y":892,"wires":[["9cf806f.fa944f8"]]},{"id":"7752736c.8b448c","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":716,"y":852,"wires":[["fb1783ea.729fa"]]},{"id":"fb1783ea.729fa","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":836,"y":852,"wires":[["46b17578.021f1c"]]},{"id":"c57ae18c.42ff7","type":"mqtt out","z":"80fce41e.4db188","name":"Set Alarm Rec","topic":"ipcam/office/alarm/setmdalarm/rec","qos":"1","retain":"","broker":"40415d07.67dd94","x":270,"y":815,"wires":[]},{"id":"78a88d67.b7a1e4","type":"function","z":"80fce41e.4db188","name":"process value","func":"msg.payload = JSON.parse(msg.payload).val;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":875,"wires":[["58c79d5f.252724"]]},{"id":"453ea2ea.3086ac","type":"ui_button","z":"80fce41e.4db188","name":"Disable Recording","group":"b7cbf120.ff8cc","order":3,"width":0,"height":0,"passthru":false,"label":"Disable Recording","color":"#000000","bgcolor":"#dddddd","icon":"fa-bell","payload":"{\"val\" : \"OFF\"}","payloadType":"json","topic":"snap","x":100,"y":835,"wires":[["c57ae18c.42ff7"]]},{"id":"492d2f06.c3d0f","type":"function","z":"80fce41e.4db188","name":"Recording Disabled","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"record\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdalarm&-aname=record&-switch=off&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":566,"y":892,"wires":[["461c2287.d2ccdc"]]},{"id":"461c2287.d2ccdc","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":716,"y":892,"wires":[["116475e8.45e6da"]]},{"id":"116475e8.45e6da","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":836,"y":892,"wires":[["b62741dd.93837"]]},{"id":"b62741dd.93837","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{\"val\" : \"OFF\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{\"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":956,"y":892,"wires":[["6acd934f.b493ac"]]},{"id":"850f2f3a.302c6","type":"ui_button","z":"80fce41e.4db188","name":"Enable Recording","group":"b7cbf120.ff8cc","order":2,"width":0,"height":0,"passthru":false,"label":"Enable Recording","color":"#ffffff","bgcolor":"#f17c35","icon":"fa-bell","payload":"{\"val\" : \"ON\"}","payloadType":"json","topic":"snap","x":100,"y":795,"wires":[["c57ae18c.42ff7"]]},{"id":"b6a3fdce.d5e39","type":"mqtt in","z":"80fce41e.4db188","name":"Set Alarm Snap","topic":"ipcam/office/alarm/setmdalarm/ftprec","qos":"1","broker":"40415d07.67dd94","x":90,"y":1065,"wires":[["8a863190.9039a"]]},{"id":"77d6c853.1c0598","type":"switch","z":"80fce41e.4db188","name":"Push","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":411,"y":1065,"wires":[["b2a3c61d.5a2568"],["ba96db3b.fe78a8"]]},{"id":"b2a3c61d.5a2568","type":"function","z":"80fce41e.4db188","name":"FTP Recording Enabled","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"ftprec\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdalarm&-aname=ftprec&-switch=on&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;\n\n// msg.payload = 'http://192.168.1.116/param.cgi?cmd=setmdalarm&-aname=ftprec&-switch=on&-usr=admin&-pwd=1029384756';\n// return msg;","outputs":1,"noerr":0,"x":576,"y":1042,"wires":[["4aa8f0e3.f1613"]]},{"id":"7d8804b2.20b2ec","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{\"val\" : \"ON\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":972,"y":1042,"wires":[["38dc592b.644726"]]},{"id":"38dc592b.644726","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":1119,"y":1082,"wires":[["373c47d.dc26bb8"]]},{"id":"4aa8f0e3.f1613","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":731,"y":1042,"wires":[["773368f0.142148"]]},{"id":"773368f0.142148","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":851,"y":1042,"wires":[["7d8804b2.20b2ec"]]},{"id":"1b0ea81d.3e2e18","type":"mqtt out","z":"80fce41e.4db188","name":"Set Alarm Snap","topic":"ipcam/office/alarm/setmdalarm/ftprec","qos":"1","retain":"","broker":"40415d07.67dd94","x":310,"y":1005,"wires":[]},{"id":"8a863190.9039a","type":"function","z":"80fce41e.4db188","name":"process value","func":"msg.payload = JSON.parse(msg.payload).val;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":1065,"wires":[["77d6c853.1c0598"]]},{"id":"a468d966.e443f8","type":"ui_button","z":"80fce41e.4db188","name":"Disable FTP Recording","group":"8c28e771.1068c8","order":3,"width":0,"height":0,"passthru":false,"label":"Disable FTP Recording","color":"#000000","bgcolor":"#dddddd","icon":"fa-bell","payload":"{\"val\" : \"OFF\"}","payloadType":"json","topic":"snap","x":110,"y":1025,"wires":[["1b0ea81d.3e2e18"]]},{"id":"ba96db3b.fe78a8","type":"function","z":"80fce41e.4db188","name":"FTP Recording Disabled","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"record\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdalarm&-aname=ftprec&-switch=off&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;\n\n// msg.payload = 'http://192.168.1.116/param.cgi?cmd=setmdalarm&-aname=ftprec&-switch=off&-usr=admin&-pwd=1029384756';\n// return msg;","outputs":1,"noerr":0,"x":576,"y":1082,"wires":[["318c659.b00d69a"]]},{"id":"318c659.b00d69a","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":731,"y":1082,"wires":[["fff484a3.6d6068"]]},{"id":"fff484a3.6d6068","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":851,"y":1082,"wires":[["6c28ed29.5e0b54"]]},{"id":"6c28ed29.5e0b54","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{\"val\" : \"OFF\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":971,"y":1082,"wires":[["38dc592b.644726"]]},{"id":"8e86edcc.f45a4","type":"ui_button","z":"80fce41e.4db188","name":"Enable FTP Recording","group":"8c28e771.1068c8","order":2,"width":0,"height":0,"passthru":false,"label":"Enable FTP Recording","color":"#ffffff","bgcolor":"#f17c35","icon":"fa-bell","payload":"{\"val\" : \"ON\"}","payloadType":"json","topic":"snap","x":110,"y":985,"wires":[["1b0ea81d.3e2e18"]]},{"id":"a8dac8f8.62d228","type":"mqtt in","z":"80fce41e.4db188","name":"Set Alarm Snap","topic":"ipcam/office/alarm/setmdalarm/relay","qos":"1","broker":"40415d07.67dd94","x":90,"y":1269,"wires":[["e596b869.9cbc88"]]},{"id":"9a09a6fe.ff9488","type":"switch","z":"80fce41e.4db188","name":"Push","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":411,"y":1269,"wires":[["f0c87803.36b6f8"],["3b218ff9.4cc5"]]},{"id":"f0c87803.36b6f8","type":"function","z":"80fce41e.4db188","name":"Relay Enabled","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"relay\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdalarm&-aname=relay&-switch=on&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":556,"y":1246,"wires":[["d08abb81.853ba8"]]},{"id":"8b2b985b.897918","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{\"val\" : \"ON\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":946,"y":1246,"wires":[["a06e8000.dd74f"]]},{"id":"a06e8000.dd74f","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":1083,"y":1284,"wires":[["f832e027.3e2c8"]]},{"id":"d08abb81.853ba8","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":705,"y":1246,"wires":[["73545573.3d67ec"]]},{"id":"73545573.3d67ec","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":825,"y":1246,"wires":[["8b2b985b.897918"]]},{"id":"2e142894.450068","type":"mqtt out","z":"80fce41e.4db188","name":"Set Alarm Snap","topic":"ipcam/office/alarm/setmdalarm/relay","qos":"1","retain":"","broker":"40415d07.67dd94","x":310,"y":1209,"wires":[]},{"id":"e596b869.9cbc88","type":"function","z":"80fce41e.4db188","name":"process value","func":"msg.payload = JSON.parse(msg.payload).val;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":1269,"wires":[["9a09a6fe.ff9488"]]},{"id":"21beef50.06218","type":"ui_button","z":"80fce41e.4db188","name":"Disable Output Relay","group":"c067bfe4.33938","order":3,"width":0,"height":0,"passthru":false,"label":"Disable Output Relay","color":"#000000","bgcolor":"#dddddd","icon":"fa-bell","payload":"{\"val\" : \"OFF\"}","payloadType":"json","topic":"snap","x":110,"y":1229,"wires":[["2e142894.450068"]]},{"id":"3b218ff9.4cc5","type":"function","z":"80fce41e.4db188","name":"Relay Disabled","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"relay\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdalarm&-aname=relay&-switch=off&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":556,"y":1286,"wires":[["cbd97df.40ea58"]]},{"id":"cbd97df.40ea58","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":705,"y":1286,"wires":[["f260bbcc.dd0178"]]},{"id":"f260bbcc.dd0178","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":825,"y":1286,"wires":[["50968932.1f25c8"]]},{"id":"50968932.1f25c8","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{\"val\" : \"OFF\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":945,"y":1286,"wires":[["a06e8000.dd74f"]]},{"id":"22fb8774.690bf8","type":"ui_button","z":"80fce41e.4db188","name":"Enable Output Relay","group":"c067bfe4.33938","order":2,"width":0,"height":0,"passthru":false,"label":"Enable Output Relay","color":"#ffffff","bgcolor":"#f17c35","icon":"fa-bell","payload":"{\"val\" : \"ON\"}","payloadType":"json","topic":"snap","x":110,"y":1189,"wires":[["2e142894.450068"]]},{"id":"42faab13.f70e64","type":"mqtt in","z":"80fce41e.4db188","name":"Set Alarm Snap","topic":"ipcam/office/alarm/setmdalarm/alarmsignal","qos":"1","broker":"40415d07.67dd94","x":90,"y":1470,"wires":[["7be3a87b.acd338"]]},{"id":"9d55f8f9.919908","type":"switch","z":"80fce41e.4db188","name":"Push","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":411,"y":1470,"wires":[["7a7ba246.4aa56c"],["b6ff7cf3.64c0c"]]},{"id":"7a7ba246.4aa56c","type":"function","z":"80fce41e.4db188","name":"Audio Alarm Signal Enabled","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"sound\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdalarm&-aname=sound&-switch=on&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":586,"y":1447,"wires":[["e0ca9307.db8b2"]]},{"id":"b2375a7.b69d8a8","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{\"val\" : \"ON\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":1005,"y":1447,"wires":[["6fe6c1c4.b3ec"]]},{"id":"6fe6c1c4.b3ec","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":1148,"y":1486,"wires":[["3b6b6e3b.632112"]]},{"id":"e0ca9307.db8b2","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":764,"y":1447,"wires":[["6f396c.df35e694"]]},{"id":"6f396c.df35e694","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":884,"y":1447,"wires":[["b2375a7.b69d8a8"]]},{"id":"55a91dac.605084","type":"mqtt out","z":"80fce41e.4db188","name":"Set Alarm Snap","topic":"ipcam/office/alarm/setmdalarm/alarmsignal","qos":"1","retain":"","broker":"40415d07.67dd94","x":310,"y":1410,"wires":[]},{"id":"7be3a87b.acd338","type":"function","z":"80fce41e.4db188","name":"process value","func":"msg.payload = JSON.parse(msg.payload).val;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":1470,"wires":[["9d55f8f9.919908"]]},{"id":"63a317be.d53c38","type":"ui_button","z":"80fce41e.4db188","name":"Audio Alarm Signal Disable ","group":"e2c90946.abf778","order":3,"width":0,"height":0,"passthru":false,"label":"Audio Alarm Signal Disable ","color":"#000000","bgcolor":"#dddddd","icon":"fa-bell","payload":"{\"val\" : \"OFF\"}","payloadType":"json","topic":"snap","x":120,"y":1430,"wires":[["55a91dac.605084"]]},{"id":"b6ff7cf3.64c0c","type":"function","z":"80fce41e.4db188","name":"Audio Alarm Signal Disabled","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"sound\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdalarm&-aname=sound&-switch=off&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":596,"y":1487,"wires":[["95f1e684.31e7d8"]]},{"id":"95f1e684.31e7d8","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":764,"y":1487,"wires":[["ef7b3d2f.13b7a"]]},{"id":"ef7b3d2f.13b7a","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":884,"y":1487,"wires":[["18551891.b85827"]]},{"id":"18551891.b85827","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{\"val\" : \"OFF\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":1004,"y":1487,"wires":[["6fe6c1c4.b3ec"]]},{"id":"3f171e6c.5bb492","type":"ui_button","z":"80fce41e.4db188","name":"Audio Alarm Signal Enabled","group":"e2c90946.abf778","order":2,"width":0,"height":0,"passthru":false,"label":"Audio Alarm Signal Enabled","color":"#ffffff","bgcolor":"#f17c35","icon":"fa-bell","payload":"{\"val\" : \"ON\"}","payloadType":"json","topic":"snap","x":120,"y":1390,"wires":[["55a91dac.605084"]]},{"id":"878bd149.ea8cf","type":"mqtt in","z":"80fce41e.4db188","name":"Set Alarm Snap","topic":"ipcam/office/alarm/setmdalarm/link","qos":"1","broker":"40415d07.67dd94","x":90,"y":1670,"wires":[["f3e9b71d.814e08"]]},{"id":"19374462.ffc80c","type":"switch","z":"80fce41e.4db188","name":"Push","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":411,"y":1670,"wires":[["5a054e23.1a95d"],["b7ddd4e1.160c98"]]},{"id":"5a054e23.1a95d","type":"function","z":"80fce41e.4db188","name":"Link PIR & Areas","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"type\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdalarm&-aname=type&-switch=on&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":566,"y":1647,"wires":[["ba21fcf2.4835b"]]},{"id":"91cf6a23.c3d358","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{\"val\" : \"ON\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":954,"y":1647,"wires":[["339276cd.78cfca"]]},{"id":"339276cd.78cfca","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":1098,"y":1686,"wires":[["d7bde5d7.897168"]]},{"id":"ba21fcf2.4835b","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":713,"y":1647,"wires":[["bef5ae86.e0a5c"]]},{"id":"bef5ae86.e0a5c","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":833,"y":1647,"wires":[["91cf6a23.c3d358"]]},{"id":"a6f1aead.1433b","type":"mqtt out","z":"80fce41e.4db188","name":"Set Alarm Snap","topic":"ipcam/office/alarm/setmdalarm/link","qos":"1","retain":"","broker":"40415d07.67dd94","x":310,"y":1610,"wires":[]},{"id":"f3e9b71d.814e08","type":"function","z":"80fce41e.4db188","name":"process value","func":"msg.payload = JSON.parse(msg.payload).val;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":1670,"wires":[["19374462.ffc80c"]]},{"id":"20d23861.55b398","type":"ui_button","z":"80fce41e.4db188","name":"Unlink PIR & Areas","group":"da99bfaa.fad94","order":3,"width":0,"height":0,"passthru":false,"label":"Unlink PIR & Areas","color":"#000000","bgcolor":"#dddddd","icon":"fa-bell","payload":"{\"val\" : \"OFF\"}","payloadType":"json","topic":"snap","x":100,"y":1630,"wires":[["a6f1aead.1433b"]]},{"id":"b7ddd4e1.160c98","type":"function","z":"80fce41e.4db188","name":"Unlink PIR $ Areas","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"type\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdalarm&-aname=type&-switch=off&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":566,"y":1687,"wires":[["48f6a55d.30dbac"]]},{"id":"48f6a55d.30dbac","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":713,"y":1687,"wires":[["d1483283.a565"]]},{"id":"d1483283.a565","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":833,"y":1687,"wires":[["530f61a4.e78ee"]]},{"id":"530f61a4.e78ee","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{\"val\" : \"OFF\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":953,"y":1687,"wires":[["339276cd.78cfca"]]},{"id":"ada57855.e161e8","type":"ui_button","z":"80fce41e.4db188","name":"Link PIR & Areas","group":"da99bfaa.fad94","order":2,"width":0,"height":0,"passthru":false,"label":"Link PIR & Areas","color":"#ffffff","bgcolor":"#f17c35","icon":"fa-bell","payload":"{\"val\" : \"ON\"}","payloadType":"json","topic":"snap","x":100,"y":1590,"wires":[["a6f1aead.1433b"]]},{"id":"257de8a6.1c1428","type":"http request","z":"80fce41e.4db188","name":"emailsnap","method":"GET","ret":"txt","url":"","tls":"","x":948,"y":405,"wires":[["a20da15a.c91b9"]]},{"id":"4c91aeb1.cef98","type":"function","z":"80fce41e.4db188","name":"emailsnap","func":"var ip = msg.payload.ip;\nvar user = msg.payload.user;\nvar password = msg.payload.password;\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 = \"emailsnap\";\nmsg.payload = ip+\"/param.cgi?cmd=getmdalarm&-aname=emailsnap&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":764,"y":357,"wires":[["f88573df.f21ab"]]},{"id":"df17fd4b.3b892","type":"mqtt in","z":"80fce41e.4db188","name":"","topic":"ipcam/login/office","qos":"1","broker":"40415d07.67dd94","x":567,"y":358,"wires":[["c789888c.60f428"]]},{"id":"c789888c.60f428","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":629,"y":414,"wires":[["4c91aeb1.cef98"]]},{"id":"f88573df.f21ab","type":"change","z":"80fce41e.4db188","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":798,"y":405,"wires":[["257de8a6.1c1428"]]},{"id":"a20da15a.c91b9","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"var md_emailsnap_switch=\"off\";"},{"type":"str","value":"{\"val\" : \"OFF\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"var md_emailsnap_switch=\"on\";"},{"type":"str","value":"{\"val\" : \"ON\"}"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":952,"y":348,"wires":[["62b93d9c.a9ea04"]]},{"id":"28a38703.624978","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":955,"y":596,"wires":[["fc77c352.98513"]]},{"id":"f0dcf5.90e13308","type":"function","z":"80fce41e.4db188","name":"snap","func":"var ip = msg.payload.ip;\nvar user = msg.payload.user;\nvar password = msg.payload.password;\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 = \"snap\";\nmsg.payload = ip+\"/param.cgi?cmd=getmdalarm&-aname=snap&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":759,"y":546,"wires":[["d17d4ae2.182688"]]},{"id":"2e68794d.772c26","type":"mqtt in","z":"80fce41e.4db188","name":"","topic":"ipcam/login/office","qos":"1","broker":"40415d07.67dd94","x":573,"y":546,"wires":[["858ad846.5c9898"]]},{"id":"858ad846.5c9898","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":635,"y":604,"wires":[["f0dcf5.90e13308"]]},{"id":"d17d4ae2.182688","type":"change","z":"80fce41e.4db188","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":815,"y":596,"wires":[["28a38703.624978"]]},{"id":"fc77c352.98513","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"var md_snap_switch=\"off\";"},{"type":"str","value":"{ \"val\": \"OFF\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"var md_snap_switch=\"on\";"},{"type":"str","value":"{ \"val\": \"ON\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":978,"y":550,"wires":[["fd9bc83c.d2bfd8"]]},{"id":"9a6e4ad8.eefa08","type":"http request","z":"80fce41e.4db188","name":"ftpsnap","method":"GET","ret":"txt","url":"","tls":"","x":910,"y":789,"wires":[["bd012a06.97c988"]]},{"id":"c738d257.541ba","type":"function","z":"80fce41e.4db188","name":"ftpsnap","func":"var ip = msg.payload.ip;\nvar user = msg.payload.user;\nvar password = msg.payload.password;\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 = \"ftpsnap\";\nmsg.payload = ip+\"/param.cgi?cmd=getmdalarm&-aname=ftpsnap&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":708,"y":744,"wires":[["6af437c4.03f3a8"]]},{"id":"73372e8a.dd5b2","type":"mqtt in","z":"80fce41e.4db188","name":"","topic":"ipcam/login/office","qos":"1","broker":"40415d07.67dd94","x":530,"y":743,"wires":[["bc8d7628.f96438"]]},{"id":"bc8d7628.f96438","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":604,"y":795,"wires":[["c738d257.541ba"]]},{"id":"6af437c4.03f3a8","type":"change","z":"80fce41e.4db188","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":779,"y":789,"wires":[["9a6e4ad8.eefa08"]]},{"id":"bd012a06.97c988","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"var md_ftpsnap_switch=\"off\";"},{"type":"str","value":"{ \"val\": \"OFF\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"var md_ftpsnap_switch=\"on\";"},{"type":"str","value":"{ \"val\": \"ON\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":970,"y":739,"wires":[["abdbe440.176a18"]]},{"id":"ea7537aa.76a878","type":"http request","z":"80fce41e.4db188","name":"recording","method":"GET","ret":"txt","url":"","tls":"","x":929,"y":986,"wires":[["abd03a9c.c53ab8"]]},{"id":"3c2c2e21.1db772","type":"function","z":"80fce41e.4db188","name":"recording","func":"var ip = msg.payload.ip;\nvar user = msg.payload.user;\nvar password = msg.payload.password;\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 = \"record\";\nmsg.payload = ip+\"/param.cgi?cmd=getmdalarm&-aname=record&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":718,"y":939,"wires":[["9bd96390.7d85b"]]},{"id":"36274444.9f9f5c","type":"mqtt in","z":"80fce41e.4db188","name":"","topic":"ipcam/login/office","qos":"1","broker":"40415d07.67dd94","x":531,"y":939,"wires":[["1f0284d6.24f6eb"]]},{"id":"1f0284d6.24f6eb","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":604,"y":990,"wires":[["3c2c2e21.1db772"]]},{"id":"9bd96390.7d85b","type":"change","z":"80fce41e.4db188","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":788,"y":986,"wires":[["ea7537aa.76a878"]]},{"id":"abd03a9c.c53ab8","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"var md_record_switch=\"off\";"},{"type":"str","value":"{\"val\" : \"OFF\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"var md_record_switch=\"on\";"},{"type":"str","value":"{\"val\" : \"ON\"}"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":970,"y":934,"wires":[["6acd934f.b493ac"]]},{"id":"dd76019e.f8f86","type":"http request","z":"80fce41e.4db188","name":"ftprecording","method":"GET","ret":"txt","url":"","tls":"","x":927,"y":1189,"wires":[["66f1f99.9514008"]]},{"id":"b5dafef3.e5d7c","type":"function","z":"80fce41e.4db188","name":"ftp recording","func":"var ip = msg.payload.ip;\nvar user = msg.payload.user;\nvar password = msg.payload.password;\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 = \"ftprec\";\nmsg.payload = ip+\"/param.cgi?cmd=getmdalarm&-aname=ftprec&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":728,"y":1139,"wires":[["9fae0314.60bfb"]]},{"id":"44481ee3.5ebff","type":"mqtt in","z":"80fce41e.4db188","name":"","topic":"ipcam/login/office","qos":"1","broker":"40415d07.67dd94","x":530,"y":1138,"wires":[["4e77ed82.9a6d74"]]},{"id":"4e77ed82.9a6d74","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":604,"y":1190,"wires":[["b5dafef3.e5d7c"]]},{"id":"9fae0314.60bfb","type":"change","z":"80fce41e.4db188","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":786,"y":1189,"wires":[["dd76019e.f8f86"]]},{"id":"66f1f99.9514008","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"var md_ftprec_switch=\"off\";"},{"type":"str","value":"{\"val\" : \"OFF\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"var md_ftprec_switch=\"on\";"},{"type":"str","value":"{\"val\" : \"ON\"}"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":970,"y":1134,"wires":[["38dc592b.644726"]]},{"id":"5034c41c.63868c","type":"http request","z":"80fce41e.4db188","name":"relay","method":"GET","ret":"txt","url":"","tls":"","x":908,"y":1386,"wires":[["ffed7af5.fc4f78"]]},{"id":"31e407bb.f60218","type":"function","z":"80fce41e.4db188","name":"relay","func":"var ip = msg.payload.ip;\nvar user = msg.payload.user;\nvar password = msg.payload.password;\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 = \"relay\";\nmsg.payload = ip+\"/param.cgi?cmd=getmdalarm&-aname=relay&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":688,"y":1339,"wires":[["24b7d9f6.2b0c36"]]},{"id":"81de5ec3.9d635","type":"mqtt in","z":"80fce41e.4db188","name":"","topic":"ipcam/login/office","qos":"1","broker":"40415d07.67dd94","x":509,"y":1338,"wires":[["a20a0f59.52cb9"]]},{"id":"a20a0f59.52cb9","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":584,"y":1390,"wires":[["31e407bb.f60218"]]},{"id":"24b7d9f6.2b0c36","type":"change","z":"80fce41e.4db188","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":777,"y":1386,"wires":[["5034c41c.63868c"]]},{"id":"ffed7af5.fc4f78","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"var md_relay_switch=\"off\";"},{"type":"str","value":"{\"val\" : \"OFF\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"var md_relay_switch=\"on\";"},{"type":"str","value":"{\"val\" : \"ON\"}"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":950,"y":1334,"wires":[["a06e8000.dd74f"]]},{"id":"aa716453.83c528","type":"http request","z":"80fce41e.4db188","name":"sound","method":"GET","ret":"txt","url":"","tls":"","x":963,"y":1587,"wires":[["dbed64ba.c4f6b8"]]},{"id":"fab2e09d.ca8e9","type":"function","z":"80fce41e.4db188","name":"sound","func":"var ip = msg.payload.ip;\nvar user = msg.payload.user;\nvar password = msg.payload.password;\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 = \"sound\";\nmsg.payload = ip+\"/param.cgi?cmd=getmdalarm&-aname=sound&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":748,"y":1539,"wires":[["84cda4a.b4f1c58"]]},{"id":"a07e3369.4a1b4","type":"mqtt in","z":"80fce41e.4db188","name":"","topic":"ipcam/login/office","qos":"1","broker":"40415d07.67dd94","x":570,"y":1538,"wires":[["88410237.6d928"]]},{"id":"88410237.6d928","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":644,"y":1590,"wires":[["fab2e09d.ca8e9"]]},{"id":"84cda4a.b4f1c58","type":"change","z":"80fce41e.4db188","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":832,"y":1587,"wires":[["aa716453.83c528"]]},{"id":"dbed64ba.c4f6b8","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"var md_sound_switch=\"off\";"},{"type":"str","value":"{\"val\" : \"OFF\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"var md_sound_switch=\"on\";"},{"type":"str","value":"{\"val\" : \"ON\"}"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":1010,"y":1534,"wires":[["6fe6c1c4.b3ec"]]},{"id":"c83a35f4.84aa08","type":"http request","z":"80fce41e.4db188","name":"link","method":"GET","ret":"txt","url":"","tls":"","x":905,"y":1775,"wires":[["38d88475.2fac1c"]]},{"id":"a9d36ad.bfa9298","type":"function","z":"80fce41e.4db188","name":"type","func":"var ip = msg.payload.ip;\nvar user = msg.payload.user;\nvar password = msg.payload.password;\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 = \"type\";\nmsg.payload = ip+\"/param.cgi?cmd=getmdalarm&-aname=type&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":699,"y":1725,"wires":[["9ff1da5b.a7b868"]]},{"id":"2d74a76.6117d58","type":"mqtt in","z":"80fce41e.4db188","name":"","topic":"ipcam/login/office","qos":"1","broker":"40415d07.67dd94","x":518,"y":1724,"wires":[["adedac81.5475d"]]},{"id":"adedac81.5475d","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":590,"y":1776,"wires":[["a9d36ad.bfa9298"]]},{"id":"9ff1da5b.a7b868","type":"change","z":"80fce41e.4db188","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":764,"y":1775,"wires":[["c83a35f4.84aa08"]]},{"id":"38d88475.2fac1c","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"var md_alarm_type=\"off\";"},{"type":"str","value":"{\"val\" : \"OFF\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"var md_alarm_type=\"on\";"},{"type":"str","value":"{\"val\" : \"ON\"}"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":956,"y":1725,"wires":[["339276cd.78cfca"]]},{"id":"1438d0fc.9cd45f","type":"mqtt in","z":"80fce41e.4db188","name":"Set Audio Alarm","topic":"ipcam/office/alarm/setaudioalarmattr/audiodetection","qos":"1","broker":"40415d07.67dd94","x":90,"y":1869,"wires":[["c2490083.9b697"]]},{"id":"75829d1.9aa8964","type":"switch","z":"80fce41e.4db188","name":"Push","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":411,"y":1869,"wires":[["afb4eb3f.ab0bf8"],["8488d4d5.f07e88"]]},{"id":"afb4eb3f.ab0bf8","type":"function","z":"80fce41e.4db188","name":"Enable Audio Detection","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"type\";\nmsg.payload = ip+\"/param.cgi?cmd=setaudioalarmattr&-aa_enable=1&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":576,"y":1846,"wires":[["245d05e1.c6975a"]]},{"id":"ee1d56aa.8da248","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{\"val\" : \"ON\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":973,"y":1846,"wires":[["bdc84f.90f9d7b"]]},{"id":"bdc84f.90f9d7b","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":1124,"y":1886,"wires":[["69879b81.cf9cf4"]]},{"id":"245d05e1.c6975a","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":732,"y":1846,"wires":[["2d1e3c7.8dc52c4"]]},{"id":"2d1e3c7.8dc52c4","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":852,"y":1846,"wires":[["ee1d56aa.8da248"]]},{"id":"5bc4fda.75f8f04","type":"mqtt out","z":"80fce41e.4db188","name":"Set Audio Alarm","topic":"ipcam/office/alarm/setaudioalarmattr/audiodetection","qos":"1","retain":"","broker":"40415d07.67dd94","x":330,"y":1809,"wires":[]},{"id":"c2490083.9b697","type":"function","z":"80fce41e.4db188","name":"process value","func":"msg.payload = JSON.parse(msg.payload).val;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":1869,"wires":[["75829d1.9aa8964"]]},{"id":"528fcbcc.1003d4","type":"ui_button","z":"80fce41e.4db188","name":"Deactivate Audio Detection","group":"bf705aeb.5fd578","order":3,"width":0,"height":0,"passthru":false,"label":"Deactivate Audio Detection","color":"#000000","bgcolor":"#dddddd","icon":"fa-bell","payload":"{\"val\" : \"OFF\"}","payloadType":"json","topic":"snap","x":120,"y":1829,"wires":[["5bc4fda.75f8f04"]]},{"id":"8488d4d5.f07e88","type":"function","z":"80fce41e.4db188","name":"Disable Audio Detection","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"type\";\nmsg.payload = ip+\"/param.cgi?cmd=setaudioalarmattr&-aa_enable=0&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":576,"y":1886,"wires":[["3a5f45e1.04fb4a"]]},{"id":"3a5f45e1.04fb4a","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":732,"y":1886,"wires":[["57016a3d.1f7854"]]},{"id":"57016a3d.1f7854","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":852,"y":1886,"wires":[["11179d60.c428a3"]]},{"id":"11179d60.c428a3","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{\"val\" : \"OFF\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":972,"y":1886,"wires":[["bdc84f.90f9d7b"]]},{"id":"96604e3b.d7485","type":"http request","z":"80fce41e.4db188","name":"aa_enable","method":"GET","ret":"txt","url":"","tls":"","x":860,"y":1929,"wires":[["760af0f1.9cad6"]]},{"id":"53f9225a.3bc76c","type":"function","z":"80fce41e.4db188","name":"aa_enabled","func":"var ip = msg.payload.ip;\nvar user = msg.payload.user;\nvar password = msg.payload.password;\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 = \"type\";\nmsg.payload = ip+\"/param.cgi?cmd=getaudioalarmattr&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":681,"y":1937,"wires":[["143c58d3.50ecb7"]]},{"id":"89b47b48.da6328","type":"mqtt in","z":"80fce41e.4db188","name":"","topic":"ipcam/login/office","qos":"1","broker":"40415d07.67dd94","x":486,"y":1936,"wires":[["180e09d4.8af4d6"]]},{"id":"180e09d4.8af4d6","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":573,"y":1988,"wires":[["53f9225a.3bc76c"]]},{"id":"143c58d3.50ecb7","type":"change","z":"80fce41e.4db188","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":800,"y":1989,"wires":[["96604e3b.d7485"]]},{"id":"1722942f.6eb3dc","type":"ui_button","z":"80fce41e.4db188","name":"Activate Audio Detection","group":"bf705aeb.5fd578","order":2,"width":0,"height":0,"passthru":false,"label":"Activate Audio Detection","color":"#ffffff","bgcolor":"#f17c35","icon":"fa-bell","payload":"{\"val\" : \"ON\"}","payloadType":"json","topic":"snap","x":120,"y":1789,"wires":[["5bc4fda.75f8f04"]]},{"id":"760af0f1.9cad6","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"delRightMost","params":[{"type":"str","value":";"}]},{"name":"append","params":[{"type":"str","value":" }"}]},{"name":"prepend","params":[{"type":"str","value":"{ "}]},{"name":"replaceAll","params":[{"type":"str","value":"var "},{"type":"str","value":"\""}]},{"name":"replaceAll","params":[{"type":"str","value":"="},{"type":"str","value":"\":"}]},{"name":"replaceAll","params":[{"type":"str","value":";"},{"type":"str","value":","}]},{"name":"replaceAll","params":[{"type":"str","value":"aa_enable"},{"type":"str","value":"val"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":970,"y":1989,"wires":[["ec14b2e4.4c0b7"]]},{"id":"ec14b2e4.4c0b7","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":1011,"y":1935,"wires":[["2b0e8397.afa7bc"]]},{"id":"2b0e8397.afa7bc","type":"change","z":"80fce41e.4db188","name":"change 1/0","rules":[{"t":"change","p":"payload.val","pt":"msg","from":"0","fromt":"str","to":"OFF","tot":"str"},{"t":"change","p":"payload.val","pt":"msg","from":"1","fromt":"str","to":"ON","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1143,"y":1935,"wires":[["69879b81.cf9cf4"]]},{"id":"62c43a74.3e95d4","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"delRightMost","params":[{"type":"str","value":";"}]},{"name":"append","params":[{"type":"str","value":" }"}]},{"name":"prepend","params":[{"type":"str","value":"{ "}]},{"name":"replaceAll","params":[{"type":"str","value":"var "},{"type":"str","value":"\""}]},{"name":"replaceAll","params":[{"type":"str","value":"="},{"type":"str","value":"\":"}]},{"name":"replaceAll","params":[{"type":"str","value":";"},{"type":"str","value":","}]},{"name":"replaceAll","params":[{"type":"str","value":"aa_time"},{"type":"str","value":"val"}]},{"name":"replaceAll","params":[{"type":"str","value":"0"},{"type":"str","value":"ON"}]},{"name":"replaceAll","params":[{"type":"str","value":"10"},{"type":"str","value":"OFF"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":970,"y":2329,"wires":[["9a624f36.e522d"]]},{"id":"312a21ed.09aade","type":"mqtt in","z":"80fce41e.4db188","name":"Set AA Sensitivity","topic":"ipcam/office/alarm/setaudioalarmattr/highsensitivity","qos":"1","broker":"40415d07.67dd94","x":90,"y":2069,"wires":[["92b5c27d.56ca"]]},{"id":"abab50b4.2b952","type":"switch","z":"80fce41e.4db188","name":"Push","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":411,"y":2069,"wires":[["8bf497d8.3e3f78"],["4c7bd377.6605cc"]]},{"id":"8bf497d8.3e3f78","type":"function","z":"80fce41e.4db188","name":"Sensitivity 100%","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"sensitivity\";\nmsg.payload = ip+\"/param.cgi?cmd=setaudioalarmattr&-aa_value=100&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":566,"y":2046,"wires":[["93c6384d.f8b5f8"]]},{"id":"60e30f03.c838b","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{ \"val\": \"ON\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":973,"y":2046,"wires":[["509bf91b.f68e28"]]},{"id":"509bf91b.f68e28","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":1112,"y":2085,"wires":[["9e83f17.835811"]]},{"id":"93c6384d.f8b5f8","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":732,"y":2046,"wires":[["94c3ccd2.7e55a"]]},{"id":"94c3ccd2.7e55a","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":852,"y":2046,"wires":[["60e30f03.c838b"]]},{"id":"699ac4c9.e4845c","type":"mqtt out","z":"80fce41e.4db188","name":"Set AA Sensitivity","topic":"ipcam/office/alarm/setaudioalarmattr/highsensitivity","qos":"1","retain":"","broker":"40415d07.67dd94","x":287,"y":2009,"wires":[]},{"id":"92b5c27d.56ca","type":"function","z":"80fce41e.4db188","name":"process value","func":"msg.payload = JSON.parse(msg.payload).val;\nreturn msg;","outputs":1,"noerr":0,"x":271,"y":2069,"wires":[["abab50b4.2b952"]]},{"id":"9c005af7.d32468","type":"ui_button","z":"80fce41e.4db188","name":"Low Sensitivity","group":"44bf7540.54529c","order":3,"width":0,"height":0,"passthru":false,"label":"Low Sensitivity","color":"#000000","bgcolor":"#dddddd","icon":"fa-bell","payload":"{ \"val\" : \"OFF\"}","payloadType":"json","topic":"sensitivity","x":90,"y":2029,"wires":[["699ac4c9.e4845c"]]},{"id":"4c7bd377.6605cc","type":"function","z":"80fce41e.4db188","name":"Sensitivity 50%","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"sensitivity\";\nmsg.payload = ip+\"/param.cgi?cmd=setaudioalarmattr&-aa_value=50&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":556,"y":2086,"wires":[["20c9a8e3.c715a8"]]},{"id":"20c9a8e3.c715a8","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":732,"y":2086,"wires":[["fab2cfb4.7cb2c"]]},{"id":"fab2cfb4.7cb2c","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":852,"y":2086,"wires":[["c2db0050.ba0ee"]]},{"id":"c2db0050.ba0ee","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{ \"val\": \"OFF\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":972,"y":2086,"wires":[["509bf91b.f68e28"]]},{"id":"bca5a51c.2f1458","type":"http request","z":"80fce41e.4db188","name":"aa_value","method":"GET","ret":"txt","url":"","tls":"","x":860,"y":2129,"wires":[["195fc3c1.643c1c"]]},{"id":"b6203474.a92088","type":"function","z":"80fce41e.4db188","name":"aa_value","func":"var ip = msg.payload.ip;\nvar user = msg.payload.user;\nvar password = msg.payload.password;\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 = \"aa_value\";\nmsg.payload = ip+\"/param.cgi?cmd=getaudioalarmattr&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":684,"y":2137,"wires":[["3efed7b7.151ca8"]]},{"id":"a7b82d4d.be778","type":"mqtt in","z":"80fce41e.4db188","name":"","topic":"ipcam/login/office","qos":"1","broker":"40415d07.67dd94","x":490,"y":2136,"wires":[["c1d0126a.2b75e"]]},{"id":"c1d0126a.2b75e","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":590,"y":2188,"wires":[["b6203474.a92088"]]},{"id":"3efed7b7.151ca8","type":"change","z":"80fce41e.4db188","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":800,"y":2189,"wires":[["bca5a51c.2f1458"]]},{"id":"bcc84c86.7b213","type":"ui_button","z":"80fce41e.4db188","name":"High Sensitivity","group":"44bf7540.54529c","order":2,"width":0,"height":0,"passthru":false,"label":"High Sensitivity","color":"#ffffff","bgcolor":"#f17c35","icon":"fa-bell","payload":"{ \"val\" : \"ON\"}","payloadType":"json","topic":"sensitivity","x":90,"y":1989,"wires":[["699ac4c9.e4845c"]]},{"id":"195fc3c1.643c1c","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"delRightMost","params":[{"type":"str","value":";"}]},{"name":"append","params":[{"type":"str","value":" }"}]},{"name":"prepend","params":[{"type":"str","value":"{ "}]},{"name":"replaceAll","params":[{"type":"str","value":"var "},{"type":"str","value":"\""}]},{"name":"replaceAll","params":[{"type":"str","value":"="},{"type":"str","value":"\":"}]},{"name":"replaceAll","params":[{"type":"str","value":";"},{"type":"str","value":","}]},{"name":"replaceAll","params":[{"type":"str","value":"aa_value"},{"type":"str","value":"val"}]},{"name":"replaceAll","params":[{"type":"str","value":"100"},{"type":"str","value":"ON"}]},{"name":"replaceAll","params":[{"type":"str","value":"50"},{"type":"str","value":"OFF"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":984,"y":2129,"wires":[["509bf91b.f68e28"]]},{"id":"d78c9f0c.94af4","type":"mqtt in","z":"80fce41e.4db188","name":"Set AA Treshold","topic":"ipcam/office/alarm/setaudioalarmattr/treshold","qos":"1","broker":"40415d07.67dd94","x":90,"y":2269,"wires":[["182221e.5b8e9de"]]},{"id":"84b6e695.c6faf8","type":"switch","z":"80fce41e.4db188","name":"Push","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":410,"y":2269,"wires":[["727eb078.61aed"],["ca2d0603.792198"]]},{"id":"727eb078.61aed","type":"function","z":"80fce41e.4db188","name":"Threshold 0s","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"Time Treshold\";\nmsg.payload = ip+\"/param.cgi?cmd=setaudioalarmattr&-aa_time=0&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":556,"y":2246,"wires":[["b2b78cee.4200c"]]},{"id":"76cddaf3.d7ff44","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{ \"val\": \"ON\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":973,"y":2246,"wires":[["9a624f36.e522d"]]},{"id":"9a624f36.e522d","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":1111,"y":2285,"wires":[["c363ee0d.c6964"]]},{"id":"b2b78cee.4200c","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":732,"y":2246,"wires":[["a8e586e5.bc74f8"]]},{"id":"a8e586e5.bc74f8","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":852,"y":2246,"wires":[["76cddaf3.d7ff44"]]},{"id":"182221e.5b8e9de","type":"function","z":"80fce41e.4db188","name":"process value","func":"msg.payload = JSON.parse(msg.payload).val;\nreturn msg;","outputs":1,"noerr":0,"x":271,"y":2269,"wires":[["84b6e695.c6faf8"]]},{"id":"ca7aed25.69d38","type":"ui_button","z":"80fce41e.4db188","name":"High Treshold 10s","group":"21b971bc.496f1e","order":3,"width":0,"height":0,"passthru":false,"label":"High Treshold 10s","color":"#000000","bgcolor":"#dddddd","icon":"fa-bell","payload":"{\"val\" : \"OFF\"}","payloadType":"json","topic":"threshold","x":100,"y":2229,"wires":[["b8590955.38de38"]]},{"id":"ca2d0603.792198","type":"function","z":"80fce41e.4db188","name":"Treshold 10s","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"sensitivity\";\nmsg.payload = ip+\"/param.cgi?cmd=setaudioalarmattr&-aa_time=10&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":556,"y":2286,"wires":[["9eae76c1.216438"]]},{"id":"9eae76c1.216438","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":732,"y":2286,"wires":[["f3359dd1.3e496"]]},{"id":"f3359dd1.3e496","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":852,"y":2286,"wires":[["58730be7.0cdb04"]]},{"id":"58730be7.0cdb04","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{ \"val\": \"OFF\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":972,"y":2286,"wires":[["9a624f36.e522d"]]},{"id":"e4b42100.0dbb5","type":"http request","z":"80fce41e.4db188","name":"aa_time","method":"GET","ret":"txt","url":"","tls":"","x":850,"y":2329,"wires":[["62c43a74.3e95d4"]]},{"id":"20a762e9.ef8e5e","type":"function","z":"80fce41e.4db188","name":"aa_time","func":"var ip = msg.payload.ip;\nvar user = msg.payload.user;\nvar password = msg.payload.password;\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 = \"aa_time\";\nmsg.payload = ip+\"/param.cgi?cmd=getaudioalarmattr&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":694,"y":2337,"wires":[["f82b3a89.73f3f8"]]},{"id":"eefbe119.ac327","type":"mqtt in","z":"80fce41e.4db188","name":"","topic":"ipcam/login/office","qos":"1","broker":"40415d07.67dd94","x":518,"y":2336,"wires":[["a883279a.e40258"]]},{"id":"a883279a.e40258","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":590,"y":2388,"wires":[["20a762e9.ef8e5e"]]},{"id":"f82b3a89.73f3f8","type":"change","z":"80fce41e.4db188","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":800,"y":2389,"wires":[["e4b42100.0dbb5"]]},{"id":"b8590955.38de38","type":"mqtt out","z":"80fce41e.4db188","name":"Set AA Treshold","topic":"ipcam/office/alarm/setaudioalarmattr/treshold","qos":"1","retain":"","broker":"40415d07.67dd94","x":330,"y":2209,"wires":[]},{"id":"15e8009c.5ce26f","type":"ui_button","z":"80fce41e.4db188","name":"Low Treshold 0s","group":"21b971bc.496f1e","order":2,"width":0,"height":0,"passthru":false,"label":"Low Treshold 0s","color":"#ffffff","bgcolor":"#f17c35","icon":"fa-bell","payload":"{\"val\" : \"ON\"}","payloadType":"json","topic":"threshold","x":100,"y":2189,"wires":[["b8590955.38de38"]]},{"id":"1f6a5fdb.dd4f7","type":"mqtt in","z":"80fce41e.4db188","name":"Set Alarm Snap","topic":"ipcam/office/alarm/setioattr/input","qos":"1","broker":"40415d07.67dd94","x":90,"y":2469,"wires":[["25724d85.4d7012"]]},{"id":"f235d5b8.1ce098","type":"switch","z":"80fce41e.4db188","name":"Push","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":411,"y":2469,"wires":[["61d31024.e54b"],["bdeeed7.074c81"]]},{"id":"61d31024.e54b","type":"function","z":"80fce41e.4db188","name":"Input Enabled","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"relay\";\nmsg.payload = ip+\"/param.cgi?cmd=setioattr&-io_enable=1&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":556,"y":2446,"wires":[["ca33b8e9.265e38"]]},{"id":"faf25ce0.af1e2","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{\"val\" : \"ON\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":946,"y":2446,"wires":[["50699c92.435b74"]]},{"id":"50699c92.435b74","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":1082,"y":2483,"wires":[["446e5729.202b28"]]},{"id":"ca33b8e9.265e38","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":705,"y":2446,"wires":[["a7ba2bd4.201ed8"]]},{"id":"a7ba2bd4.201ed8","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":825,"y":2446,"wires":[["faf25ce0.af1e2"]]},{"id":"25724d85.4d7012","type":"function","z":"80fce41e.4db188","name":"process value","func":"msg.payload = JSON.parse(msg.payload).val;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":2469,"wires":[["f235d5b8.1ce098"]]},{"id":"bdeeed7.074c81","type":"function","z":"80fce41e.4db188","name":"Input Disabled","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"relay\";\nmsg.payload = ip+\"/param.cgi?cmd=setioattr&-io_enable=0&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":556,"y":2486,"wires":[["41efc930.a8d1d8"]]},{"id":"41efc930.a8d1d8","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":705,"y":2486,"wires":[["2d79f6f.360460a"]]},{"id":"2d79f6f.360460a","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":825,"y":2486,"wires":[["bf420bfd.629c78"]]},{"id":"bf420bfd.629c78","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{\"val\" : \"OFF\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":945,"y":2486,"wires":[["50699c92.435b74"]]},{"id":"7d39897f.1566e8","type":"function","z":"80fce41e.4db188","name":"input","func":"var ip = msg.payload.ip;\nvar user = msg.payload.user;\nvar password = msg.payload.password;\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 = \"relay\";\nmsg.payload = ip+\"/param.cgi?cmd=getioattr&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":702,"y":2539,"wires":[["aa00b4a8.07c8f8"]]},{"id":"33e8c114.ea8fbe","type":"mqtt in","z":"80fce41e.4db188","name":"","topic":"ipcam/login/office","qos":"1","broker":"40415d07.67dd94","x":521,"y":2538,"wires":[["490550f3.106db"]]},{"id":"a20951e1.bbeca","type":"ui_button","z":"80fce41e.4db188","name":"Set Alarm Input","group":"a2c3b179.dc59","order":3,"width":0,"height":0,"passthru":false,"label":"Set Alarm Input","color":"#000000","bgcolor":"#dddddd","icon":"fa-bell","payload":"{\"val\" : \"OFF\"}","payloadType":"json","topic":"snap","x":90,"y":2429,"wires":[["5aec5332.87071c"]]},{"id":"86614fe8.73d6a","type":"ui_button","z":"80fce41e.4db188","name":"Set Alarm Input","group":"a2c3b179.dc59","order":2,"width":0,"height":0,"passthru":false,"label":"Set Alarm Input","color":"#ffffff","bgcolor":"#f17c35","icon":"fa-bell","payload":"{\"val\" : \"ON\"}","payloadType":"json","topic":"snap","x":90,"y":2389,"wires":[["5aec5332.87071c"]]},{"id":"5aec5332.87071c","type":"mqtt out","z":"80fce41e.4db188","name":"Set Alarm Input","topic":"ipcam/office/alarm/setioattr/input","qos":"1","retain":"","broker":"40415d07.67dd94","x":262,"y":2409,"wires":[]},{"id":"490550f3.106db","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":584,"y":2590,"wires":[["7d39897f.1566e8"]]},{"id":"aa00b4a8.07c8f8","type":"change","z":"80fce41e.4db188","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":748,"y":2589,"wires":[["2541d47a.1f0b4c"]]},{"id":"2541d47a.1f0b4c","type":"http request","z":"80fce41e.4db188","name":"relay","method":"GET","ret":"txt","url":"","tls":"","x":878,"y":2589,"wires":[["e85a271b.a21508"]]},{"id":"e85a271b.a21508","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"delRightMost","params":[{"type":"str","value":";"}]},{"name":"append","params":[{"type":"str","value":" }"}]},{"name":"prepend","params":[{"type":"str","value":"{ "}]},{"name":"replaceAll","params":[{"type":"str","value":"var "},{"type":"str","value":"\""}]},{"name":"replaceAll","params":[{"type":"str","value":"="},{"type":"str","value":"\":"}]},{"name":"replaceAll","params":[{"type":"str","value":";"},{"type":"str","value":","}]},{"name":"replaceAll","params":[{"type":"str","value":"io_enable"},{"type":"str","value":"val"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":864,"y":2536,"wires":[["adf76c4e.12f"]]},{"id":"adf76c4e.12f","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":985,"y":2536,"wires":[["dd4622d.1242fe"]]},{"id":"dd4622d.1242fe","type":"change","z":"80fce41e.4db188","name":"change 1/0","rules":[{"t":"change","p":"payload.val","pt":"msg","from":"0","fromt":"str","to":"OFF","tot":"str"},{"t":"change","p":"payload.val","pt":"msg","from":"1","fromt":"str","to":"ON","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1057,"y":2589,"wires":[["446e5729.202b28"]]},{"id":"4b3931db.1fc6a","type":"mqtt in","z":"80fce41e.4db188","name":"Input Circuit","topic":"ipcam/office/alarm/setioattr/inputcirc","qos":"1","broker":"40415d07.67dd94","x":80,"y":2669,"wires":[["f5b23a83.c9dcf8"]]},{"id":"ad3bd2e7.f320f","type":"switch","z":"80fce41e.4db188","name":"Push","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":411,"y":2669,"wires":[["67e527b3.e6fff8"],["4649c486.9d394c"]]},{"id":"67e527b3.e6fff8","type":"function","z":"80fce41e.4db188","name":"Input Circuit N.C.","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"relay\";\nmsg.payload = ip+\"/param.cgi?cmd=setioattr&-io_flag=0&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":566,"y":2646,"wires":[["4a761122.d536f"]]},{"id":"abf7f5e1.70e248","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{ \"val\": \"ON\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":946,"y":2646,"wires":[["f1adaf69.292c8"]]},{"id":"f1adaf69.292c8","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":1086,"y":2684,"wires":[["c5b79307.d0f69"]]},{"id":"c5b79307.d0f69","type":"ui_text","z":"80fce41e.4db188","group":"7b7b9d91.5496c4","order":1,"width":0,"height":0,"name":"N.C. Mode","label":"N.C. Mode","format":"{{msg.payload.val}}","layout":"row-spread","x":1216,"y":2684,"wires":[]},{"id":"4a761122.d536f","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":711,"y":2646,"wires":[["78e8ca28.d1a8c4"]]},{"id":"78e8ca28.d1a8c4","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":825,"y":2646,"wires":[["abf7f5e1.70e248"]]},{"id":"f5b23a83.c9dcf8","type":"function","z":"80fce41e.4db188","name":"process value","func":"msg.payload = JSON.parse(msg.payload).val;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":2669,"wires":[["ad3bd2e7.f320f"]]},{"id":"4649c486.9d394c","type":"function","z":"80fce41e.4db188","name":"Input Circuit N.O.","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"relay\";\nmsg.payload = ip+\"/param.cgi?cmd=setmdalarm&-aname=relay&-switch=off&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":566,"y":2686,"wires":[["2be5ec3f.a4f864"]]},{"id":"2be5ec3f.a4f864","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":711,"y":2686,"wires":[["435ecebd.b2ce"]]},{"id":"435ecebd.b2ce","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":825,"y":2686,"wires":[["e2d561a0.7564c"]]},{"id":"e2d561a0.7564c","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{ \"val\": \"OFF\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":945,"y":2686,"wires":[["f1adaf69.292c8"]]},{"id":"c7da0e53.4032a","type":"function","z":"80fce41e.4db188","name":"input","func":"var ip = msg.payload.ip;\nvar user = msg.payload.user;\nvar password = msg.payload.password;\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 = \"relay\";\nmsg.payload = ip+\"/param.cgi?cmd=getioattr&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":702,"y":2739,"wires":[["5e938c66.f03214"]]},{"id":"812b1cbb.c7134","type":"mqtt in","z":"80fce41e.4db188","name":"","topic":"ipcam/login/office","qos":"1","broker":"40415d07.67dd94","x":520,"y":2738,"wires":[["ff379c29.4f6d9"]]},{"id":"631080a0.dc9ae","type":"ui_button","z":"80fce41e.4db188","name":"Alarm Input N.O.","group":"7b7b9d91.5496c4","order":3,"width":0,"height":0,"passthru":false,"label":"Alarm Input N.O.","color":"#000000","bgcolor":"#dddddd","icon":"fa-bell","payload":"{\"val\" : \"OFF\"}","payloadType":"json","topic":"snap","x":100,"y":2629,"wires":[["c6a86ff6.573aa"]]},{"id":"ff379c29.4f6d9","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":584,"y":2790,"wires":[["c7da0e53.4032a"]]},{"id":"5e938c66.f03214","type":"change","z":"80fce41e.4db188","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":744,"y":2789,"wires":[["a9747160.40883"]]},{"id":"a9747160.40883","type":"http request","z":"80fce41e.4db188","name":"input","method":"GET","ret":"txt","url":"","tls":"","x":874,"y":2789,"wires":[["6881ca51.423444"]]},{"id":"6881ca51.423444","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"delRightMost","params":[{"type":"str","value":";"}]},{"name":"append","params":[{"type":"str","value":" }"}]},{"name":"prepend","params":[{"type":"str","value":"{ "}]},{"name":"replaceAll","params":[{"type":"str","value":"var "},{"type":"str","value":"\""}]},{"name":"replaceAll","params":[{"type":"str","value":"="},{"type":"str","value":"\":"}]},{"name":"replaceAll","params":[{"type":"str","value":";"},{"type":"str","value":","}]},{"name":"replaceAll","params":[{"type":"str","value":"io_flag"},{"type":"str","value":"val"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":864,"y":2736,"wires":[["a94a95e3.9315e8"]]},{"id":"a94a95e3.9315e8","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":985,"y":2736,"wires":[["7575a073.8fa5e"]]},{"id":"7575a073.8fa5e","type":"change","z":"80fce41e.4db188","name":"change 1/0","rules":[{"t":"change","p":"payload.val","pt":"msg","from":"0","fromt":"str","to":"ON","tot":"str"},{"t":"change","p":"payload.val","pt":"msg","from":"1","fromt":"str","to":"OFF","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1064,"y":2789,"wires":[["c5b79307.d0f69"]]},{"id":"c6a86ff6.573aa","type":"mqtt out","z":"80fce41e.4db188","name":"Input Circuit","topic":"ipcam/office/alarm/setioattr/inputcirc","qos":"1","retain":"","broker":"40415d07.67dd94","x":267,"y":2609,"wires":[]},{"id":"da44d914.a9fb68","type":"ui_button","z":"80fce41e.4db188","name":"Alarm Input N.C.","group":"7b7b9d91.5496c4","order":2,"width":0,"height":0,"passthru":false,"label":"Alarm Input N.C.","color":"#ffffff","bgcolor":"#f17c35","icon":"fa-bell","payload":"{\"val\" : \"ON\"}","payloadType":"json","topic":"snap","x":100,"y":2589,"wires":[["c6a86ff6.573aa"]]},{"id":"ec284fb4.9092e","type":"mqtt in","z":"80fce41e.4db188","name":"Set PIR","topic":"ipcam/office/alarm/setioattr/pir","qos":"1","broker":"40415d07.67dd94","x":70,"y":2869,"wires":[["be548721.836e68"]]},{"id":"ec6040b.cc5ebc","type":"switch","z":"80fce41e.4db188","name":"Push","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":411,"y":2869,"wires":[["e540e27d.568a6"],["6d165532.13054c"]]},{"id":"e540e27d.568a6","type":"function","z":"80fce41e.4db188","name":"Input Enabled","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"pir_enable\";\nmsg.payload = ip+\"/param.cgi?cmd=setpirattr&-pir_enable=1&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":556,"y":2846,"wires":[["632e4bf3.bae584"]]},{"id":"30ee7fa5.d33e2","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{\"val\" : \"ON\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":946,"y":2846,"wires":[["faf37bd4.42da78"]]},{"id":"faf37bd4.42da78","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":1095,"y":2886,"wires":[["683f10bc.64e41"]]},{"id":"683f10bc.64e41","type":"ui_text","z":"80fce41e.4db188","group":"8dbf5870.4b2ec8","order":1,"width":0,"height":0,"name":"PIR","label":"PIR","format":"{{msg.payload.val}}","layout":"row-spread","x":1215,"y":2886,"wires":[]},{"id":"632e4bf3.bae584","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":705,"y":2846,"wires":[["b3823475.95a5a8"]]},{"id":"b3823475.95a5a8","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":825,"y":2846,"wires":[["30ee7fa5.d33e2"]]},{"id":"be548721.836e68","type":"function","z":"80fce41e.4db188","name":"process value","func":"msg.payload = JSON.parse(msg.payload).val;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":2869,"wires":[["ec6040b.cc5ebc"]]},{"id":"6d165532.13054c","type":"function","z":"80fce41e.4db188","name":"Input Disabled","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"relay\";\nmsg.payload = ip+\"/param.cgi?cmd=setpirattr&-pir_enable=0&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":556,"y":2886,"wires":[["4a437549.59c12c"]]},{"id":"4a437549.59c12c","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":705,"y":2886,"wires":[["7dbf57c0.db50c8"]]},{"id":"7dbf57c0.db50c8","type":"http request","z":"80fce41e.4db188","name":"snap","method":"GET","ret":"txt","url":"","tls":"","x":825,"y":2886,"wires":[["23d7ac1f.cc4c54"]]},{"id":"23d7ac1f.cc4c54","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{\"val\" : \"OFF\"}"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"val\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":945,"y":2886,"wires":[["faf37bd4.42da78"]]},{"id":"2eced0e7.d202a","type":"function","z":"80fce41e.4db188","name":"input","func":"var ip = msg.payload.ip;\nvar user = msg.payload.user;\nvar password = msg.payload.password;\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 = \"relay\";\nmsg.payload = ip+\"/param.cgi?cmd=getpirattr&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":702,"y":2939,"wires":[["90c5ae0e.ae9c2"]]},{"id":"7213799a.94f6c8","type":"mqtt in","z":"80fce41e.4db188","name":"","topic":"ipcam/login/office","qos":"1","broker":"40415d07.67dd94","x":520,"y":2938,"wires":[["82e400ac.41a97"]]},{"id":"b9808722.ceb348","type":"ui_button","z":"80fce41e.4db188","name":"Disable PIR","group":"8dbf5870.4b2ec8","order":3,"width":0,"height":0,"passthru":false,"label":"Disable PIR","color":"#000000","bgcolor":"#dddddd","icon":"fa-bell","payload":"{\"val\" : \"OFF\"}","payloadType":"json","topic":"snap","x":80,"y":2829,"wires":[["e6cd26c7.567128"]]},{"id":"e6cd26c7.567128","type":"mqtt out","z":"80fce41e.4db188","name":"Set PIR","topic":"ipcam/office/alarm/setioattr/pir","qos":"1","retain":"","broker":"40415d07.67dd94","x":242,"y":2809,"wires":[]},{"id":"82e400ac.41a97","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":584,"y":2990,"wires":[["2eced0e7.d202a"]]},{"id":"90c5ae0e.ae9c2","type":"change","z":"80fce41e.4db188","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":744,"y":2989,"wires":[["ee2571b4.7390c"]]},{"id":"ee2571b4.7390c","type":"http request","z":"80fce41e.4db188","name":"pir","method":"GET","ret":"txt","url":"","tls":"","x":874,"y":2989,"wires":[["ce997ade.7006f8"]]},{"id":"ce997ade.7006f8","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"delRightMost","params":[{"type":"str","value":";"}]},{"name":"append","params":[{"type":"str","value":" }"}]},{"name":"prepend","params":[{"type":"str","value":"{ "}]},{"name":"replaceAll","params":[{"type":"str","value":"var "},{"type":"str","value":"\""}]},{"name":"replaceAll","params":[{"type":"str","value":"="},{"type":"str","value":"\":"}]},{"name":"replaceAll","params":[{"type":"str","value":";"},{"type":"str","value":","}]},{"name":"replaceAll","params":[{"type":"str","value":"pir_enable"},{"type":"str","value":"val"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":864,"y":2936,"wires":[["72ee3d54.3d74c4"]]},{"id":"72ee3d54.3d74c4","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":985,"y":2936,"wires":[["4604ccc3.6b7514"]]},{"id":"4604ccc3.6b7514","type":"change","z":"80fce41e.4db188","name":"change 1/0","rules":[{"t":"change","p":"payload.val","pt":"msg","from":"0","fromt":"str","to":"OFF","tot":"str"},{"t":"change","p":"payload.val","pt":"msg","from":"1","fromt":"str","to":"ON","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1053,"y":2989,"wires":[["683f10bc.64e41"]]},{"id":"3a526ccd.584a54","type":"ui_button","z":"80fce41e.4db188","name":"Enable PIR","group":"8dbf5870.4b2ec8","order":2,"width":0,"height":0,"passthru":false,"label":"Enable PIR","color":"#ffffff","bgcolor":"#f17c35","icon":"fa-bell","payload":"{\"val\" : \"ON\"}","payloadType":"json","topic":"snap","x":80,"y":2789,"wires":[["e6cd26c7.567128"]]},{"id":"ef5b9899.5217b8","type":"ui_form","z":"80fce41e.4db188","name":"Camera Address","label":"Change Address","group":"d522d47f.e3fc78","order":0,"width":0,"height":0,"options":[{"label":"IP Address","value":"ip","type":"text","required":true},{"label":"Username","value":"user","type":"text","required":true},{"label":"Password","value":"password","type":"password","required":true}],"formValue":{"ip":"","user":"","password":""},"payload":"","submit":"Submit","cancel":"Cancel","topic":"user_set","x":90,"y":62,"wires":[["37b2de30.48a012"]]},{"id":"37b2de30.48a012","type":"change","z":"80fce41e.4db188","name":"Set Camera Login for this Flow","rules":[{"t":"set","p":"ip","pt":"flow","to":"payload.ip","tot":"msg"},{"t":"set","p":"password","pt":"flow","to":"payload.password","tot":"msg"},{"t":"set","p":"user","pt":"flow","to":"payload.user","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":62,"wires":[["8707847b.9823b8"]]},{"id":"8707847b.9823b8","type":"mqtt out","z":"80fce41e.4db188","name":"","topic":"ipcam/login/office","qos":"1","retain":"true","broker":"40415d07.67dd94","x":520,"y":62,"wires":[]},{"id":"c9e204f2.3ff388","type":"mqtt in","z":"80fce41e.4db188","name":"SnapCh","topic":"ipcam/office/alarm/etalarmsnapattr/snapch","qos":"1","broker":"40415d07.67dd94","x":70,"y":3100,"wires":[["add751aa.e6f22"]]},{"id":"4cf66c1a.bacbe4","type":"switch","z":"80fce41e.4db188","name":"Push","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"11","vt":"str"},{"t":"eq","v":"12","vt":"str"},{"t":"eq","v":"13","vt":"str"}],"checkall":"false","repair":false,"outputs":3,"x":411,"y":3100,"wires":[["6a20656b.7b51ac"],["d742df56.02541"],["e4672345.48f0a"]]},{"id":"6a20656b.7b51ac","type":"function","z":"80fce41e.4db188","name":"snap_chn=11","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"snap_chn=11\";\nmsg.payload = ip+\"/param.cgi?cmd=setalarmsnapattr&-snap_chn=11&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":556,"y":3060,"wires":[["a0c4787a.4b71d8"]]},{"id":"e2a5bfa8.3b71e","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{ \"snap_chn\": \"high resolution\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"snap_chn\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":964,"y":3060,"wires":[["4834ef9b.932d1"]]},{"id":"4834ef9b.932d1","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":1089,"y":3099,"wires":[["6fd1584.e1859a8"]]},{"id":"a0c4787a.4b71d8","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":705,"y":3060,"wires":[["fa1a7f3e.e096b"]]},{"id":"fa1a7f3e.e096b","type":"http request","z":"80fce41e.4db188","name":"snap_chn","method":"GET","ret":"txt","url":"","tls":"","x":835,"y":3060,"wires":[["e2a5bfa8.3b71e"]]},{"id":"add751aa.e6f22","type":"function","z":"80fce41e.4db188","name":"process value","func":"msg.payload = JSON.parse(msg.payload).val;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":3100,"wires":[["4cf66c1a.bacbe4"]]},{"id":"d742df56.02541","type":"function","z":"80fce41e.4db188","name":"snap_chn=12","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"snap_chn=12\";\nmsg.payload = ip+\"/param.cgi?cmd=setalarmsnapattr&-snap_chn=12&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":556,"y":3100,"wires":[["ccf106bb.bb51d8"]]},{"id":"ccf106bb.bb51d8","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":705,"y":3100,"wires":[["c8742b9d.7c7ef8"]]},{"id":"c8742b9d.7c7ef8","type":"http request","z":"80fce41e.4db188","name":"snap_chn","method":"GET","ret":"txt","url":"","tls":"","x":835,"y":3100,"wires":[["8262d112.d827d"]]},{"id":"8262d112.d827d","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{ \"snap_chn\": \"medium resolution\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"snap_chn\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":963,"y":3100,"wires":[["4834ef9b.932d1"]]},{"id":"33333508.dfbb6a","type":"function","z":"80fce41e.4db188","name":"input","func":"var ip = msg.payload.ip;\nvar user = msg.payload.user;\nvar password = msg.payload.password;\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 = \"alarmsnap\";\nmsg.payload = ip+\"/param.cgi?cmd=getalarmsnapattr&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":660,"y":3185,"wires":[["aceab63.a231e48"]]},{"id":"5286f5be.ee880c","type":"mqtt in","z":"80fce41e.4db188","name":"","topic":"ipcam/login/office","qos":"1","broker":"40415d07.67dd94","x":474,"y":3187,"wires":[["84f058c7.b13e68"]]},{"id":"cceeef2d.a1dfa","type":"ui_button","z":"80fce41e.4db188","name":"Medium Resolution","group":"f76e5925.befc28","order":3,"width":0,"height":0,"passthru":false,"label":"Medium Resolution","color":"#000000","bgcolor":"#dddddd","icon":"fa-camera","payload":"{ \"val\" : \"12\"}","payloadType":"json","topic":"snap","x":100,"y":3019,"wires":[["f47bda91.a0d308"]]},{"id":"84f058c7.b13e68","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":532,"y":3244,"wires":[["33333508.dfbb6a"]]},{"id":"aceab63.a231e48","type":"change","z":"80fce41e.4db188","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":688,"y":3243,"wires":[["56eddbaa.215bf4"]]},{"id":"56eddbaa.215bf4","type":"http request","z":"80fce41e.4db188","name":"alarmsnap","method":"GET","ret":"txt","url":"","tls":"","x":828,"y":3243,"wires":[["d7b113f8.09ca2"]]},{"id":"f47bda91.a0d308","type":"mqtt out","z":"80fce41e.4db188","name":"SnapCh","topic":"ipcam/office/alarm/etalarmsnapattr/snapch","qos":"1","retain":"","broker":"40415d07.67dd94","x":270,"y":3017,"wires":[]},{"id":"7da9a03e.77bc8","type":"ui_button","z":"80fce41e.4db188","name":"High Resolution","group":"f76e5925.befc28","order":2,"width":0,"height":0,"passthru":false,"label":"High Resolution","color":"#000000","bgcolor":"#dddddd","icon":"fa-camera","payload":"{ \"val\" : \"11\"}","payloadType":"json","topic":"snap","x":90,"y":2979,"wires":[["f47bda91.a0d308"]]},{"id":"e4672345.48f0a","type":"function","z":"80fce41e.4db188","name":"snap_chn=13","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"snap_chn=13\";\nmsg.payload = ip+\"/param.cgi?cmd=setalarmsnapattr&-snap_chn=13&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":557,"y":3140,"wires":[["66e25adb.705204"]]},{"id":"66e25adb.705204","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":706,"y":3140,"wires":[["e71716fa.31cf78"]]},{"id":"e71716fa.31cf78","type":"http request","z":"80fce41e.4db188","name":"snap_chn","method":"GET","ret":"txt","url":"","tls":"","x":836,"y":3140,"wires":[["c4788992.d48e68"]]},{"id":"c4788992.d48e68","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{ \"snap_chn\": \"low resolution\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"snap_chn\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":964,"y":3140,"wires":[["4834ef9b.932d1"]]},{"id":"d7b113f8.09ca2","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"delRightMost","params":[{"type":"str","value":";"}]},{"name":"append","params":[{"type":"str","value":" }"}]},{"name":"prepend","params":[{"type":"str","value":"{ "}]},{"name":"replaceAll","params":[{"type":"str","value":"var "},{"type":"str","value":"\""}]},{"name":"replaceAll","params":[{"type":"str","value":"="},{"type":"str","value":"\":"}]},{"name":"replaceAll","params":[{"type":"str","value":";"},{"type":"str","value":","}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":880,"y":3185,"wires":[["9ae580d0.464c3"]]},{"id":"9ae580d0.464c3","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":990,"y":3243,"wires":[["2c639998.83fcb6"]]},{"id":"2c639998.83fcb6","type":"change","z":"80fce41e.4db188","name":"change 1/0","rules":[{"t":"change","p":"payload.snap_chn","pt":"msg","from":"11","fromt":"str","to":"high resolution","tot":"str"},{"t":"change","p":"payload.snap_chn","pt":"msg","from":"12","fromt":"str","to":"medium resolution","tot":"str"},{"t":"change","p":"payload.snap_chn","pt":"msg","from":"13","fromt":"str","to":"low resolution","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1040,"y":3183,"wires":[["6fd1584.e1859a8"]]},{"id":"41138859.355388","type":"ui_button","z":"80fce41e.4db188","name":"Small Resolution","group":"f76e5925.befc28","order":3,"width":0,"height":0,"passthru":false,"label":"Small Resolution","color":"#000000","bgcolor":"#dddddd","icon":"fa-camera","payload":"{ \"val\" : \"13\"}","payloadType":"json","topic":"snap","x":100,"y":3060,"wires":[["f47bda91.a0d308"]]},{"id":"bc305c89.7ab76","type":"mqtt in","z":"80fce41e.4db188","name":"SnapNameMode","topic":"ipcam/office/alarm/etalarmsnapattr/snapnamemode","qos":"1","broker":"40415d07.67dd94","x":90,"y":3343,"wires":[["2110c201.e8a6ae"]]},{"id":"5d39592d.df5748","type":"switch","z":"80fce41e.4db188","name":"Push","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"fixed","vt":"str"},{"t":"eq","v":"timestamp","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":411,"y":3343,"wires":[["8f9d481f.ea0d48"],["70a50040.d005b"]]},{"id":"8f9d481f.ea0d48","type":"function","z":"80fce41e.4db188","name":"fixed","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"fixed\";\nmsg.payload = ip+\"/param.cgi?cmd=setalarmsnapattr&-snap_name_mode=1&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":536,"y":3303,"wires":[["af9b40d7.6bb5d"]]},{"id":"fb12a8b6.28ca18","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{ \"snap_name_mode\": \"fixed\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"snap_name_mode\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":964,"y":3303,"wires":[["d6df831c.8bb28"]]},{"id":"d6df831c.8bb28","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":1089,"y":3342,"wires":[["f82a84d3.4aa1a8"]]},{"id":"af9b40d7.6bb5d","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":705,"y":3303,"wires":[["d0357a12.f154e8"]]},{"id":"d0357a12.f154e8","type":"http request","z":"80fce41e.4db188","name":"snap_name","method":"GET","ret":"txt","url":"","tls":"","x":835,"y":3303,"wires":[["fb12a8b6.28ca18"]]},{"id":"2110c201.e8a6ae","type":"function","z":"80fce41e.4db188","name":"process value","func":"msg.payload = JSON.parse(msg.payload).val;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":3343,"wires":[["5d39592d.df5748"]]},{"id":"70a50040.d005b","type":"function","z":"80fce41e.4db188","name":"timestamp","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"timestamp\";\nmsg.payload = ip+\"/param.cgi?cmd=setalarmsnapattr&-snap_name_mode=0&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":546,"y":3343,"wires":[["cff6070b.5ba368"]]},{"id":"cff6070b.5ba368","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":705,"y":3343,"wires":[["559cd36e.c9e73c"]]},{"id":"559cd36e.c9e73c","type":"http request","z":"80fce41e.4db188","name":"snap_name","method":"GET","ret":"txt","url":"","tls":"","x":835,"y":3343,"wires":[["1bafe8d0.85a8d7"]]},{"id":"1bafe8d0.85a8d7","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{ \"snap_name_mode\": \"alarmsnapshot\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"snap_name_mode\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":963,"y":3343,"wires":[["d6df831c.8bb28"]]},{"id":"7deee029.a5274","type":"function","z":"80fce41e.4db188","name":"input","func":"var ip = msg.payload.ip;\nvar user = msg.payload.user;\nvar password = msg.payload.password;\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 = \"alarmsnap\";\nmsg.payload = ip+\"/param.cgi?cmd=getalarmsnapattr&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":622,"y":3392,"wires":[["855cfa16.c77cf8"]]},{"id":"c372d93a.321c78","type":"mqtt in","z":"80fce41e.4db188","name":"","topic":"ipcam/login/office","qos":"1","broker":"40415d07.67dd94","x":431,"y":3393,"wires":[["37b1d816.54b548"]]},{"id":"37b1d816.54b548","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":532,"y":3451,"wires":[["7deee029.a5274"]]},{"id":"855cfa16.c77cf8","type":"change","z":"80fce41e.4db188","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":702,"y":3450,"wires":[["7ffd6987.508868"]]},{"id":"7ffd6987.508868","type":"http request","z":"80fce41e.4db188","name":"alarmsnap","method":"GET","ret":"txt","url":"","tls":"","x":842,"y":3450,"wires":[["b7f54a92.3493c8"]]},{"id":"b7f54a92.3493c8","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"delRightMost","params":[{"type":"str","value":";"}]},{"name":"append","params":[{"type":"str","value":" }"}]},{"name":"prepend","params":[{"type":"str","value":"{ "}]},{"name":"replaceAll","params":[{"type":"str","value":"var "},{"type":"str","value":"\""}]},{"name":"replaceAll","params":[{"type":"str","value":"="},{"type":"str","value":"\":"}]},{"name":"replaceAll","params":[{"type":"str","value":";"},{"type":"str","value":","}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":880,"y":3392,"wires":[["9feebac.bd3e948"]]},{"id":"9feebac.bd3e948","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":1004,"y":3449,"wires":[["71d7cb3.16cda34"]]},{"id":"71d7cb3.16cda34","type":"change","z":"80fce41e.4db188","name":"change 1/0","rules":[{"t":"change","p":"payload.snap_name_mode","pt":"msg","from":"0","fromt":"str","to":"fixed","tot":"str"},{"t":"change","p":"payload.snap_name_mode","pt":"msg","from":"1","fromt":"str","to":"timestamp","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1082,"y":3390,"wires":[["f82a84d3.4aa1a8"]]},{"id":"c734ba8b.5736d8","type":"ui_button","z":"80fce41e.4db188","name":"Fixed Name","group":"423c79c4.c41968","order":2,"width":0,"height":0,"passthru":false,"label":"Fixed Name","color":"#000000","bgcolor":"#dddddd","icon":"fa-camera","payload":"{ \"val\" : \"fixed\"}","payloadType":"json","topic":"snap","x":80,"y":3259,"wires":[["47e4374e.0014d8"]]},{"id":"67e433ce.9c561c","type":"ui_button","z":"80fce41e.4db188","name":"Timestamp","group":"423c79c4.c41968","order":3,"width":0,"height":0,"passthru":false,"label":"Timestamp","color":"#000000","bgcolor":"#dddddd","icon":"fa-camera","payload":"{ \"val\" : \"timestamp\"}","payloadType":"json","topic":"snap","x":80,"y":3299,"wires":[["47e4374e.0014d8"]]},{"id":"47e4374e.0014d8","type":"mqtt out","z":"80fce41e.4db188","name":"SnapNameMode","topic":"ipcam/office/alarm/etalarmsnapattr/snapnamemode","qos":"1","retain":"","broker":"40415d07.67dd94","x":300,"y":3279,"wires":[]},{"id":"320cc666.a5b2aa","type":"mqtt in","z":"80fce41e.4db188","name":"SnapName","topic":"ipcam/office/alarm/etalarmsnapattr/seriessnapname","qos":"1","broker":"40415d07.67dd94","x":80,"y":3543,"wires":[["9cf7048a.1e6598"]]},{"id":"de9b0be1.98e0c8","type":"switch","z":"80fce41e.4db188","name":"Push","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"empty","vt":"str"},{"t":"eq","v":"fixedname","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":411,"y":3543,"wires":[["293802f8.56a37e"],["add3c795.f80058"]]},{"id":"293802f8.56a37e","type":"function","z":"80fce41e.4db188","name":"empty","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"empty\";\nmsg.payload = ip+\"/param.cgi?cmd=setalarmsnapattr&-snap_timer_name=&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":536,"y":3503,"wires":[["ead5bbaf.afcc98"]]},{"id":"2a696d3c.9c7cf2","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{ \"snap_timer_name\": \"empty\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"snap_timer_name\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":1027,"y":3503,"wires":[["28c3a03.8a5de6"]]},{"id":"28c3a03.8a5de6","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":1152,"y":3521,"wires":[["15e01daf.e2ccd2"]]},{"id":"ead5bbaf.afcc98","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":729,"y":3503,"wires":[["30e49367.a70e3c"]]},{"id":"30e49367.a70e3c","type":"http request","z":"80fce41e.4db188","name":"snap_timer_name","method":"GET","ret":"txt","url":"","tls":"","x":879,"y":3503,"wires":[["2a696d3c.9c7cf2"]]},{"id":"9cf7048a.1e6598","type":"function","z":"80fce41e.4db188","name":"process value","func":"msg.payload = JSON.parse(msg.payload).val;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":3543,"wires":[["de9b0be1.98e0c8"]]},{"id":"add3c795.f80058","type":"function","z":"80fce41e.4db188","name":"photoseriessnapshot","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"alarmsnapshot\";\nmsg.payload = ip+\"/param.cgi?cmd=setalarmsnapattr&-snap_timer_name=photoseriessnapshot&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":576,"y":3543,"wires":[["d49c5c80.36b5e"]]},{"id":"d49c5c80.36b5e","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":729,"y":3543,"wires":[["39c125d4.7ecb1a"]]},{"id":"39c125d4.7ecb1a","type":"http request","z":"80fce41e.4db188","name":"snap_timer_name","method":"GET","ret":"txt","url":"","tls":"","x":879,"y":3543,"wires":[["15b6f8a2.62bda7"]]},{"id":"15b6f8a2.62bda7","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{ \"snap_timer_name\": \"seriessnapshot\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"snap_timer_name\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":1026,"y":3543,"wires":[["28c3a03.8a5de6"]]},{"id":"51849114.82c2","type":"function","z":"80fce41e.4db188","name":"input","func":"var ip = msg.payload.ip;\nvar user = msg.payload.user;\nvar password = msg.payload.password;\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 = \"alarmsnap\";\nmsg.payload = ip+\"/param.cgi?cmd=getalarmsnapattr&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":660,"y":3592,"wires":[["b8e7037b.da407"]]},{"id":"8f83a89c.5de3d8","type":"mqtt in","z":"80fce41e.4db188","name":"","topic":"ipcam/login/office","qos":"1","broker":"40415d07.67dd94","x":474,"y":3594,"wires":[["8b6106a.553b4f8"]]},{"id":"8b6106a.553b4f8","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":532,"y":3651,"wires":[["51849114.82c2"]]},{"id":"b8e7037b.da407","type":"change","z":"80fce41e.4db188","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":699,"y":3650,"wires":[["d4d933c3.4d667"]]},{"id":"d4d933c3.4d667","type":"http request","z":"80fce41e.4db188","name":"snap_timer_name","method":"GET","ret":"txt","url":"","tls":"","x":859,"y":3650,"wires":[["6f4b95d0.aaab3c"]]},{"id":"c1214530.4f0778","type":"mqtt out","z":"80fce41e.4db188","name":"SnapName","topic":"ipcam/office/alarm/etalarmsnapattr/seriessnapname","qos":"1","retain":"","broker":"40415d07.67dd94","x":280,"y":3486,"wires":[]},{"id":"28b0b48a.6cea6c","type":"ui_button","z":"80fce41e.4db188","name":"Timestamp","group":"c2dcd716.e238e8","order":2,"width":0,"height":0,"passthru":false,"label":"no filename","color":"#000000","bgcolor":"#dddddd","icon":"fa-camera","payload":"{ \"val\" : \"empty\"}","payloadType":"json","topic":"snap","x":80,"y":3466,"wires":[["c1214530.4f0778"]]},{"id":"ae6e087b.4a8058","type":"ui_button","z":"80fce41e.4db188","name":"Fixed Name","group":"c2dcd716.e238e8","order":3,"width":0,"height":0,"passthru":false,"label":"Fixed Name","color":"#000000","bgcolor":"#dddddd","icon":"fa-camera","payload":"{ \"val\" : \"fixedname\"}","payloadType":"json","topic":"snap","x":80,"y":3506,"wires":[["c1214530.4f0778"]]},{"id":"6f4b95d0.aaab3c","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"delRightMost","params":[{"type":"str","value":";"}]},{"name":"append","params":[{"type":"str","value":" }"}]},{"name":"prepend","params":[{"type":"str","value":"{ "}]},{"name":"replaceAll","params":[{"type":"str","value":"var "},{"type":"str","value":"\""}]},{"name":"replaceAll","params":[{"type":"str","value":"="},{"type":"str","value":"\":"}]},{"name":"replaceAll","params":[{"type":"str","value":";"},{"type":"str","value":","}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":830,"y":3594,"wires":[["67bd784c.1a0048"]]},{"id":"67bd784c.1a0048","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":950,"y":3594,"wires":[["d56fa470.c011b8"]]},{"id":"d56fa470.c011b8","type":"change","z":"80fce41e.4db188","name":"change 1/0","rules":[{"t":"change","p":"payload.snap_timer_name","pt":"msg","from":"","fromt":"str","to":"empty","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1080,"y":3603,"wires":[["15e01daf.e2ccd2"]]},{"id":"56437c55.26d284","type":"mqtt in","z":"80fce41e.4db188","name":"SDSnapNumber","topic":"ipcam/office/alarm/etalarmsnapattr/sdalarmsnap","qos":"1","broker":"40415d07.67dd94","x":90,"y":3743,"wires":[["875bbab6.a64f58"]]},{"id":"9159742d.04a268","type":"switch","z":"80fce41e.4db188","name":"Push","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"three","vt":"str"},{"t":"eq","v":"six","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":411,"y":3743,"wires":[["2e59fa59.225b56"],["46cb869d.cfad08"]]},{"id":"2e59fa59.225b56","type":"function","z":"80fce41e.4db188","name":"3 sd snap count","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"three\";\nmsg.payload = ip+\"/param.cgi?cmd=setalarmsnapattr&-snap_count=3&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":556,"y":3703,"wires":[["d784070.742eff8"]]},{"id":"afbbcc04.95c9a","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{ \"snap_count\": \"3\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"snap_count\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":1027,"y":3703,"wires":[["41538e9.46c057"]]},{"id":"41538e9.46c057","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":1152,"y":3721,"wires":[["a32e8771.03cbc8"]]},{"id":"d784070.742eff8","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":729,"y":3703,"wires":[["ee8465b3.b66558"]]},{"id":"ee8465b3.b66558","type":"http request","z":"80fce41e.4db188","name":"snap_count","method":"GET","ret":"txt","url":"","tls":"","x":859,"y":3703,"wires":[["afbbcc04.95c9a"]]},{"id":"875bbab6.a64f58","type":"function","z":"80fce41e.4db188","name":"process value","func":"msg.payload = JSON.parse(msg.payload).val;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":3743,"wires":[["9159742d.04a268"]]},{"id":"46cb869d.cfad08","type":"function","z":"80fce41e.4db188","name":"6 sd snap count","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"alarmsnapshot\";\nmsg.payload = ip+\"/param.cgi?cmd=setalarmsnapattr&-snap_count=6&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":556,"y":3743,"wires":[["422bee1f.eff3d"]]},{"id":"422bee1f.eff3d","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":729,"y":3743,"wires":[["ba1d12e5.888c4"]]},{"id":"ba1d12e5.888c4","type":"http request","z":"80fce41e.4db188","name":"snap_count","method":"GET","ret":"txt","url":"","tls":"","x":859,"y":3743,"wires":[["cbc6e29d.70688"]]},{"id":"cbc6e29d.70688","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{ \"snap_count\": \"6\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"snap_count\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":1026,"y":3743,"wires":[["41538e9.46c057"]]},{"id":"94390b04.95e778","type":"function","z":"80fce41e.4db188","name":"input","func":"var ip = msg.payload.ip;\nvar user = msg.payload.user;\nvar password = msg.payload.password;\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 = \"alarmsnap\";\nmsg.payload = ip+\"/param.cgi?cmd=getalarmsnapattr&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":660,"y":3792,"wires":[["41c5c3f5.5224cc"]]},{"id":"81815c58.cd2a3","type":"mqtt in","z":"80fce41e.4db188","name":"","topic":"ipcam/login/office","qos":"1","broker":"40415d07.67dd94","x":475,"y":3793,"wires":[["cab05657.8acfc8"]]},{"id":"cab05657.8acfc8","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":532,"y":3851,"wires":[["94390b04.95e778"]]},{"id":"41c5c3f5.5224cc","type":"change","z":"80fce41e.4db188","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":3850,"wires":[["756f8dd.ca3e974"]]},{"id":"756f8dd.ca3e974","type":"http request","z":"80fce41e.4db188","name":"snap_count","method":"GET","ret":"txt","url":"","tls":"","x":840,"y":3850,"wires":[["beb13d88.51649"]]},{"id":"8e135a86.70faf8","type":"ui_button","z":"80fce41e.4db188","name":"6 Alarm Snapshots","group":"b6278297.29371","order":3,"width":0,"height":0,"passthru":false,"label":"6 Alarm Snapshots","color":"#000000","bgcolor":"#dddddd","icon":"fa-camera","payload":"{ \"val\" : \"six\"}","payloadType":"json","topic":"snap","x":100,"y":3697,"wires":[["912f4c72.cffe6"]]},{"id":"beb13d88.51649","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"delRightMost","params":[{"type":"str","value":";"}]},{"name":"append","params":[{"type":"str","value":" }"}]},{"name":"prepend","params":[{"type":"str","value":"{ "}]},{"name":"replaceAll","params":[{"type":"str","value":"var "},{"type":"str","value":"\""}]},{"name":"replaceAll","params":[{"type":"str","value":"="},{"type":"str","value":"\":"}]},{"name":"replaceAll","params":[{"type":"str","value":";"},{"type":"str","value":","}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":830,"y":3794,"wires":[["8e5b2033.e4ec8"]]},{"id":"8e5b2033.e4ec8","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":950,"y":3794,"wires":[["a32e8771.03cbc8"]]},{"id":"912f4c72.cffe6","type":"mqtt out","z":"80fce41e.4db188","name":"SDSnapNumber","topic":"ipcam/office/alarm/etalarmsnapattr/sdalarmsnap","qos":"1","retain":"","broker":"40415d07.67dd94","x":290,"y":3677,"wires":[]},{"id":"7423ef5b.73153","type":"ui_button","z":"80fce41e.4db188","name":"3 Alarm Snapshots","group":"b6278297.29371","order":2,"width":0,"height":0,"passthru":false,"label":"3 Alarm Snapshots","color":"#000000","bgcolor":"#dddddd","icon":"fa-camera","payload":"{ \"val\" : \"three\"}","payloadType":"json","topic":"snap","x":100,"y":3657,"wires":[["912f4c72.cffe6"]]},{"id":"1590aa59.bbb1b6","type":"mqtt in","z":"80fce41e.4db188","name":"EmailSnapNumber","topic":"ipcam/office/alarm/etalarmsnapattr/emailalarmsnap","qos":"1","broker":"40415d07.67dd94","x":100,"y":3943,"wires":[["9fb92a0f.981298"]]},{"id":"4a1a06d9.2e4198","type":"switch","z":"80fce41e.4db188","name":"Push","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"three","vt":"str"},{"t":"eq","v":"six","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":411,"y":3943,"wires":[["4ff8f80e.9b1088"],["a6379ba.3ea2f68"]]},{"id":"4ff8f80e.9b1088","type":"function","z":"80fce41e.4db188","name":"3 email snap count","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"three\";\nmsg.payload = ip+\"/param.cgi?cmd=setalarmsnapattr&-email_snap_count=3&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":566,"y":3903,"wires":[["dca52581.e19168"]]},{"id":"89eb1eb.faa9ce","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{ \"email_snap_count\": \"3\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"email_snap_count\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":1027,"y":3903,"wires":[["24faed1b.d0b732"]]},{"id":"24faed1b.d0b732","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":1152,"y":3921,"wires":[["e917f500.eab068"]]},{"id":"dca52581.e19168","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":729,"y":3903,"wires":[["73ab108a.181e6"]]},{"id":"73ab108a.181e6","type":"http request","z":"80fce41e.4db188","name":"email_snap_count","method":"GET","ret":"txt","url":"","tls":"","x":879,"y":3903,"wires":[["89eb1eb.faa9ce"]]},{"id":"9fb92a0f.981298","type":"function","z":"80fce41e.4db188","name":"process value","func":"msg.payload = JSON.parse(msg.payload).val;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":3943,"wires":[["4a1a06d9.2e4198"]]},{"id":"a6379ba.3ea2f68","type":"function","z":"80fce41e.4db188","name":"6 emailsnap count","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"six\";\nmsg.payload = ip+\"/param.cgi?cmd=setalarmsnapattr&-email_snap_count=6&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":566,"y":3943,"wires":[["f86662d8.80c6f"]]},{"id":"f86662d8.80c6f","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":729,"y":3943,"wires":[["d7d398cc.ed47c8"]]},{"id":"d7d398cc.ed47c8","type":"http request","z":"80fce41e.4db188","name":"email_snap_count","method":"GET","ret":"txt","url":"","tls":"","x":879,"y":3943,"wires":[["170dc0f0.50534f"]]},{"id":"170dc0f0.50534f","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{ \"email_snap_count\": \"6\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"email_snap_count\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":1026,"y":3943,"wires":[["24faed1b.d0b732"]]},{"id":"5136761b.351ea8","type":"function","z":"80fce41e.4db188","name":"input","func":"var ip = msg.payload.ip;\nvar user = msg.payload.user;\nvar password = msg.payload.password;\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 = \"alarmsnap\";\nmsg.payload = ip+\"/param.cgi?cmd=getalarmsnapattr&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":660,"y":3992,"wires":[["ea30c380.2e057"]]},{"id":"cde4da4.819b328","type":"mqtt in","z":"80fce41e.4db188","name":"","topic":"ipcam/login/office","qos":"1","broker":"40415d07.67dd94","x":474,"y":3995,"wires":[["351b817d.8b23de"]]},{"id":"351b817d.8b23de","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":532,"y":4051,"wires":[["5136761b.351ea8"]]},{"id":"ea30c380.2e057","type":"change","z":"80fce41e.4db188","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":703,"y":4050,"wires":[["887ac452.504fc8"]]},{"id":"887ac452.504fc8","type":"http request","z":"80fce41e.4db188","name":"snap_count","method":"GET","ret":"txt","url":"","tls":"","x":843,"y":4050,"wires":[["f6e61bd7.ea46c8"]]},{"id":"8dc05c13.5585d","type":"ui_button","z":"80fce41e.4db188","name":"6 Alarm Snapshots","group":"7fbe5516.f3fc3c","order":3,"width":0,"height":0,"passthru":false,"label":"6 Alarm Snapshots","color":"#000000","bgcolor":"#dddddd","icon":"fa-camera","payload":"{ \"val\" : \"six\"}","payloadType":"json","topic":"snap","x":100,"y":3897,"wires":[["fe394d0b.24773"]]},{"id":"f6e61bd7.ea46c8","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"delRightMost","params":[{"type":"str","value":";"}]},{"name":"append","params":[{"type":"str","value":" }"}]},{"name":"prepend","params":[{"type":"str","value":"{ "}]},{"name":"replaceAll","params":[{"type":"str","value":"var "},{"type":"str","value":"\""}]},{"name":"replaceAll","params":[{"type":"str","value":"="},{"type":"str","value":"\":"}]},{"name":"replaceAll","params":[{"type":"str","value":";"},{"type":"str","value":","}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":830,"y":3994,"wires":[["6c606dfb.9598c4"]]},{"id":"6c606dfb.9598c4","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":950,"y":3994,"wires":[["e917f500.eab068"]]},{"id":"fe394d0b.24773","type":"mqtt out","z":"80fce41e.4db188","name":"EmailSnapNumber","topic":"ipcam/office/alarm/etalarmsnapattr/emailalarmsnap","qos":"1","retain":"","broker":"40415d07.67dd94","x":300,"y":3877,"wires":[]},{"id":"3c4b5694.8b3aba","type":"ui_button","z":"80fce41e.4db188","name":"3 Alarm Snapshots","group":"7fbe5516.f3fc3c","order":2,"width":0,"height":0,"passthru":false,"label":"3 Alarm Snapshots","color":"#000000","bgcolor":"#dddddd","icon":"fa-camera","payload":"{ \"val\" : \"three\"}","payloadType":"json","topic":"snap","x":100,"y":3857,"wires":[["fe394d0b.24773"]]},{"id":"d082ffe0.96742","type":"mqtt in","z":"80fce41e.4db188","name":"FTPSnapNumber","topic":"ipcam/office/alarm/etalarmsnapattr/ftpalarmsnap","qos":"1","broker":"40415d07.67dd94","x":90,"y":4143,"wires":[["33705c90.066a64"]]},{"id":"e5fdf798.e42ca8","type":"switch","z":"80fce41e.4db188","name":"Push","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"three","vt":"str"},{"t":"eq","v":"six","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":411,"y":4143,"wires":[["3a7ea395.1f1e8c"],["8ce30cb6.8db95"]]},{"id":"3a7ea395.1f1e8c","type":"function","z":"80fce41e.4db188","name":"3 FTP snap count","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"three\";\nmsg.payload = ip+\"/param.cgi?cmd=setalarmsnapattr&-ftp_snap_count=3&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":566,"y":4103,"wires":[["7cdca81f.be3f18"]]},{"id":"9b788278.6c689","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{ \"ftp_snap_count\": \"3\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"ftp_snap_count\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":1027,"y":4103,"wires":[["ce9b02a3.eddd5"]]},{"id":"ce9b02a3.eddd5","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":1152,"y":4121,"wires":[["fc8541f4.f5194"]]},{"id":"7cdca81f.be3f18","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":729,"y":4103,"wires":[["4d93352.f5351cc"]]},{"id":"4d93352.f5351cc","type":"http request","z":"80fce41e.4db188","name":"ftp_snap_count","method":"GET","ret":"txt","url":"","tls":"","x":869,"y":4103,"wires":[["9b788278.6c689"]]},{"id":"33705c90.066a64","type":"function","z":"80fce41e.4db188","name":"process value","func":"msg.payload = JSON.parse(msg.payload).val;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":4143,"wires":[["e5fdf798.e42ca8"]]},{"id":"8ce30cb6.8db95","type":"function","z":"80fce41e.4db188","name":"6 FTP snap count","func":"var ip = flow.get(\"ip\");\nvar user = flow.get(\"user\");\nvar password = flow.get(\"password\");\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 = \"six\";\nmsg.payload = ip+\"/param.cgi?cmd=setalarmsnapattr&-email_snap_count=6&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":566,"y":4143,"wires":[["778e31b8.eceb3"]]},{"id":"778e31b8.eceb3","type":"change","z":"80fce41e.4db188","name":"Set URL","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":729,"y":4143,"wires":[["71d894f8.16a88c"]]},{"id":"71d894f8.16a88c","type":"http request","z":"80fce41e.4db188","name":"ftp_snap_count","method":"GET","ret":"txt","url":"","tls":"","x":869,"y":4143,"wires":[["c8914094.e1b98"]]},{"id":"c8914094.e1b98","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"replaceAll","params":[{"type":"str","value":"[Succeed]set ok."},{"type":"str","value":"{ \"ftp_snap_count\": \"6\" }"}]},{"name":"replaceAll","params":[{"type":"str","value":"[Error]Param error."},{"type":"str","value":"{ \"ftp_snap_count\": \"Error\" }"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":1026,"y":4143,"wires":[["ce9b02a3.eddd5"]]},{"id":"87ddaa9c.7591b8","type":"function","z":"80fce41e.4db188","name":"input","func":"var ip = msg.payload.ip;\nvar user = msg.payload.user;\nvar password = msg.payload.password;\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 = \"alarmsnap\";\nmsg.payload = ip+\"/param.cgi?cmd=getalarmsnapattr&-usr=\"+user+\"&-pwd=\"+password;\nreturn msg;","outputs":1,"noerr":0,"x":660,"y":4192,"wires":[["4798faa2.36cae4"]]},{"id":"18c50f71.d97341","type":"mqtt in","z":"80fce41e.4db188","name":"","topic":"ipcam/login/office","qos":"1","broker":"40415d07.67dd94","x":469,"y":4195,"wires":[["8d2f5201.193c4"]]},{"id":"8d2f5201.193c4","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":532,"y":4251,"wires":[["87ddaa9c.7591b8"]]},{"id":"4798faa2.36cae4","type":"change","z":"80fce41e.4db188","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":4250,"wires":[["5ab88742.e42c58"]]},{"id":"5ab88742.e42c58","type":"http request","z":"80fce41e.4db188","name":"snap_count","method":"GET","ret":"txt","url":"","tls":"","x":840,"y":4250,"wires":[["44e7d575.a8734c"]]},{"id":"f4d25dca.2d922","type":"ui_button","z":"80fce41e.4db188","name":"6 Alarm Snapshots","group":"e58277c3.4d3148","order":3,"width":0,"height":0,"passthru":false,"label":"6 Alarm Snapshots","color":"#000000","bgcolor":"#dddddd","icon":"fa-camera","payload":"{ \"val\" : \"six\"}","payloadType":"json","topic":"snap","x":100,"y":4097,"wires":[["83498a8b.b96748"]]},{"id":"44e7d575.a8734c","type":"string","z":"80fce41e.4db188","name":"toJSON","methods":[{"name":"delRightMost","params":[{"type":"str","value":";"}]},{"name":"append","params":[{"type":"str","value":" }"}]},{"name":"prepend","params":[{"type":"str","value":"{ "}]},{"name":"replaceAll","params":[{"type":"str","value":"var "},{"type":"str","value":"\""}]},{"name":"replaceAll","params":[{"type":"str","value":"="},{"type":"str","value":"\":"}]},{"name":"replaceAll","params":[{"type":"str","value":";"},{"type":"str","value":","}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":830,"y":4194,"wires":[["fb18acaa.cc539"]]},{"id":"fb18acaa.cc539","type":"json","z":"80fce41e.4db188","name":"","property":"payload","action":"","pretty":false,"x":950,"y":4194,"wires":[["fc8541f4.f5194"]]},{"id":"83498a8b.b96748","type":"mqtt out","z":"80fce41e.4db188","name":"FTPSnapNumber","topic":"ipcam/office/alarm/etalarmsnapattr/ftpalarmsnap","qos":"1","retain":"","broker":"40415d07.67dd94","x":300,"y":4077,"wires":[]},{"id":"93e527f4.2cc3c8","type":"ui_button","z":"80fce41e.4db188","name":"3 Alarm Snapshots","group":"e58277c3.4d3148","order":2,"width":0,"height":0,"passthru":false,"label":"3 Alarm Snapshots","color":"#000000","bgcolor":"#dddddd","icon":"fa-camera","payload":"{ \"val\" : \"three\"}","payloadType":"json","topic":"snap","x":100,"y":4057,"wires":[["83498a8b.b96748"]]},{"id":"fc8541f4.f5194","type":"ui_text","z":"80fce41e.4db188","group":"e58277c3.4d3148","order":1,"width":0,"height":0,"name":"FTP Alarm Snapshots","label":"FTP Alarm Snapshots","format":"{{msg.payload.ftp_snap_count}}","layout":"row-spread","x":1250,"y":4163,"wires":[]},{"id":"e917f500.eab068","type":"ui_text","z":"80fce41e.4db188","group":"7fbe5516.f3fc3c","order":1,"width":0,"height":0,"name":"Email Alarm Snapshots","label":"Email Alarm Snapshots","format":"{{msg.payload.email_snap_count}}","layout":"row-spread","x":1250,"y":3963,"wires":[]},{"id":"a32e8771.03cbc8","type":"ui_text","z":"80fce41e.4db188","group":"b6278297.29371","order":1,"width":0,"height":0,"name":"SD Alarm Snapshots","label":"SD Alarm Snapshots","format":"{{msg.payload.snap_count}}","layout":"row-spread","x":1250,"y":3763,"wires":[]},{"id":"15e01daf.e2ccd2","type":"ui_text","z":"80fce41e.4db188","group":"c2dcd716.e238e8","order":1,"width":0,"height":0,"name":"File Name (Fotoserie)","label":"File Name (Fotoserie)","format":"{{msg.payload.snap_timer_name}}","layout":"row-spread","x":1250,"y":3563,"wires":[]},{"id":"f82a84d3.4aa1a8","type":"ui_text","z":"80fce41e.4db188","group":"423c79c4.c41968","order":1,"width":0,"height":0,"name":"File Name (Alarm)","label":"File Name (Alarm)","format":"{{msg.payload.snap_name_mode}}","layout":"row-spread","x":1239,"y":3342,"wires":[]},{"id":"6fd1584.e1859a8","type":"ui_text","z":"80fce41e.4db188","group":"f76e5925.befc28","order":1,"width":0,"height":0,"name":"Alarm Snapshot Resolution","label":"Alarm Snapshot Resolution","format":"{{msg.payload.snap_chn}}","layout":"row-spread","x":1259,"y":3099,"wires":[]},{"id":"446e5729.202b28","type":"ui_text","z":"80fce41e.4db188","group":"a2c3b179.dc59","order":1,"width":0,"height":0,"name":"Alarm Input","label":"Alarm Input","format":"{{msg.payload.val}}","layout":"row-spread","x":1220,"y":2483,"wires":[]},{"id":"c363ee0d.c6964","type":"ui_text","z":"80fce41e.4db188","group":"21b971bc.496f1e","order":1,"width":0,"height":0,"name":"Audio Treshold","label":"Audio Treshold","format":"{{msg.payload.val}}","layout":"row-spread","x":1250,"y":2285,"wires":[]},{"id":"9e83f17.835811","type":"ui_text","z":"80fce41e.4db188","group":"44bf7540.54529c","order":1,"width":0,"height":0,"name":"Audio Detection Sensitivity","label":"Audio Detection Sensitivity","format":"{{msg.payload.val}}","layout":"row-spread","x":1285,"y":2085,"wires":[]},{"id":"69879b81.cf9cf4","type":"ui_text","z":"80fce41e.4db188","group":"bf705aeb.5fd578","order":1,"width":0,"height":0,"name":"Audio Detection","label":"Audio Detection","format":"{{msg.payload.val}}","layout":"row-spread","x":1269,"y":1886,"wires":[]},{"id":"d7bde5d7.897168","type":"ui_text","z":"80fce41e.4db188","group":"da99bfaa.fad94","order":1,"width":0,"height":0,"name":"PIR & Area Link","label":"PIR & Area Link","format":"{{msg.payload.val}}","layout":"row-spread","x":1240,"y":1686,"wires":[]},{"id":"3b6b6e3b.632112","type":"ui_text","z":"80fce41e.4db188","group":"e2c90946.abf778","order":1,"width":0,"height":0,"name":"Alarm Signal","label":"Alarm Signal","format":"{{msg.payload.val}}","layout":"row-spread","x":1287,"y":1486,"wires":[]},{"id":"f832e027.3e2c8","type":"ui_text","z":"80fce41e.4db188","group":"c067bfe4.33938","order":1,"width":0,"height":0,"name":"Output Relay","label":"Output Relay","format":"{{msg.payload.val}}","layout":"row-spread","x":1226,"y":1284,"wires":[]},{"id":"373c47d.dc26bb8","type":"ui_text","z":"80fce41e.4db188","group":"8c28e771.1068c8","order":1,"width":0,"height":0,"name":"FTP Recording","label":"FTP Recording","format":"{{msg.payload.val}}","layout":"row-spread","x":1259,"y":1082,"wires":[]},{"id":"9cf806f.fa944f8","type":"ui_text","z":"80fce41e.4db188","group":"b7cbf120.ff8cc","order":1,"width":0,"height":0,"name":"Alarm Recording","label":"Alarm Recording","format":"{{msg.payload.val}}","layout":"row-spread","x":1260,"y":892,"wires":[]},{"id":"fd4bfe1.b17ad","type":"ui_text","z":"80fce41e.4db188","group":"a56fe2.dc4e902","order":1,"width":0,"height":0,"name":"Alarm FTP Snap","label":"Alarm FTP Snap","format":"{{msg.payload.val}}","layout":"row-spread","x":1240,"y":703,"wires":[]},{"id":"9e9a2e13.40ba7","type":"ui_text","z":"80fce41e.4db188","group":"b6272f67.feb2c","order":1,"width":0,"height":0,"name":"Alarm Snap","label":"Alarm Snap","format":"{{msg.payload.val}}","layout":"row-spread","x":1237,"y":506,"wires":[]},{"id":"7a3106d5.dac298","type":"ui_text","z":"80fce41e.4db188","group":"6a969f3d.e1ed1","order":1,"width":0,"height":0,"name":"Alarm Email","label":"Alarm Email","format":"{{msg.payload.val}}","layout":"row-spread","x":1243,"y":309,"wires":[]},{"id":"f3fedf9f.13139","type":"ui_template","z":"80fce41e.4db188","group":"d522d47f.e3fc78","name":"Set Address","order":2,"width":"6","height":"2","format":"
Current Office Camera Login
\nIP | \nUser | \nPassword | \n
---|---|---|
{{msg.payload.ip}} | \n{{msg.payload.user}} | \n{{msg.payload.password}} | \n