# MQTT Camera for Node-RED

**URL:** <https://discourse.nodered.org/t/mqtt-camera-for-node-red/20441>\
**Category:** Share Your Projects\
**Created:** [16 January 2020 10:48 UTC](https://discourse.nodered.org/t/mqtt-camera-for-node-red/20441 "2020-01-16T10:48:34Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![mpxd](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mpxd/32/2028_2.png) [@mpxd](https://discourse.nodered.org/u/mpxd)\
**Post date:** [10 August 2020 06:51 UTC](https://discourse.nodered.org/t/mqtt-camera-for-node-red/20441/17 "2020-08-10T06:51:46Z")

</div>

I wanted to added something - but I am unable to edit [the post above](https://discourse.nodered.org/t/mqtt-camera-for-node-red/20441/8).

This example used a webhook in Node-RED to trigger a flow that keeps the video recording running as long as there is movement detected in front of your camera.

You can of course replace the webhook with the MQTT alarm server topic `status/alarm/triggered`:

![Untitled](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/8/98c4cce514df055ff05ae692a384a0ec86806aa1.png)

The first flow starts a video recording and keeps it running for the time that your camera keeps triggering alert. And the second flow moves your camera into an alarm position and makes sure that it stays there until the alert is over.

```json
[{"id":"97187d7.8e4048","type":"change","z":"f915c95a.f48d08","name":"Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"val\":\"off\"}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":382,"y":81,"wires":[["c75f7959.e8ed88"]]},{"id":"6152fa88.5894a4","type":"change","z":"f915c95a.f48d08","name":"On","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"val\":\"60\"}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":209,"y":35,"wires":[["7d20b73f.057588"]]},{"id":"c75f7959.e8ed88","type":"mqtt out","z":"f915c95a.f48d08","name":"/features/manualrec/stop","topic":"instar/local/features/manualrec/stop","qos":"1","retain":"false","broker":"6f1cf632.979988","x":558,"y":81,"wires":[]},{"id":"7d20b73f.057588","type":"mqtt out","z":"f915c95a.f48d08","name":"features/manualrec/start","topic":"instar/local/features/manualrec/start","qos":"1","retain":"false","broker":"6f1cf632.979988","x":389,"y":35,"wires":[]},{"id":"3c45400c.9263","type":"stoptimer2","z":"f915c95a.f48d08","duration":"5","durationType":"num","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":235,"y":87,"wires":[["97187d7.8e4048"],[]]},{"id":"36b16289.f7ecce","type":"mqtt in","z":"f915c95a.f48d08","name":"Alarm Server","topic":"instar/local/status/alarm/triggered","qos":"1","datatype":"auto","broker":"6f1cf632.979988","x":75,"y":57,"wires":[["6152fa88.5894a4","3c45400c.9263"]]},{"id":"ffc691d5.f9282","type":"change","z":"f915c95a.f48d08","name":"Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"val\":\"0\"}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":388,"y":213,"wires":[["7ed79cc0.a20144"]]},{"id":"a8077a3e.5ba3f8","type":"change","z":"f915c95a.f48d08","name":"On","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"val\":\"1\"}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":217,"y":169,"wires":[["7ed79cc0.a20144"]]},{"id":"7ed79cc0.a20144","type":"mqtt out","z":"f915c95a.f48d08","name":"features/ptz/preset","topic":"instar/local/features/ptz/preset","qos":"1","retain":"false","broker":"6f1cf632.979988","x":393,"y":169,"wires":[]},{"id":"829ee295.90a02","type":"stoptimer2","z":"f915c95a.f48d08","duration":"5","durationType":"num","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":241,"y":219,"wires":[["ffc691d5.f9282"],[]]},{"id":"27b53bb8.d0c284","type":"mqtt in","z":"f915c95a.f48d08","name":"Alarm Server","topic":"instar/local/status/alarm/triggered","qos":"1","datatype":"auto","broker":"6f1cf632.979988","x":80,"y":184,"wires":[["a8077a3e.5ba3f8","829ee295.90a02"]]},{"id":"6f1cf632.979988","type":"mqtt-broker","z":"","name":"IN-8015FHD White","broker":"192.168.2.117","port":"8883","tls":"56befee0.6df6c","clientid":"","usetls":true,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"56befee0.6df6c","type":"tls-config","z":"","name":"pcert.pem","cert":"","key":"","ca":"","certname":"pcert.pem","keyname":"","caname":"","servername":"","verifyservercert":true}]

```

---

_[View the full topic](https://discourse.nodered.org/t/mqtt-camera-for-node-red/20441)._
