BlueIris Motion Detection with MQTT

I am posting this with the hope that it saves at least one person from hours of Googling. I have had BlueIris NVR for my POE security cameras for a while. Great - but I wanted to add some automations with the motion sensors. I watched many videos and read many things, but could not get the messages to pass from BI to HA.

What the problem was (and if everyone else knows this but me, apologies), is you must configure the Alerts for each camera to do the following: (Thank you ha-blueiris/blueiris-server.md at 9854117f2279805e957ade4bd64ffe68d972254e · elad-bar/ha-blueiris · GitHub for the instructions)

You must configure the action:
“On alert” to be ‘MQTT’ with:

Topic - BlueIris/&CAM/Status
Payload - { "type": "&TYPE", "trigger": "ON" }

“On reset” to be ‘MQTT’ with:

Topic - BlueIris/&CAM/Status
Payload - { "type": "&TYPE", "trigger": "OFF" }

Hope this saves a little searching for someone out there. Thank you to the YouTube videos for getting me most of the way there, and thank you to https://github.com/kramttocs for helping me close the loop

6 Likes

Did you see this?

Super helpful! Is there any way to get more specific. Ex: I’m using Code Project AI detection and I want to trigger when my dog is in view of the camera?

1 Like

Same here.

There are loads of very easy things you can do with HA and BI with MQTT

For example I have a dashboard shoing all my cams last alert and some details

I use the same information for triggering some automations like making an Alexa announcement when someone is on the drive/front door, turning some lights on when we arrive home and it’s dark etc

I’ll start my posting my HA yaml config, you simply repeat the same thing over and over for whatever camera you want, I’ll use my patio cam in examples.

HA configuration.yaml

mqtt:
  #Blue Iris AI Sensors
  sensor:
    - name: "Patio Alert Time"
      state_topic: BlueIris/lastalert/Patio
      value_template: "{{value_json.TIMEISO}}"
      device_class: timestamp
      unique_id: "Bi_Alert_Time_Patio"
      device:
        identifiers: "BlueirisCCTV"
        manufacturer: "Blue Iris"
        name: "BI CCTV"
        model: "BI IP CCTV"

    - name: "Patio Alert AI"
      state_topic: BlueIris/lastalert/Patio
      value_template: "{{value_json.AlertAI}}"
      unique_id: "Bi_Alert_AI_Patio"
      device:
        identifiers: "BlueirisCCTV"
        manufacturer: "Blue Iris"
        name: "BI CCTV"
        model: "BI IP CCTV"


  binary_sensor:
    #Blue Iris motion sensors
    - name: "Patio Cam Motion"
      state_topic: blue_iris/binary_sensor/patio_motion/state
      payload_on: "ON"
      payload_off: "OFF"
      device_class: motion
      unique_id: "blueirispatiocam"


  #Blue Iris Cam Alerts
  camera:
    - name: Patio Alert
      unique_id: camera.patio_alert
      topic: blue_iris/alerts/Patio/alert-image-b64
      image_encoding: b64

My BI MQTT Alert Config (you need to do this for each of cameras On Alert action set)


blue_iris/alerts/&CAM/alert-image-b64
&ALERT_JPEG


blue_iris/binary_sensor/patio_motion/state
ON


BlueIris/lastalert/&CAM
{“Cam”:“&CAM”,“Date”:“%c”,“TIMEISO”:“%T”,“AlertAI”:“&MEMO”}

For the motion state you also need something to turn it back off after the alert has cleared (on Reset) so you also need



blue_iris/binary_sensor/patio_motion/state
OFF

Few examples of HA after config



Node -Red setup for some lights and Alexa using the motion sensors

How it looks in MQTT Explorer