This node red flow, gets triggered by my motion sensor on the gate, and takes a picture on camera 4, stores it locally and sends the picture as an attachment to my email, then camera 2, after 15 second delay, (further up my drive) takes another picture and stores it locally and also sends me an email. The 2 pictures stored locally get over written each time the cameras are triggered (so as not to fill up the HD), but the email’s are individual hence multiple emails upon motion sensor being triggered. I’m using the AI thinker modules, from banggood and ESPhome software.
The set up has been running continuously for a week now and no problems, My camera’s dont have AI Thinker written on them. Other AI Thinker cameras from banggood that do have the AI Thinker logo on them seem to go offline after 10-20 mins and need a reset…
[{"id":"fd9bca74.3c93e8","type":"api-call-service","z":"672e99f5.a6edf8","name":"Front Door Cam","server":"62d7bb2f.196044","service_domain":"camera","service":"snapshot","data":"{\"entity_id\":\"camera.espcam_4\",\"filename\":\"/config/www/photos/doorbell_{{ now().strftime(\\\"%Y%m%d-%H%M%S\\\") }}.jpg\"}","mergecontext":"","output_location":"payload","output_location_type":"msg","x":560,"y":300,"wires":[[]]},{"id":"35499e35.82d0e2","type":"ha-api","z":"672e99f5.a6edf8","name":"","server":"62d7bb2f.196044","protocol":"websocket","method":"get","path":"","data":"{\"type\":\"camera_thumbnail\",\"entity_id\":\"camera.espcam_2\"}","location":"doorbell","locationType":"msg","x":530,"y":460,"wires":[["59f82765.8a0a38"]]},{"id":"8e1e73bd.f9ad7","type":"e-mail","z":"672e99f5.a6edf8","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"[email protected]","dname":"","x":990,"y":400,"wires":[]},{"id":"59f82765.8a0a38","type":"function","z":"672e99f5.a6edf8","name":"","func":"msg = {\n topic: `Doorbell Camera @ ${Date()}`,\n payload: 'Doorbell',\n attachments: [{\n \"filename\": \"doorbell.jpg\",\n \"content\": msg.doorbell.content,\n \"encoding\": 'base64'\n }]\n}\nreturn msg;","outputs":1,"noerr":0,"x":790,"y":400,"wires":[["8e1e73bd.f9ad7"]]},{"id":"72893018.fdbbd","type":"server-state-changed","z":"672e99f5.a6edf8","name":"Driveway sensor","server":"62d7bb2f.196044","entityidfilter":"binary_sensor.driveway_sensor","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":140,"y":460,"wires":[["330aa2f.a6d1d5e","e7b80f61.7776b","35499e35.82d0e2"]]},{"id":"330aa2f.a6d1d5e","type":"api-call-service","z":"672e99f5.a6edf8","name":"Drive Cam","server":"62d7bb2f.196044","service_domain":"camera","service":"snapshot","data":"{\"entity_id\":\"camera.espcam_2\",\"filename\":\"/config/www/photos/intruder{{ now().strftime(\\\"%Y%m%d-%H%M%S\\\") }}.jpg\"}","mergecontext":"","output_location":"payload","output_location_type":"msg","x":550,"y":540,"wires":[[]]},{"id":"e7b80f61.7776b","type":"stoptimer","z":"672e99f5.a6edf8","duration":"15","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":350,"y":400,"wires":[["fd9bca74.3c93e8","39221271.cc66ce"],[]]},{"id":"39221271.cc66ce","type":"ha-api","z":"672e99f5.a6edf8","name":"","server":"62d7bb2f.196044","protocol":"websocket","method":"get","path":"","data":"{\"type\":\"camera_thumbnail\",\"entity_id\":\"camera.espcam_4\"}","location":"doorbell","locationType":"msg","x":530,"y":380,"wires":[["59f82765.8a0a38"]]},{"id":"62d7bb2f.196044","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]