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.
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.
camera:
# 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}]