Skip to content

Instantly share code, notes, and snippets.

@Chrispassold Chrispassold/S3BUCKET
Last active Feb 22, 2019

Embed
What would you like to do?
NodeRed
[{"id":"fbb47df.cfdae8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"921e4718.36eaa8","type":"rpi-dht22","z":"fbb47df.cfdae8","name":"","topic":"rpi-dht22","dht":22,"pintype":"0","pin":"18","x":564.5,"y":80,"wires":[["612eb64e.ca2458"]]},{"id":"8a63b616.e6a7e8","type":"twitter out","z":"fbb47df.cfdae8","twitter":"","name":"Twitter sender","x":1099,"y":113,"wires":[]},{"id":"612eb64e.ca2458","type":"function","z":"fbb47df.cfdae8","name":"Build message","func":"\nvar date = new Date();\n\nmsg.payload = 'hora: ' + date.getTime() + ', temperatura: ' + msg.payload + ', umidade: ' + msg.humidity ;\n\nreturn msg;","outputs":1,"noerr":0,"x":876,"y":90,"wires":[["8a63b616.e6a7e8"]]},{"id":"c9fb2e28.900e2","type":"AWS Rekognition","z":"fbb47df.cfdae8","aws":"cf9a3ab5.55fd28","operation":"DetectText","SourceImage":"","TargetImage":"","CollectionId":"","Input":"","Output":"","Name":"","Settings":"","RoleArn":"","FaceIds":"","Image":"{ \"S3Object\": { \"Bucket\": \"concentrado-raspberry-amazon\", \"Name\": \"placa1.jpg\" } }","Id":"","JobId":"","FaceId":"","Video":"","name":"","x":696,"y":376,"wires":[["5f336d9a.755714"],["1fca0094.04aacf"]]},{"id":"d0039724.46ea78","type":"inject","z":"fbb47df.cfdae8","name":"","topic":"","payload":"","payloadType":"date","repeat":"3","crontab":"","once":false,"onceDelay":0.1,"x":318,"y":384,"wires":[["c9fb2e28.900e2"]]},{"id":"5f336d9a.755714","type":"debug","z":"fbb47df.cfdae8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":1069,"y":331,"wires":[]},{"id":"1fca0094.04aacf","type":"debug","z":"fbb47df.cfdae8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1140,"y":419,"wires":[]},{"id":"cf9a3ab5.55fd28","type":"amazon config","z":"","name":"AWS","region":"us-east-1","proxyRequired":false,"proxy":""}]
[{"id":"9873c3bf.619d9","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"42e66709.370398","type":"inject","z":"9873c3bf.619d9","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":600,"y":800,"wires":[["4751cf56.e64f3"]]},{"id":"4751cf56.e64f3","type":"exec","z":"9873c3bf.619d9","command":"sudo wget --output-document=/home/pi/foto.jpg http://201.54.201.54:8080/?action=snapshot ","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Tira Foto","x":600,"y":900,"wires":[["3597f33c.2cf6bc"],[],[]]},{"id":"3597f33c.2cf6bc","type":"exec","z":"9873c3bf.619d9","command":"cat /home/pi/foto.jpg | base64","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Busca Foto","x":610,"y":1000,"wires":[["22b0afc2.b96c"],[],[]]},{"id":"f0b813d6.1b594","type":"AWS Lambda","z":"9873c3bf.619d9","aws":"7d965f15.65273","operation":"Invoke","FunctionName":"PutImageS3","StatementId":"","Action":"","Principal":"","Name":"","FunctionVersion":"","EventSourceArn":"","Runtime":"","Role":"","Handler":"","Code":"","UUID":"","InvokeArgs":"","Resource":"","ReservedConcurrentExecutions":"","Tags":"","TagKeys":"","name":"Upload da Imagem","x":630,"y":1180,"wires":[["23752a7c.a55b16"],[]]},{"id":"22b0afc2.b96c","type":"function","z":"9873c3bf.619d9","name":"Constrói Resposta","func":"\nconst image = msg.payload;\n\nif (image.indexOf(',') > -1) {\n image.replaceAll(',')[1];\n}\n\nconst response = {\n \"buffer\": image\n};\n\nmsg.payload = JSON.stringify(response);\n\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":1100,"wires":[["f0b813d6.1b594"]]},{"id":"23752a7c.a55b16","type":"AWS Rekognition","z":"9873c3bf.619d9","aws":"7d965f15.65273","operation":"CompareFaces","SourceImage":"{ \"S3Object\": { \"Bucket\": \"concentrado-raspberry-amazon\", \"Name\": \"referencia.jpg\" } }","TargetImage":"{ \"S3Object\": { \"Bucket\": \"concentrado-raspberry-amazon\", \"Name\": \"foto.jpg\" } }","CollectionId":"","Input":"","Output":"","Name":"","Settings":"","RoleArn":"","FaceIds":"","Image":"","Id":"","JobId":"","FaceId":"","Video":"","name":"","x":660,"y":1260,"wires":[["2e70832d.edd61c","ba68e153.b4dbb"],[]]},{"id":"ba68e153.b4dbb","type":"debug","z":"9873c3bf.619d9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":1010,"y":1340,"wires":[]},{"id":"2e70832d.edd61c","type":"function","z":"9873c3bf.619d9","name":"Transform","func":"var qtdFaces = !!msg.payload.FaceMatches ? msg.payload.FaceMatches.length : 0;\nqtdFaces += !!msg.payload.UnmatchedFaces ? msg.payload.UnmatchedFaces.length : 0;\nvar payload = {\n qtdFaces: qtdFaces\n};\n \npayload['similarities'] = msg.payload.FaceMatches.map(elem => {\n return elem.Similarity\n});\n\nmsg.payload = payload;\n\nreturn msg;","outputs":1,"noerr":0,"x":600,"y":1340,"wires":[["ba68e153.b4dbb"]]},{"id":"7d965f15.65273","type":"amazon config","z":"","name":"AWS","region":"us-east-1","proxyRequired":false,"proxy":""}]
[{"id":"fbb47df.cfdae8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"921e4718.36eaa8","type":"rpi-dht22","z":"fbb47df.cfdae8","name":"","topic":"rpi-dht22","dht":22,"pintype":"0","pin":"18","x":564.5,"y":80,"wires":[["612eb64e.ca2458"]]},{"id":"8a63b616.e6a7e8","type":"twitter out","z":"fbb47df.cfdae8","twitter":"","name":"Twitter sender","x":1099,"y":113,"wires":[]},{"id":"612eb64e.ca2458","type":"function","z":"fbb47df.cfdae8","name":"Build message","func":"\nvar date = new Date();\n\nmsg.payload = 'hora: ' + date.getTime() + ', temperatura: ' + msg.payload + ', umidade: ' + msg.humidity ;\n\nreturn msg;","outputs":1,"noerr":0,"x":876,"y":90,"wires":[["8a63b616.e6a7e8"]]},{"id":"c9fb2e28.900e2","type":"AWS Rekognition","z":"fbb47df.cfdae8","aws":"cf9a3ab5.55fd28","operation":"DetectText","SourceImage":"","TargetImage":"","CollectionId":"","Input":"","Output":"","Name":"","Settings":"","RoleArn":"","FaceIds":"","Image":"{ \"S3Object\": { \"Bucket\": \"concentrado-raspberry-amazon\", \"Name\": \"placa1.jpg\" } }","Id":"","JobId":"","FaceId":"","Video":"","name":"","x":696,"y":376,"wires":[["5f336d9a.755714"],["1fca0094.04aacf"]]},{"id":"5f336d9a.755714","type":"debug","z":"fbb47df.cfdae8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":1069,"y":331,"wires":[]},{"id":"1fca0094.04aacf","type":"debug","z":"fbb47df.cfdae8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1140,"y":419,"wires":[]},{"id":"74018e00.3ea5a4","type":"exec","z":"fbb47df.cfdae8","command":"wget --output-document=/home/pi/Foto.jpg http://201.54.201.38:8080/?action=snapshot","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Tira Foto","x":470.1840362548828,"y":583.1181106567383,"wires":[["fe31e329.ff506"],[],[]]},{"id":"5f1a6e89.4d5e8","type":"inject","z":"fbb47df.cfdae8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":265.5138854980469,"y":581.2951736450195,"wires":[["74018e00.3ea5a4"]]},{"id":"a5e46222.338d7","type":"AWS Lambda","z":"fbb47df.cfdae8","aws":"cf9a3ab5.55fd28","operation":"Invoke","FunctionName":"PutImageS3","StatementId":"","Action":"","Principal":"","Name":"","FunctionVersion":"","EventSourceArn":"","Runtime":"","Role":"","Handler":"","Code":"","UUID":"","InvokeArgs":"","Resource":"","ReservedConcurrentExecutions":"","Tags":"","TagKeys":"","name":"","x":649.3020629882812,"y":766.7847347259521,"wires":[[],[]]},{"id":"fe31e329.ff506","type":"exec","z":"fbb47df.cfdae8","command":"cat /home/pi/Foto.jpg | base64","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":737.3020858764648,"y":591.7846984863281,"wires":[["84b45801.2c32d8"],[],[]]},{"id":"84b45801.2c32d8","type":"function","z":"fbb47df.cfdae8","name":"para base 64","func":"var image = msg.payload;\n\nif (image.indexOf(',') > -1) {\n image = image.split(',')[1];\n}\n\nvar json = {\"buffer\": image}\n\nmsg.payload = JSON.stringify(json);\n\nreturn msg;","outputs":1,"noerr":0,"x":403.2916717529297,"y":740.9653091430664,"wires":[["a5e46222.338d7"]]},{"id":"cf9a3ab5.55fd28","type":"amazon config","z":"","name":"AWS","region":"us-east-1","proxyRequired":false,"proxy":""}]
[{"id":"fbb47df.cfdae8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"921e4718.36eaa8","type":"rpi-dht22","z":"fbb47df.cfdae8","name":"","topic":"rpi-dht22","dht":22,"pintype":"0","pin":"18","x":564.5,"y":80,"wires":[["612eb64e.ca2458"]]},{"id":"225310d.f3537f","type":"inject","z":"fbb47df.cfdae8","name":"","topic":"","payload":"","payloadType":"date","repeat":"10","crontab":"","once":false,"onceDelay":0.1,"x":288,"y":166,"wires":[["921e4718.36eaa8"]]},{"id":"8a63b616.e6a7e8","type":"twitter out","z":"fbb47df.cfdae8","twitter":"","name":"Twitter sender","x":1099,"y":113,"wires":[]},{"id":"612eb64e.ca2458","type":"function","z":"fbb47df.cfdae8","name":"Build message","func":"\nvar date = new Date();\n\nmsg.payload = 'hora: ' + date.getTime() + ', temperatura: ' + msg.payload + ', umidade: ' + msg.humidity ;\n\nreturn msg;","outputs":1,"noerr":0,"x":876,"y":90,"wires":[["8a63b616.e6a7e8"]]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.