# Blue Iris v5 with INSTAR MQTT Cameras

**URL:** <https://discourse.nodered.org/t/blue-iris-v5-with-instar-mqtt-cameras/28718>\
**Category:** Share Your Projects\
**Created:** [22 June 2020 10:02 UTC](https://discourse.nodered.org/t/blue-iris-v5-with-instar-mqtt-cameras/28718 "2020-06-22T10:02:26Z")\
**Posts on this page:** 5\
**Page:** 1

<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:** [22 June 2020 10:02 UTC](https://discourse.nodered.org/t/blue-iris-v5-with-instar-mqtt-cameras/28718/1 "2020-06-22T10:02:26Z")

</div>

The version 5 of Blue Iris now sports an MQTT interface through which you can use a couple of [Admin Commands](https://wiki.instar.com/Software/Windows/Blue_Iris_v5/INSTAR_MQTT/#admin-commands) to take control over the software with Node-RED.

## Connect Blue Iris to your Broker

I am using an [MQTT Broker/Camera](https://discourse.nodered.org/t/mqtt-camera-for-node-red/20441) - but you can use any MQTT Broker on your network to connect Blue Iris to. To activate the MQTT Service enter the BlueIris **Software Settings**. Go to the **Digital IO and IoT** tab and click **Configure** to set up the MQTT service (Blue Iris configuration on the left and INSTAR MQTT Broker settings on the right):

 ![BlueIris5_INSTAR_MQTT_02](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/b/0ba7d69d1e945a15377714495dd23ea2abf1e8f1.png)

The camera is configured to work as a broker on IP `192.168.2.111` on port `1883`.

## MQTT Alarm Service

I can now right-click my cameras live video and select **Camera Settings** from the pop-up menu in Blue Iris. In the settings menu, on the **Alerts** tab and click on **ON alert...** in the **Actions** section. Here we can set the action that should be take when an alarm is triggered by this camera in Blue Iris - click on the **+** Icon in the lower left to add **Web request or MQTT** as the action you want to be triggered.

 ![BlueIris5_INSTAR_MQTT_05](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/d/0db0ee63aaff632b2317e5187b9b1697c2690e56.png)

In the screenshot you can see the interface that allows you set an MQTT Topic and a payload for the **MQTT Alarm Service**. Choose the topic freely. For the payload I recommend using `1` or `ON`. Save your settings, go back to the **Alerts** tab. Now click on **ON reset ...** (right next to **ON alert...** ) and set the MQTT Topic and Payload you want Blue Iris to use when the alarm stops. I recommend using the same MQTT Topic as above - but this time with the Payload `0` or `OFF`.

## Connecting Blue Iris to Node-RED

We can now use an MQTT input node to switch the camera that caused the alarm into Fullscreen Mode. The [MQTT Node has to be connected to our Broker](https://discourse.nodered.org/t/mqtt-camera-for-node-red/20441). And we need a switch node to add the message payload `camera=black&fullscreen=1` when an alarm was triggered or `camera=black&escape` once the alarm event ended - see [BlueIris Admin Command Topics](https://wiki.instar.com/Software/Windows/Blue_Iris_v5/INSTAR_MQTT/#admin-commands) for more options.

> **Note** : the camera name is the **Short Name** that you gave your camera when adding it to Blue Iris. In my cas I am having a white and a black INSTAR IN-8015 Full HD camera. And the one I am using here is simply called `black` -\> `camera=black&escape`.

This payload is then send to an MQTT Output Node for the MQTT Topic `BlueIris/admin`:

 ![BlueIris_MQTT_Node-RED_05](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/7/97976aac7a278a4bd78df4c8a561f2f98483624a.png)

### JSON Flow

```json
[{"id":"1ef23583.3125da","type":"mqtt in","z":"d214d2a3.60f88","name":"8015black","topic":"BlueIris/MotionAlarm/8015black/","qos":"1","datatype":"auto","broker":"59e4c061.7fa47","x":80,"y":40,"wires":[["839a411c.c4b58","f4dfe612.41b778"]]},{"id":"839a411c.c4b58","type":"ui_chart","z":"d214d2a3.60f88","name":"Alarm History","group":"bdd83452.7d8268","order":0,"width":0,"height":0,"label":"Alarm History","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"step","nodata":"","dot":false,"ymin":"0","ymax":"1","removeOlder":"10","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#ff0000","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#0036fa","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":241,"y":40,"wires":[[]]},{"id":"a623cc9e.cbfda","type":"change","z":"d214d2a3.60f88","name":"Fullscreen","rules":[{"t":"set","p":"payload","pt":"msg","to":"camera=black&fullscreen=1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":83,"wires":[["df3ba8df.d06188"]]},{"id":"df3ba8df.d06188","type":"mqtt out","z":"d214d2a3.60f88","name":"BlueIris Admin","topic":"BlueIris/admin","qos":"1","retain":"false","broker":"59e4c061.7fa47","x":526,"y":105,"wires":[]},{"id":"10990716.1b0309","type":"change","z":"d214d2a3.60f88","name":"Escape","rules":[{"t":"set","p":"payload","pt":"msg","to":"camera=black&escape","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":123,"wires":[["df3ba8df.d06188"]]},{"id":"f4dfe612.41b778","type":"switch","z":"d214d2a3.60f88","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":200,"y":103,"wires":[["a623cc9e.cbfda"],["10990716.1b0309"]]},{"id":"59e4c061.7fa47","type":"mqtt-broker","z":"","name":"ioBroker","broker":"192.168.2.111","port":"1883","clientid":"Node-RED","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"bdd83452.7d8268","type":"ui_group","z":"","name":"IN-8015 FHD (black)","tab":"1d003210.ddce5e","disp":true,"width":"6","collapse":false},{"id":"1d003210.ddce5e","type":"ui_tab","z":"","name":"ioBroker","icon":"dashboard","disabled":false,"hidden":false}]

```

To use this flow you have to connect the input and output node to your MQTT broker and change the MQTT topic of the input node to the alarm topic you set in Blue Iris. Also change the camera name in the payload that is set in both change nodes.

Now every time an alarm is triggered for this camera in Blue Iris, Node-RED will be notified and send a command to Blue Iris to switch that camera into fullscreen mode.

This is just one example - there are a lot more [BlueIris Admin Command Topics](https://wiki.instar.com/Software/Windows/Blue_Iris_v5/INSTAR_MQTT/#admin-commands) that you can use. And of course you can now also use the alarm event in Blue Iris to trigger other flows in Node-RED. There are endless possibilities 🙂

## Adding Blue Iris Live Video to your Node-RED Dashboard

Adding the [Live Video of an IP camera](https://wiki.instar.com/Advanced_User/Node-RED_Dashboard_Live_Video/) directly can be done by fetching snapshots or using special ONVIF or MJPEG nodes. But you can also get your video from Blue Iris. And there is one thing that I particularly like about this option - Blue Iris offers a Snapshot and MJPEG URL that gives you access to an overview over all your cameras.

When you query the snapshot from every camera on your network you will notice that this needs a surprising amount of bandwidth. Combining all snapshots into one is a big improvement there:

 ![BlueIris_MQTT_Node-RED_09](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/c/9cc155ceee1993b802c4793564af36df3bc93c9f.png)

My Blue Iris installation runs on IP `192.168.2.112` with its webserver on port `8181`. To access the snapshot I can use:

```bash
http://192.168.2.112:8181/image/black

http://192.168.2.112:8181/image/Index

```

The first one gives me the live image of the camera with the **Short Name** `black`. The second URL gives me access to an overview over all my cameras.

> **Note** : If you want to use the MJPEG stream instead of the snapshot, replace the word `image` in those URLs with `mjpg` - e.g. `http://192.168.2.112:8181/mjpg/Index`

But I am using an HTTP GET node with **basic Authentication** to access the snapshot, then run it through an `base64` node and imbed it into my dashboard with a template node:

```html
<img src="data:image/jpg;base64,{{msg.payload}}"/>

```

### Flow Export

```bash
[{"id":"92b13759.9f1f78","type":"ui_template","z":"d214d2a3.60f88","group":"bdd83452.7d8268","name":"Black","order":2,"width":"6","height":"4","format":"<img src=\"data:image/jpg;base64,{{msg.payload}}\"/>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":527,"y":860,"wires":[[]]},{"id":"2341ecb1.c86894","type":"inject","z":"d214d2a3.60f88","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"","x":110,"y":860,"wires":[["5088c5c3.a004ec"]]},{"id":"5088c5c3.a004ec","type":"http request","z":"d214d2a3.60f88","name":"Snapshot","method":"GET","ret":"bin","paytoqs":false,"url":"http://192.168.2.112:8181/image/black","tls":"","persist":false,"proxy":"","authType":"basic","x":257,"y":860,"wires":[["f7b0fb08.fc2618"]]},{"id":"f7b0fb08.fc2618","type":"base64","z":"d214d2a3.60f88","name":"","action":"","property":"payload","x":397,"y":860,"wires":[["92b13759.9f1f78"]]},{"id":"faadd8c0.8d5668","type":"ui_template","z":"d214d2a3.60f88","group":"f9ead57d.88dbb8","name":"Overview","order":2,"width":"12","height":"6","format":"<img src=\"data:image/jpg;base64,{{msg.payload}}\"/>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":537,"y":900,"wires":[[]]},{"id":"79f02a71.38a7e4","type":"inject","z":"d214d2a3.60f88","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"","x":110,"y":900,"wires":[["89943c2.5de24c"]]},{"id":"89943c2.5de24c","type":"http request","z":"d214d2a3.60f88","name":"Snapshot","method":"GET","ret":"bin","paytoqs":false,"url":"http://192.168.2.112:8181/image/Index","tls":"","persist":false,"proxy":"","authType":"basic","x":257,"y":900,"wires":[["c5048969.16ac48"]]},{"id":"c5048969.16ac48","type":"base64","z":"d214d2a3.60f88","name":"","action":"","property":"payload","x":397,"y":900,"wires":[["faadd8c0.8d5668"]]},{"id":"bdd83452.7d8268","type":"ui_group","z":"","name":"IN-8015 FHD (black)","tab":"1d003210.ddce5e","order":1,"disp":true,"width":"6","collapse":false},{"id":"f9ead57d.88dbb8","type":"ui_group","z":"","name":"BlueIris","tab":"1d003210.ddce5e","order":3,"disp":true,"width":"12","collapse":false},{"id":"1d003210.ddce5e","type":"ui_tab","z":"","name":"ioBroker","icon":"dashboard","disabled":false,"hidden":false}]

```

> **Note** : The inject nodes are configured to be used manually. You can adjust them to request a snapshot in an interval to end up with an video stream on your dashboard. Or connect them to the Alarm Input MQTT Node - so you will receive an image every time the alarm is triggered.

---

<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:** [22 June 2020 10:07 UTC](https://discourse.nodered.org/t/blue-iris-v5-with-instar-mqtt-cameras/28718/2 "2020-06-22T10:07:05Z")

</div>

I am using a line graph to display when an alarm was triggered on my dashboard. Does anyone know if there is already a dashboard template available somewhere that is better suited? Like a timeline with event markers ? Just curious 🙂

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [22 June 2020 11:06 UTC](https://discourse.nodered.org/t/blue-iris-v5-with-instar-mqtt-cameras/28718/3 "2020-06-22T11:06:34Z")

</div>

maybe [https://flows.nodered.org/node/node-red-contrib-ui-state-trail](https://flows.nodered.org/node/node-red-contrib-ui-state-trail)  
certainly I think it now supports clicking on events etc .

---

<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:** [22 June 2020 11:10 UTC](https://discourse.nodered.org/t/blue-iris-v5-with-instar-mqtt-cameras/28718/4 "2020-06-22T11:10:54Z")

</div>

This does look promising. And it is clickable as well? Maybe it is possible to link a snapshot to each event. I will take a look - thank you!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [21 August 2020 10:02 UTC](https://discourse.nodered.org/t/blue-iris-v5-with-instar-mqtt-cameras/28718/5 "2020-08-21T10:02:35Z")

</div>

This topic was automatically closed after 60 days. New replies are no longer allowed.
