[{"id":"22bc45a6.839b8a","type":"function","z":"998d1542.4a7d2","name":"Detecting & Texting","func":"number = msg.payload;\n\nif(number === 1)\n{\n msg.payload = \"Security system activated.\" + \" Please check security camera.\";\n return msg;\n}\n\nelse if(number === 0)\n{\n rubbish = msg.payload;\n return null;\n}\n\nreturn null;","outputs":1,"noerr":0,"x":628.555534362793,"y":1313.6032266616821,"wires":[["6e7700ce.28192"]]},{"id":"9b224293.4d7ad","type":"mqtt in","z":"998d1542.4a7d2","name":"MQTT-motionSensor","topic":"motionSensor","qos":"2","broker":"867260d8.6e4528","x":246.99999237060547,"y":1315.8333902359009,"wires":[["12b0c52c.aaaa8b"]]},{"id":"12b0c52c.aaaa8b","type":"json","z":"998d1542.4a7d2","name":"","x":448.99999237060547,"y":1315.1667032241821,"wires":[["22bc45a6.839b8a"]]},{"id":"a7bdcb0f.261c68","type":"mqtt in","z":"998d1542.4a7d2","name":"MQTT-text","topic":"text","qos":"2","broker":"867260d8.6e4528","x":268.14278984069824,"y":1372.6668391227722,"wires":[["3eeff025.9a7058","4b23914.367e07"]]},{"id":"6e7700ce.28192","type":"mqtt out","z":"998d1542.4a7d2","name":"MQTT-text","topic":"text","qos":"2","retain":"","broker":"867260d8.6e4528","x":824.5713081359863,"y":1313.0476379394531,"wires":[]},{"id":"3eeff025.9a7058","type":"debug","z":"998d1542.4a7d2","name":"","active":false,"console":"false","complete":"false","x":578.9046306610107,"y":1554.0001320838928,"wires":[]},{"id":"e7ec22be.3a8d58","type":"http in","z":"998d1542.4a7d2","name":"/securitySystem","url":"/securitySystem","method":"get","swaggerDoc":"","x":227.28587341308594,"y":992.5714960098267,"wires":[["66afc25d.bd81ac"]]},{"id":"b7eeaf55.346318","type":"template","z":"998d1542.4a7d2","name":"WEB-Security System","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"
IBM Cloud Robot Web
\n(1) Security Sensor (active:1/inactive:0): {{payload.motionSensor}}
\n(2) Internet Speed: {{payload.ping}}
\n(3) CPU Temperature: {{payload.cputemp}}°C
\n\n\n         (α) For a real time image                                             (Ω) For a visual rcognition image ... ⌛ ...
\n\n\n\n","x":744.0952911376953,"y":991.5001931190491,"wires":[["f2f83513.25b56"]]},{"id":"f2f83513.25b56","type":"http response","z":"998d1542.4a7d2","name":"","x":930.2383003234863,"y":990.7382912635803,"wires":[]},{"id":"abe41dd0.cd4f7","type":"mqtt in","z":"998d1542.4a7d2","name":"MQTT-motionSensor","topic":"motionSensor","qos":"2","broker":"867260d8.6e4528","x":302.9046859741211,"y":1040.880913734436,"wires":[["20d06147.4eae1e"]]},{"id":"20d06147.4eae1e","type":"function","z":"998d1542.4a7d2","name":"MQTT-MotionSensor-WEB","func":"context.global.motionSensor = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":551.4284896850586,"y":1040.4523553848267,"wires":[["4d790304.5937e4"]]},{"id":"4d790304.5937e4","type":"debug","z":"998d1542.4a7d2","name":"","active":false,"console":"false","complete":"false","x":827.4286422729492,"y":1038.0952081680298,"wires":[]},{"id":"66afc25d.bd81ac","type":"function","z":"998d1542.4a7d2","name":"motionSensor, Ping, Cpu Temp","func":"msg.payload.motionSensor = context.global.motionSensor;\nmsg.payload.ping = context.global.ping;\nmsg.payload.cputemp = context.global.cputemp;\nmsg.payload.vr = context.global.vr;\n\n\nreturn msg;","outputs":1,"noerr":0,"x":471.54764556884766,"y":992.4762053489685,"wires":[["b7eeaf55.346318"]]},{"id":"95b183f3.383848","type":"comment","z":"998d1542.4a7d2","name":"Web : 169.254.170.40:1880/securitySystem","info":"","x":330.95238494873047,"y":942.6667108535767,"wires":[]},{"id":"bab0e77d.345058","type":"mqtt in","z":"998d1542.4a7d2","name":"MQTT-ping","topic":"ping","qos":"2","broker":"867260d8.6e4528","x":276.23803520202637,"y":1423.8572688102722,"wires":[["3eeff025.9a7058"]]},{"id":"7dade3fd.c335bc","type":"mqtt in","z":"998d1542.4a7d2","name":"MQTT-cpuTemp","topic":"cpuTemp","qos":"2","broker":"867260d8.6e4528","x":284.809476852417,"y":1481.0001521110535,"wires":[["3eeff025.9a7058"]]},{"id":"7cba5440.73fd54","type":"mqtt in","z":"998d1542.4a7d2","name":"MQTT-ping","topic":"ping","qos":"2","broker":"867260d8.6e4528","x":277.66670989990234,"y":1094.9523859024048,"wires":[["b5f7f327.f29ea"]]},{"id":"b5f7f327.f29ea","type":"function","z":"998d1542.4a7d2","name":"MQTT-Ping-WEB","func":"context.global.ping = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":520.5238265991211,"y":1093.3809747695923,"wires":[["4d790304.5937e4"]]},{"id":"9775488a.89d83","type":"mqtt in","z":"998d1542.4a7d2","name":"MQTT-cpuTemp","topic":"cpuTemp","qos":"2","broker":"867260d8.6e4528","x":284.5238265991211,"y":1150.095269203186,"wires":[["4d822dda.fcded4"]]},{"id":"4d822dda.fcded4","type":"function","z":"998d1542.4a7d2","name":"MQTT-CpuTemp-WEB","func":"context.global.cputemp = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":539.0952987670898,"y":1148.5240106582642,"wires":[["4d790304.5937e4"]]},{"id":"dd6d59ca.c92008","type":"watson-text-to-speech","z":"998d1542.4a7d2","name":"Text To Speech","lang":"en-GB","langhidden":"en-GB","voice":"en-GB_KateVoice","voicehidden":"en-US_LisaVoice","format":"audio/wav","password":"OZEpJHz51hBs","x":648.333251953125,"y":1375.6667203903198,"wires":[["1571a65f.8bbf3a"]]},{"id":"1d2c49e4.c149ae","type":"play audio","z":"998d1542.4a7d2","name":"","x":1019.1903610229492,"y":1374.6906366348267,"wires":[]},{"id":"1571a65f.8bbf3a","type":"change","z":"998d1542.4a7d2","name":"set a payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"speech","tot":"msg"},{"t":"delete","p":"speech","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":845.8332443237305,"y":1375.6668424606323,"wires":[["1d2c49e4.c149ae"]]},{"id":"e6651027.b151c","type":"exec","z":"998d1542.4a7d2","command":"sudo fswebcam -r 1280x720 --no-banner /home/pi/realTimeImage.jpg","addpay":true,"append":"","useSpawn":"","timer":"5","name":"Take a pic","x":566.6666259765625,"y":104.16674041748047,"wires":[["5ebd501b.1a6fe8"],[],[]]},{"id":"62beff3e.9f145","type":"inject","z":"998d1542.4a7d2","name":"Test","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":407.4333190917969,"y":164.8333282470703,"wires":[["690ee60c.f2e988"]]},{"id":"5ebd501b.1a6fe8","type":"template","z":"998d1542.4a7d2","name":"Status","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Real Time photo clicked sucessfully!","x":721.4333343505859,"y":108.83337783813477,"wires":[["ff339bdc.0d974"]]},{"id":"ff339bdc.0d974","type":"debug","z":"998d1542.4a7d2","name":"","active":true,"console":"false","complete":"false","x":885.1000862121582,"y":109.49995994567871,"wires":[]},{"id":"8694ba4e.ea9ef","type":"http in","z":"998d1542.4a7d2","name":"/face","url":"/face","method":"get","swaggerDoc":"","x":196.33330535888672,"y":749.3333368301392,"wires":[["56c765a0.ae0d0c"]]},{"id":"5042deb7.680908","type":"template","z":"998d1542.4a7d2","name":"WEB-IBM Watson","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Visual Recognition v3 Image Ananlysis
\nIBM Cloud Robot Visual Recognition Results:
\nImages Processed: {{result.images_processed}}
\n\n Age Range | Confidence | Gender | Confidence | Name |
\n {{#result.images.0.faces}}\n {{age.min}} - {{age.max}} | {{age.score}} | \n {{gender.gender}} | {{gender.score}} | \n {{identity.name}} ({{identity.score}}) | \n
{{/result.images.0.faces}}\n
\n\n\n","x":698.1427001953125,"y":749.5953979492188,"wires":[["281ffe0.a397482"]]},{"id":"281ffe0.a397482","type":"http response","z":"998d1542.4a7d2","name":"","x":863.6190643310547,"y":749.83349609375,"wires":[]},{"id":"56c765a0.ae0d0c","type":"file in","z":"998d1542.4a7d2","name":"Buffer","filename":"/home/pi/visionImage.jpg","format":"","x":322.3332977294922,"y":749.3333969116211,"wires":[["77698a0.930c9f8","456d13f7.e5711c"]]},{"id":"456d13f7.e5711c","type":"visual-recognition-v3","z":"998d1542.4a7d2","name":"","apikey":"5b3261aed590c1046eec90fbd0b03525d02e034d","image-feature":"detectFaces","lang":"en","x":489.66661834716797,"y":749.3333320617676,"wires":[["5042deb7.680908","fb1d8151.c20e","f0a9c565.f5f41"]]},{"id":"9c000c26.c51c78","type":"comment","z":"998d1542.4a7d2","name":"Web 169.254.170:1880/face (IBM Watson)","info":"","x":328.3333053588867,"y":711.6667108535767,"wires":[]},{"id":"dcff9243.ad331","type":"comment","z":"998d1542.4a7d2","name":"MQTT Output","info":"","x":230.33330535888672,"y":1272.6667032241821,"wires":[]},{"id":"d6ac938a.d51d08","type":"mqtt in","z":"998d1542.4a7d2","name":"MQTT-vision","topic":"vision","qos":"2","broker":"867260d8.6e4528","x":186.66667556762695,"y":104.00002956390381,"wires":[["690ee60c.f2e988","8fec4a2c.c5f18","9c895b3b.afefa8"]]},{"id":"8fec4a2c.c5f18","type":"exec","z":"998d1542.4a7d2","command":"sudo fswebcam -r 1280x720 --no-banner /home/pi/visionImage.jpg","addpay":false,"append":"","useSpawn":"","timer":"5","name":"Take a pic","x":420.00000762939453,"y":242.33330154418945,"wires":[["ddfa0e18.2f6b88"],[],[]]},{"id":"ddfa0e18.2f6b88","type":"template","z":"998d1542.4a7d2","name":"Status","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Vision photo clicked sucessfully!","x":580.3333282470703,"y":243.99993515014648,"wires":[["74f78a57.7da7bc"]]},{"id":"74f78a57.7da7bc","type":"debug","z":"998d1542.4a7d2","name":"","active":true,"console":"false","complete":"false","x":745.9999504089355,"y":244.66670417785645,"wires":[]},{"id":"98e25b97.fe592","type":"inject","z":"998d1542.4a7d2","name":"Test","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":250.00000762939453,"y":292.6666259765625,"wires":[["8fec4a2c.c5f18"]]},{"id":"3f84e46d.b464d4","type":"comment","z":"998d1542.4a7d2","name":"Analyze image","info":"","x":258.9524040222168,"y":329.4761743545532,"wires":[]},{"id":"5766efb6.bbaaf","type":"comment","z":"998d1542.4a7d2","name":"Real time image","info":"Real time image","x":202.1904754638672,"y":158.52378845214844,"wires":[]},{"id":"690ee60c.f2e988","type":"delay","z":"998d1542.4a7d2","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":412.6666831970215,"y":103.66670608520508,"wires":[["e6651027.b151c"]]},{"id":"4b23914.367e07","type":"delay","z":"998d1542.4a7d2","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":471.3333053588867,"y":1376.00004418691,"wires":[["dd6d59ca.c92008","26f815f9.88d7d2"]]},{"id":"24cca879.fda51","type":"watson-text-to-speech","z":"998d1542.4a7d2","name":"","lang":"en-GB","langhidden":"en-GB","voice":"en-GB_KateVoice","voicehidden":"","format":"audio/wav","password":"OZEpJHz51hBs","x":667.9999313354492,"y":852.0000238418579,"wires":[["e6061f21.b98618"]]},{"id":"e6061f21.b98618","type":"change","z":"998d1542.4a7d2","name":"set a payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"speech","tot":"msg"},{"t":"delete","p":"speech","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":851.3333053588867,"y":850.3333368301392,"wires":[["71adbafe.609a3c"]]},{"id":"71adbafe.609a3c","type":"play audio","z":"998d1542.4a7d2","name":"","x":974.7141036987305,"y":895.047625541687,"wires":[]},{"id":"fb1d8151.c20e","type":"debug","z":"998d1542.4a7d2","name":"","active":true,"console":"true","complete":"payload","x":704.3333053588867,"y":699.6667108535767,"wires":[]},{"id":"77698a0.930c9f8","type":"function","z":"998d1542.4a7d2","name":"Text to Speech","func":"msg.payload ='The Watson visual recognition system started rcognising your face.. Pleas wait about 30 to 60 sec. Thanks';\nreturn msg;","outputs":1,"noerr":0,"x":477.3333053588867,"y":851.6667108535767,"wires":[["24cca879.fda51"]]},{"id":"4df842c1.7cd16c","type":"watson-text-to-speech","z":"998d1542.4a7d2","name":"","lang":"en-GB","langhidden":"en-GB","voice":"en-GB_KateVoice","voicehidden":"","format":"audio/wav","password":"OZEpJHz51hBs","x":879.9999313354492,"y":796.6667108535767,"wires":[["d7b0e63c.7bc5a"]]},{"id":"d7b0e63c.7bc5a","type":"change","z":"998d1542.4a7d2","name":"set a payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"speech","tot":"msg"},{"t":"delete","p":"speech","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1063.3333053588867,"y":795.0000238418579,"wires":[["e75155c3.7d8f68"]]},{"id":"e75155c3.7d8f68","type":"play audio","z":"998d1542.4a7d2","name":"","x":1199.5712547302246,"y":839.7143392562866,"wires":[]},{"id":"f0a9c565.f5f41","type":"function","z":"998d1542.4a7d2","name":"Text to Speech","func":"msg.payload ='The Watson visual recognition system just finished.. Please chek the analyis result from the web. Thanks';\nreturn msg;","outputs":1,"noerr":0,"x":689.3333053588867,"y":796.3333978652954,"wires":[["4df842c1.7cd16c"]]},{"id":"26f815f9.88d7d2","type":"delay","z":"998d1542.4a7d2","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":580.3333053588867,"y":1426.6667108535767,"wires":[["3a277bad.f39c8c"]]},{"id":"3a277bad.f39c8c","type":"delay","z":"998d1542.4a7d2","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":694.3333053588867,"y":1480.6667108535767,"wires":[[]]},{"id":"f20874fe.184f28","type":"ui_button","z":"998d1542.4a7d2","name":"","group":"e613459b.c45b7","order":0,"width":0,"height":0,"label":"Take a pic","color":"","bgcolor":"","icon":"","payload":"1","payloadType":"str","topic":"","x":198,"y":219.85711669921875,"wires":[["690ee60c.f2e988","8fec4a2c.c5f18","9c895b3b.afefa8"]]},{"id":"b16f217e.e61f6","type":"file in","z":"998d1542.4a7d2","name":"Buffer","filename":"/home/pi/visionImage.jpg","format":"","x":498.33338737487793,"y":454.9999742507937,"wires":[["fd384ff1.b988c"]]},{"id":"fd384ff1.b988c","type":"visual-recognition-v3","z":"998d1542.4a7d2","name":"","apikey":"5b3261aed590c1046eec90fbd0b03525d02e034d","image-feature":"detectFaces","lang":"en","x":665.6667079925537,"y":454.99990940094017,"wires":[["a0a3c350.9e9ea","a1a61592.00bdb8","f4dbc580.59efe8"]]},{"id":"a0a3c350.9e9ea","type":"debug","z":"998d1542.4a7d2","name":"","active":true,"console":"true","complete":"true","x":860.3334407806396,"y":456.9999876022341,"wires":[]},{"id":"f6940ace.f06268","type":"inject","z":"998d1542.4a7d2","name":"","topic":"","payload":"visionImage.jpg","payloadType":"str","repeat":"","crontab":"","once":false,"x":275.8333930969238,"y":455.00005435943626,"wires":[["b16f217e.e61f6"]]},{"id":"a1a61592.00bdb8","type":"play audio","z":"998d1542.4a7d2","name":"","voice":"0","x":907.5000343322754,"y":418.33342838287376,"wires":[]},{"id":"36a9c0e6.e4f4d","type":"comment","z":"998d1542.4a7d2","name":"Simple exmaple","info":"","x":272.50006103515625,"y":398.33337211608887,"wires":[]},{"id":"f4dbc580.59efe8","type":"change","z":"998d1542.4a7d2","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"result.images","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":896.8333511352539,"y":503.33339214324974,"wires":[["33c52dbf.98a9a2"]]},{"id":"33c52dbf.98a9a2","type":"mqtt out","z":"998d1542.4a7d2","name":"","topic":"faceanswer","qos":"2","retain":"","broker":"867260d8.6e4528","x":1099.83349609375,"y":503.666748046875,"wires":[]},{"id":"8e1bfc38.6d035","type":"mqtt in","z":"998d1542.4a7d2","name":"","topic":"faceanswer","qos":"2","broker":"867260d8.6e4528","x":893.5000610351562,"y":556.6666870117188,"wires":[["cecbeeed.9ba79"]]},{"id":"9c895b3b.afefa8","type":"delay","z":"998d1542.4a7d2","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":455,"y":368,"wires":[["b16f217e.e61f6"]]},{"id":"16858e68.f6b282","type":"ui_template","z":"998d1542.4a7d2","group":"e613459b.c45b7","name":"","order":0,"width":0,"height":0,"format":"IBM Cloud Robot Web
\n\n\n\n\n","storeOutMessages":true,"fwdInMessages":true,"x":1050.8333892822266,"y":608.3333377838135,"wires":[[]]},{"id":"cecbeeed.9ba79","type":"ui_text","z":"998d1542.4a7d2","group":"e613459b.c45b7","order":0,"width":0,"height":0,"name":"","label":"Image answer: ","format":"{{msg.payload}}","layout":"row-spread","x":1071.6666259765625,"y":555,"wires":[]},{"id":"328c1c6d.e35b74","type":"comment","z":"998d1542.4a7d2","name":"Vision Image Processing Part","info":"","x":205,"y":52,"wires":[]},{"id":"867260d8.6e4528","type":"mqtt-broker","z":"","broker":"iot.eclipse.org","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""},{"id":"e613459b.c45b7","type":"ui_group","z":"","name":"Vision","tab":"7876100e.dfdc98","disp":true,"width":"6"},{"id":"7876100e.dfdc98","type":"ui_tab","z":"","name":"Vision","icon":"dashboard"}]