The version 5 of Blue Iris now sports an MQTT interface through which you can use a couple of Admin Commands to take control over the software with Home Assistant.
Connect Blue Iris to your Broker
I am using an MQTT Broker/Camera - 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):
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.
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 Home Assistant
To use this event we created above in Home Assistant we just have to create a Binary Sensor using the MQTT Platform inside the Home Assistant configuration:
binary_sensor:
- platform: mqtt
name: "Black Motion"
state_topic: BlueIris/MotionAlarm/8015black/
payload_on: "1"
payload_off: "0"
device_class: motion
We can now restart Home Assistant and create an Entity in the Lovelace UI that uses our sensor:
We will now be notified in Home Assistant when BlueIris triggers an alarm event and updates the alarm topic for our camera.
We can use this alarm input to switch the camera that triggered the alarm in Blue Iris into Fullscreen Mode. To do this we have to send the message payload camera=black&fullscreen=1
when an alarm was triggered and camera=black&escape
once the alarm event ended to the BlueIris Admin MQTT Topic BlueIris/admin
(see BlueIris Admin Command Topics for more options).
black
in this payloads is the camera short name that I assigned to this camera in Blue Iris - please substitute it with your cameras short name.
This can be done from the Lovelace UI by creating an Automation:
When Home Assistant receives an update with payload 1 for the topic BlueIris/MotionAlarm/8015black/ it will now tell BlueIris to switch the camera with the short name black (you have to adjust this according to your setup) to full screen, wait for 15s and escape back to idle.
This is just one example - there are a lot more BlueIris Admin Command Topics that you can use. And of course you can now also use the alarm event in Blue Iris to trigger other Automation in Home Assistant. There are endless possibilities
Adding Blue Iris Live Video to your Home Assistant Lovelace UI
We can also add the live stream from our cameras. Before I did this directly by using the snapshot path from my cameras. But adding several cameras JPG streams eats up a lot of bandwidth. Blue Iris has a neat little feature that it combines the snapshots from all cameras into a single JPG file.
My Blue Iris installation runs on IP 192.168.2.112
with its webserver on port 8181
. To access the snapshot I can use:
http://192.168.2.112:8181/mjpg/black
http://192.168.2.112:8181/mjpg/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. I can add those MJPEG sources to my camera config:
- platform: mjpeg
name: '192.168.2.117'
mjpeg_url: http://192.168.2.117/mjpegstream.cgi?-chn=11
verify_ssl: false
authentication: 'basic'
username: !secret white117_username
password: !secret white117_password
- platform: mjpeg
mjpeg_url: http://192.168.2.112:8181/mjpg/Index
name: Overview
authentication: basic
username: !secret blueiris_username
password: !secret blueiris_password
- platform: mjpeg
mjpeg_url: http://192.168.2.112:8181/mjpg/black
name: Black
authentication: basic
username: !secret blueiris_username
password: !secret blueiris_password
- platform: mjpeg
mjpeg_url: http://192.168.2.112:8181/mjpg/white
name: White
authentication: basic
username: !secret blueiris_username
password: !secret blueiris_password
- platform: mjpeg
mjpeg_url: http://192.168.2.112:8181/mjpg/in6014
name: IN-6014
authentication: basic
username: !secret blueiris_username
password: !secret blueiris_password
We can now restart Home Assistant and create an Entity in the Lovelace UI that uses those cameras: