Skip to content

Instantly share code, notes, and snippets.

@rons4

rons4/README.md Secret

Last active March 19, 2021 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rons4/1d78fabd12ee19bb9f1bcf3d7c2f2796 to your computer and use it in GitHub Desktop.
Save rons4/1d78fabd12ee19bb9f1bcf3d7c2f2796 to your computer and use it in GitHub Desktop.
Camera Alert with tinyCam and SIGNL4

This flow sends an alert with an image of a surveillance camera if a motion has been detected.

Camera

As camera we just use an Android phone and the tinyCam Pro app. This one can detect motion and also provides an API for accessing the video stream or current image.

Alerting App

For alerting we use the app-based alerting service SIGNL4. The app receives the alert along with the image and a link to the video stream.

Node-RED Flow

The Node-RED flow waits for the webhook request indicating that the camera has detected some motion. Then the HTTP request downloads the current image. The JavaScript function assembles the alert data and also converts the binary image data into a base64 string.

Flow

The flow can be adapted easily to support other cameras as well.

[{"id":"ddecbc9e.f31ab","type":"tab","label":"SIGNL4 Camera Alert","disabled":false,"info":"This flow sends an alert with an image of a surveillance camera if a motion has been detected.\r\n\r\n## Camera\r\nAs camera we just use an Android phone and the [tinyCam Pro](https://play.google.com/store/apps/details?id=com.alexvas.dvr.pro) app. This one can detect motion and also provides an API for accessing the video stream or current image.\r\n\r\n## Alerting App\r\nFor alerting we use the app-based alerting service [SIGNL4](https://www.signl4.com). The app receives the alert along with the image and a link to the video stream.\r\n\r\n## Node-RED Flow\r\nThe Node-RED flow waits for the webhook request indicating that the camera has detected some motion. Then the HTTP request downloads the current image. The JavaScript function assembles the alert data and also converts the binary image data into a base64 string.\r\n\r\nThe flow can be adapted easily to support other cameras as well.\r\n"},{"id":"64c6ac2d.225464","type":"function","z":"ddecbc9e.f31ab","name":"","func":"\nlet base64Data = msg.payload.toString('base64');\n\nvar data = {\n \"attachmentBase64Content1\": base64Data,\n \"attachmentMimeType1\": \"image/jpeg\",\n \"X-S4-Location\": \"52.399442,13.0583737\",\n \"Subject\": \"Camera Alert\",\n \"Body\": \"Intruder detected.\",\n \"LiveStream\": \"http://192.168.2.103:8083/live\"\n};\n\nmsg.payload = data;\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":580,"y":180,"wires":[["29e0cf02.12d9c"]]},{"id":"60ef8e95.a1b29","type":"http in","z":"ddecbc9e.f31ab","name":"Webhook","url":"/webhook","method":"get","upload":false,"swaggerDoc":"","x":140,"y":280,"wires":[["ae7fe2fb.52c0f","8798e579.638418"]]},{"id":"ae7fe2fb.52c0f","type":"http response","z":"ddecbc9e.f31ab","name":"","statusCode":"200","headers":{},"x":280,"y":340,"wires":[]},{"id":"7e2719e5.19a388","type":"inject","z":"ddecbc9e.f31ab","name":"Manual Trigger","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":180,"wires":[["8798e579.638418"]]},{"id":"29e0cf02.12d9c","type":"SIGNL4","z":"ddecbc9e.f31ab","name":"SIGNL4 Alerting","teamSecret":"********","alertSubject":"","alertBody":"","alertS4Service":"","alertS4Location":"","alertS4AlertingScenario":"single_ack","alertS4Filtering":"false","alertS4ExternalID":"","x":740,"y":240,"wires":[[]]},{"id":"8798e579.638418","type":"http request","z":"ddecbc9e.f31ab","name":"Get Image","method":"GET","ret":"bin","paytoqs":"ignore","url":"http://192.168.2.103:8083/axis-cgi/jpg/image.cgi","tls":"","persist":false,"proxy":"","authType":"basic","x":410,"y":240,"wires":[["64c6ac2d.225464"]]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment