BlueIris v5 with Node-RED

MQTT Alarmserver

We already configured our cameras in BlueIris to send an MQTT update once the software triggers an alarm. To use this event in Node-RED we just have to drag and drop in an MQTT In-Node and define the Topic it should subscribe to. In my case this was BlueIris/MotionAlarm/8015black/:

Blue Iris for your INSTAR IP Camera

We will now be notified in Node-RED when BlueIris triggers an alarm event - we receive the payload 1 once an event was triggered and this alarm state falls back to 0 a few seconds later:

Blue Iris for your INSTAR IP Camera

We can visualize alarm events inside the Node-RED dashboard by using a dashboard line chart Node and connecting it to the MQTT Input Node:

Blue Iris for your INSTAR IP Camera

Switching to the Dashboard will now show you how many times the alarm was triggered lately:

Blue Iris for your INSTAR IP Camera

Controlling BlueIris with MQTT

Now to something more useful - we can use the input to switch the camera that caused the alarm into Fullscreen Mode. To do this I will switch the message payload to camera=black&fullscreen=1 when an alarm was triggered and camera=black&escape once the alarm event ended - see BlueIris Admin Command Topics for more options.

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

Blue Iris for your INSTAR IP Camera

The BlueIris UI will now always set my camera into FullScreen mode when it triggered an alarm.

JSON Flow Export

[{"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}]

This is just one of many examples. We can use all the BlueIris Admin Command Topics inside Node-RED to take control over BlueIris functions - like triggering an alarm, start and stop manual recordings or de/activating the motion detection for cameras:

Blue Iris for your INSTAR IP Camera

black in those payloads is the camera short name that I assigned to this camera in BlueIris - please substitute it with your cameras short name.

[{"id":"add74b98.9db1f8","type":"mqtt out","z":"d214d2a3.60f88","name":"BlueIris Admin","topic":"BlueIris/admin","qos":"1","retain":"false","broker":"59e4c061.7fa47","x":380,"y":560,"wires":[]},{"id":"f97d96f.79e1b68","type":"inject","z":"d214d2a3.60f88","name":"IN-8015(black) Alarm","topic":"","payload":"camera=black&trigger","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":460,"wires":[["add74b98.9db1f8"]]},{"id":"14f1a45.cfe115c","type":"inject","z":"d214d2a3.60f88","name":"IN-8015(white) Alarm","topic":"","payload":"camera=white&trigger","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":500,"wires":[["add74b98.9db1f8"]]},{"id":"ae513885.f9bcc8","type":"inject","z":"d214d2a3.60f88","name":"IN-8015(black) REC","topic":"","payload":"camera=black&manrec=1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":540,"wires":[["add74b98.9db1f8"]]},{"id":"2de11ac2.95f966","type":"inject","z":"d214d2a3.60f88","name":"IN-8015(black) STOP","topic":"","payload":"camera=black&manrec=0","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":580,"wires":[["add74b98.9db1f8"]]},{"id":"b682ac42.a7c9d","type":"inject","z":"d214d2a3.60f88","name":"IN-8015(black) MD ON","topic":"","payload":"camera=black&motion=1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":620,"wires":[["add74b98.9db1f8"]]},{"id":"46b0fa99.b16804","type":"inject","z":"d214d2a3.60f88","name":"IN-8015(black) MD OFF","topic":"","payload":"camera=black&motion=0","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":660,"wires":[["add74b98.9db1f8"]]},{"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":""}]

Adding the Live Video to your Node-RED Dashboard

To add our BlueIris JPEG video source to the Node-RED Dashboard we need to use an HTTP Request Node:

Blue Iris for your INSTAR IP Camera

This node handles the authentication we set up in Blue Iris and grabs a snapshot from our camera:

Blue Iris for your INSTAR IP Camera

The BlueIris JPEG video source is available from the IP address and port of our BlueIris server, e.g. 192.168.2.112:8181, followed by /image/camerashortname or /image/Index for the camera overview:

http://192.168.2.112:8181/image/black

http://192.168.2.112:8181/image/Index

black in those payloads is the camera short name that I assigned to this camera in BlueIris - please substitute it with your cameras short name.

I am passing the image into node-red-node-base64 node so that I can use the following image tag to display the image on my dashboard:

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

Note that 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.

Blue Iris for your INSTAR IP Camera

[{"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}]
INSTAR Forum

Discuss this article on the INSTAR Forum !