Blue Iris motion alerts to notification with image in Home Assistant

June 2022 Update: This now works without NodeRed. See this message.

Here’s how to get motion alerts from Blue Iris to show up as notifications with the alert image in Home Assistant like this.

The orange outline is Deep Stack detecting a person with 77% confidence.

Edit: The notification image only works on iOS. See the response below from ronaldjeremy for what he did to make this work on Android.

Step 1: Get Motion Alerts from Blue Iris
Follow the steps from this video to install the Blue Iris HACS component. That will connect to the binary sensors from the Blue Iris HACS component (with entity names like binary_sensor.blueiris_patio_motion). That’s pretty cool by itself because you can take actions when those sensors are active.

Step 2: Blue Iris sends alert image via MQTT
To get the alert image to show up, you need to have Blue Iris send an MQTT message to Home Assistant with the image. Similar to the steps in the above video to send a MQTT message when there’s motion detect, create a new “On alert” event for each camera in Blue Iris.

  • MQTT Topic: BI/&CAM/alert-image-b64
  • Payload: &ALERT_JPEG

Note: I deliberately used a name other than BlueIris for the topic because I didn’t want to interfere with any MQTT messages being used by the Blue Iris HACS component. I used BI.

The &ALERT_JPEG is a Blue Iris macro that sends a base64-encoded image of what triggered the motion alert over MQTT.

Step 3: Create MQTT cameras to hold the alert images
Use the built-in MQTT Camera feature to add a camera for the alert images from each camera.

Add something like this to configuration.yaml for each of your Blue Iris cameras.

  # Alert images from Blue Iris
  - platform: mqtt
  name: Patio Alert
  unique_id: camera.patio_alert
  topic: BI/patio/alert-image

Step 4: Decode image and notify using Node Red

I used Node Red with the node-red-contrib-image-tools to decode the base64 image into a JPEG image. Then Node Red sends the JPEG image out via MQTT to BI/&CAM/alert-image (note this topic name doesn’t end in -b64). Node Red also notifies my phone with an alert image. If you look at that node it’s referring to an entity called camera.(name)_alert. This is a MQTT camera we created in Step 3.

[{"id":"8bc1f507afbd14ad","type":"mqtt in","z":"0dfc73c7ae2d0736","name":"BI/+/alert-image-b64","topic":"BI/+/alert-image-b64","qos":"2","datatype":"utf8","broker":"f2d4bba523eb0568","nl":false,"rap":true,"rh":0,"inputs":0,"x":120,"y":2560,"wires":[["e18be4a4f12d2756","c7447b2abfd053a2"]]},{"id":"e18be4a4f12d2756","type":"image viewer","z":"0dfc73c7ae2d0736","name":"","width":160,"data":"payload","dataType":"msg","active":true,"x":330,"y":2600,"wires":[[]]},{"id":"c7447b2abfd053a2","type":"jimp-image","z":"0dfc73c7ae2d0736","name":"Image to buffer","data":"payload","dataType":"msg","ret":"buf","parameter1":"{\"name\":\"clone\",\"parameters\":[]}","parameter1Type":"json","parameter2":"","parameter2Type":"num","parameter3":"0","parameter3Type":"num","parameter4":"RESIZE_NEAREST_NEIGHBOR","parameter4Type":"none","parameter5":"","parameter5Type":"none","parameter6":"","parameter6Type":"none","parameter7":"","parameter7Type":"none","parameter8":"","parameter8Type":"","sendProperty":"payload","parameterCount":0,"jimpFunction":"none","selectedJimpFunction":{"name":"none","fn":"none","description":"Just loads the image.","parameters":[]},"x":360,"y":2560,"wires":[["4eddeb76d5472826"]],"icon":"font-awesome/fa-image"},{"id":"1acc1d0933c062e0","type":"mqtt out","z":"0dfc73c7ae2d0736","name":"BI/+/alert-image","topic":"","qos":"1","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"f2d4bba523eb0568","x":780,"y":2560,"wires":[]},{"id":"4eddeb76d5472826","type":"change","z":"0dfc73c7ae2d0736","name":"Change topic (-b64)","rules":[{"t":"change","p":"topic","pt":"msg","from":"/alert-image-b64","fromt":"str","to":"/alert-image","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":2560,"wires":[["1acc1d0933c062e0","0975bbae61bb30fe"]]},{"id":"0975bbae61bb30fe","type":"api-call-service","z":"0dfc73c7ae2d0736","name":"Notify w/ Image","server":"f11c46a6.207018","version":3,"debugenabled":false,"service_domain":"notify","service":"mobile_app_iphone","entityId":"","data":"{\t   \"message\": \"Camera alert: \" & $split(topic,'/',3)[1],\t   \"data\":\t       {\t       \"entity_id\": \"camera.\" & $split(topic,'/',3)[1] & \"_alert\"\t   }\t}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":760,"y":2620,"wires":[[]]},{"id":"f2d4bba523eb0568","type":"mqtt-broker","name":"HASS MQTT","broker":"localhost","port":"1883","clientid":"NodeRed","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""},{"id":"f11c46a6.207018","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]

Is there any way to do this without using Node Red (step 4)?

1 Like

I’m sure it’s possible do to this without Node Red, but I don’t know how. Maybe someone else can post a way to do that.

You’d need code to decode the base64 JPEG image received from BI/+/alert-image-b64 and send the JPEG image out as an MQTT message to BI/(CameraName)/alert-image

1 Like

I have to say this is awesome and exactly what I was looking for! I got it working except for the part of the image being part of the notification. My notifications come in, but the jpeg isn’t part of the notification itself. I have to tap the notification which redirects me to the card on the HA dashboard.

Are you saying you get the image as part of the notification? My understanding is to make that work you need an “image: /path/to/image” line in the “data”?

Glad this was useful to you. I struggled to make this work, so I’m happy to share what I figured out.

I do have the image in the notification. I think the key to making it work is creating the MQTT Cameras in Step 3 of my instructions. The image is sent to the MQTT Camera from Node Red through the top-right node (the purple one that says “BI/+/alert-image”). This isn’t a real camera, but one that you manually created in step 3.

When the notification arrives, the data says that the image is on that MQTT camera and Home Assistant is able to get the image in that way.

I’m using iOS and it looks like things may behave differently on Android. See the documentation on Automatic Snapshots. I’m using the method that’s linked from that page where it says “iOS users can use the camera stream in dynamic attachments

If you’re on iOS, what I posted should work. If you’re on Android, hopefully the links above can point you in the right direction. Please update this thread if you get this working on Android.

Dude thank you so much. From your suggestions I was able to get it to work in Android. What I did was remove the “entity_id” line you had, and replaced it with:

"image": "/api/camera_proxy/camera." & $split(topic,'/',3)[1] & "_alert"

And now the image appears as part of the notification! Now I am going to try to figure out a way to tap on it and have it load something that lets you pinch to zoom the image. The notification image isn’t pinch zoomable, nor is the camera card in the companion app.

1 Like

Is it possible to make this work without having the blue iris integration? I tried all of the steps except step one, but I am not getting an image pushed through to the MQTT camera. I can see the image in the previewer, but it doesn’t make it all the way through to my phone.

I made a card on my dashboard with the “camera” entity that is created when I add:

  # Alert images from Blue Iris
  - platform: mqtt
  name: Patio Alert
  unique_id: camera.patio_alert
  topic: BI/patio/alert-image

(with all of my info filled in)

but for whatever reason I am not getting images into home assistant.

I have my cameras on a separate vlan that is off the internet and i would like to keep it that way, hence why I am not using the BI integration.

Any help would be greatly appreciated.

None of my cameras touch the internet, nor do I use the BI integration (which the author has explicitly stated he is no longer supporting). This is all via simple local MQTT (BI MQTT on lan → HA MQTT on lan).

hmm… I wonder where the breakdown is. any tips on troubleshooting?

Really step 1 is completely irrelevant to getting the MQTT message and jpeg from BI, you can ignore it.

I forget exactly what I did, but I had to jump through some hoops to get the node-red-contrib-image-tools installed, did you do complete that successfully? Also make sure the “Server” in both of the BI/+/alert* nodes are pointing to the working MQTT server on your machine. My HA install is in proxmox. In the terminal component I did a “tail -f /root/config/home-assistant.log” and the log was helpful figuring things out. Good luck!

contrib tools installed. i am seeing my images on the previewer, but the notification on my phone does not have any image. There is a very small image that says something along the lines of “cannot load attachment” I cannot really make it out though.

So I am not positive if it is relevant, but as far as phone notification images in the HA app go you may need to have the whole DuckDNS thing going. That is, have the app configured to be using a publicly accessible DuckDNS subdomain that is your HA instance. Otherwise the notifications won’t be able to pull an image link. I had DuckDNS configured from the start so it might have “just worked”.

I am using NabuCasa configured, I am fully getting the actual notification, just the image portion isn’t working… super strange. Hopefully the op can shed some more insight.

Android or Apple? If Android, OP’s code won’t work (but OP still rocks, I thank him/her again). See my previous post for getting it to work in Android.

I am using iOS. Pulling my hair out. There is definitely something wrong with the MQTT side of things inside of home assistant.

So I did some more digging and it looks like the MQTT node is not publishing any payloads which are in “buffer” format. If I change this to string, number, etc - everything publishes as normal. It looks like there is something preventing buffers from being published through node red, or home assistant. The search continues…

The BI/+/alert-image-b64 node should have “a String” for “Output”.

I am talking about the image to buffer node

Progress, I am now getting notifications to my phone with an image, however the image is extremely small, maybe 1cm x 1cm. last piece of the puzzle to come

That’s correct. You should get that if you import the Node Red code I posted in the first message.