Xiaomi button as doorbell send camera image via email

This flow sends an email containing an image of an onvif capable camera in case someone pushed the doorbell button.

Used nodes:
node-red-contrib-xiaomi-home
node-red-contrib-onvif
node-red-node-email

image

[{"id":"37703cfc2bf203f1","type":"ONVIF Snapshot","z":"8ac69a5ce9c87f24","name":"entrance","url":"http://192.168.1.107:8080/","username":"camerausername","password":"camerapassword","x":680,"y":280,"wires":[["3286df4220678f9f","944b0ba5e2997b48"]]},{"id":"e7a25d9f04a10569","type":"inject","z":"8ac69a5ce9c87f24","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":480,"y":280,"wires":[["37703cfc2bf203f1"]]},{"id":"3286df4220678f9f","type":"debug","z":"8ac69a5ce9c87f24","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":870,"y":280,"wires":[]},{"id":"e3eb62c502f2a2e5","type":"xiaomi-home","z":"8ac69a5ce9c87f24","name":"door bell button","x":480,"y":180,"wires":[["edba5693d258b600","895bd271c0077785"]]},{"id":"1f771e095b5d2241","type":"e-mail","z":"8ac69a5ce9c87f24","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"[email protected]","dname":"[email protected]","credentials":{},"x":720,"y":400,"wires":[]},{"id":"944b0ba5e2997b48","type":"function","z":"8ac69a5ce9c87f24","name":"gen mail","func":"msg.topic = 'camera doorbell event';\nmsg.attachments = [\n    {\n        filename: 'entrance.jpg',\n        path: msg.payload.image.base64,\n        encoding: 'base64'\n    }\n];\n\nmsg.payload = new Date();\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":400,"wires":[["1f771e095b5d2241"]]},{"id":"edba5693d258b600","type":"switch","z":"8ac69a5ce9c87f24","name":"sid filter","property":"payload.sid","propertyType":"msg","rules":[{"t":"eq","v":"158d0001837b9d","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":680,"y":180,"wires":[["37703cfc2bf203f1"]]},{"id":"895bd271c0077785","type":"debug","z":"8ac69a5ce9c87f24","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":120,"wires":[]}]

Flow Info

Created 4 years, 7 months ago
Rating: 5 1

Owner

Actions

Rate:

Node Types

Core
  • debug (x2)
  • function (x1)
  • inject (x1)
  • switch (x1)
Other

Tags

  • doorbell
  • onvif
  • camera
  • email
  • xiaomi
  • button
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option