-
Notifications
You must be signed in to change notification settings - Fork 18
Ring Doorbell replacement
Northern Man edited this page Apr 11, 2020
·
2 revisions
This particular flow creates a 30 second video clip when a motion detector detects motion, and uploads it to Google Photo's for viewing. Mimicking the feature of the Ring Doorbell that scored very high on the WAF scale.
For this flow, I'm basically calling ffmpeg to grab 30 seconds of video, then using Upload-GPhotos to upload to Google Photos. ( I had tried using the upload-gphotos node, but couldn't get the authentication to work in a headless/no desktop environment ).
[{"id":"77caf709.6940f","type":"homekit-service","z":"83b4d188.9673c","isParent":true,"bridge":"cc234500.cbcc3","parentService":"","name":"Vacant Porch","serviceName":"Switch","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","characteristicProperties":"{}","x":110,"y":60,"wires":[["15f6fdde.96143a","774fe65f.028ee"]]},{"id":"2c470304.b6198c","type":"inject","z":"83b4d188.9673c","name":"Default ( True )","topic":"","payload":"{\"On\":true}","payloadType":"json","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":400,"y":40,"wires":[["15f6fdde.96143a"]]},{"id":"21b0461e.90ec3a","type":"function","z":"83b4d188.9673c","name":"Trigger","func":"msg.trigger = true;\nreturn msg;","outputs":1,"noerr":0,"x":450,"y":160,"wires":[["15f6fdde.96143a"]]},{"id":"774fe65f.028ee","type":"debug","z":"83b4d188.9673c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","x":270,"y":120,"wires":[]},{"id":"3f19a319.f206f4","type":"inject","z":"83b4d188.9673c","name":"Test Button","topic":"","payload":"{\"MotionDetected\": true}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":220,"wires":[["5475d175.d6d37"]]},{"id":"2b624234.edb2a6","type":"debug","z":"83b4d188.9673c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","x":430,"y":480,"wires":[]},{"id":"efc3a7ef.b925b","type":"trigger","z":"83b4d188.9673c","op1":"","op2":"","op1type":"date","op2type":"nul","duration":"100","extend":false,"units":"s","reset":"","bytopic":"all","name":"Once in 100","x":770,"y":160,"wires":[["c4a5fde8.60dab8"]]},{"id":"9caa2926.6f5788","type":"exec","z":"83b4d188.9673c","command":"~/npm/lib/node_modules/homebridge-camera-ffmpeg/scripts/upload_movie.sh \"Front Porch\" ","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"upload-gphotos","x":440,"y":420,"wires":[["7d2bdeea.0a981"],["a72766a3.ddcda8"],[]]},{"id":"a72766a3.ddcda8","type":"debug","z":"83b4d188.9673c","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","x":680,"y":420,"wires":[]},{"id":"5aae00e0.165708","type":"exec","z":"83b4d188.9673c","command":"~/npm/lib/node_modules/homebridge-camera-ffmpeg/scripts/create_movie.sh Front_Porch","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Movie","x":450,"y":340,"wires":[[],["a72766a3.ddcda8"],["a33b6518.f8522"]]},{"id":"8d75d2b9.1b3b7","type":"join","z":"83b4d188.9673c","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":210,"y":420,"wires":[["9caa2926.6f5788","2b624234.edb2a6"]]},{"id":"a33b6518.f8522","type":"change","z":"83b4d188.9673c","name":"msg.complete","rules":[{"t":"move","p":"payload","pt":"msg","to":"complete","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":340,"wires":[["8d75d2b9.1b3b7"]]},{"id":"5773d05b.dd0d7","type":"moment","z":"83b4d188.9673c","name":"","topic":"","input":"","inputType":"msg","inTz":"America/Toronto","adjAmount":"0","adjType":"hours","adjDir":"subtract","format":"[/home/sgracey/Porch_]YYYY_MM_DD_HH_mm_ss[.mp4]","locale":"en_CA","output":"payload","outputType":"msg","outTz":"America/Toronto","x":200,"y":340,"wires":[["5aae00e0.165708","8d75d2b9.1b3b7","2b624234.edb2a6"]]},{"id":"3139aa08.a59dae","type":"exec","z":"83b4d188.9673c","command":"~/npm/lib/node_modules/homebridge-camera-ffmpeg/scripts/cache_movie.sh Front_Porch rtsp://Porch:[email protected]/live","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"FFMPEG","x":400,"y":640,"wires":[["892e325d.4e62d"],["892e325d.4e62d"],["892e325d.4e62d","523e11bb.c40c88"]]},{"id":"892e325d.4e62d","type":"debug","z":"83b4d188.9673c","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","x":700,"y":620,"wires":[]},{"id":"523e11bb.c40c88","type":"delay","z":"83b4d188.9673c","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":400,"y":720,"wires":[["3139aa08.a59dae"]]},{"id":"c4a5fde8.60dab8","type":"trigger","z":"83b4d188.9673c","op1":"","op2":"","op1type":"nul","op2type":"date","duration":"40","extend":true,"units":"s","reset":"","bytopic":"all","name":"40 Seconds After","x":470,"y":240,"wires":[["5773d05b.dd0d7"]]},{"id":"5d60ad46.48a5a4","type":"start-up-trigger","z":"83b4d188.9673c","x":160,"y":640,"wires":[["3139aa08.a59dae"]]},{"id":"21a34c11.304a8c","type":"hb-event","z":"83b4d188.9673c","name":"Front Porch","Homebridge":"Leonard-Amazon","Manufacturer":"homebridge-rtl_433","Service":"Motion Sensor","device":"Leonard-AmazonAC:22:3D:E3:CE:31homebridge-rtl_433Front Porch00000085","conf":"aa4ff25c.416df8","x":90,"y":160,"wires":[["5475d175.d6d37","774fe65f.028ee"]]},{"id":"15f6fdde.96143a","type":"hold","z":"83b4d188.9673c","name":"Hold","x":610,"y":160,"wires":[["efc3a7ef.b925b"]]},{"id":"5475d175.d6d37","type":"switch","z":"83b4d188.9673c","name":"True","property":"payload.MotionDetected","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":310,"y":160,"wires":[["21b0461e.90ec3a"]]},{"id":"6f30b32a.53f704","type":"homekit-service","z":"83b4d188.9673c","isParent":true,"bridge":"cc234500.cbcc3","parentService":"","name":"Reset Porch","serviceName":"Switch","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","characteristicProperties":"{}","x":150,"y":560,"wires":[["f948a4ae.ec7e48"]]},{"id":"65d0a437.9a409c","type":"exec","z":"83b4d188.9673c","command":"pkill ffmpeg; rm /var/tmp/*jpg /var/tmp/*jpeg ~/*mp4","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Reset ffmpeg","x":660,"y":560,"wires":[[],[],["1f777eae.7f3c41"]]},{"id":"f948a4ae.ec7e48","type":"switch","z":"83b4d188.9673c","name":"True","property":"payload.On","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":390,"y":560,"wires":[["65d0a437.9a409c","892e325d.4e62d"]]},{"id":"1f777eae.7f3c41","type":"delay","z":"83b4d188.9673c","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":880,"y":560,"wires":[["be99851b.fa9f2"]]},{"id":"be99851b.fa9f2","type":"function","z":"83b4d188.9673c","name":"Turn off","func":"msg.payload = { On: false }\nreturn msg;","outputs":1,"noerr":0,"x":1080,"y":560,"wires":[["6f30b32a.53f704"]]},{"id":"7d2bdeea.0a981","type":"debug","z":"83b4d188.9673c","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","x":680,"y":480,"wires":[]},{"id":"cc234500.cbcc3","type":"homekit-bridge","z":"","bridgeName":"Sheldon-NodeRed","pinCode":"031-45-154","port":"51831","allowInsecureRequest":true,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true},{"id":"aa4ff25c.416df8","type":"hb-conf","z":"","username":"031-45-154"}]