Blue Iris motion alerts to notification with image in Home Assistant

I have updated my config to take advantage of the base64 handling that @TheHolyRoger added to Home Assistant. NodeRed is no longer required to do the base64 image decoding.

One thing that initially tripped me up as I’m making changes is the MQTT camera configuration format has changed. See the “Configuration” section of MQTT Camera

I changed my configuration from this:

camera:
  - platform: mqtt
  name: Patio Alert
  unique_id: camera.patio_alert
  topic: BI/patio/alert-image

To this:

mqtt:
  camera:
    - topic: BI/patio/alert-image-b64
      name: Patio Alert
      unique_id: camera.patio_alert
      encoding: b64

Notice that I changed the topic name from BI/patio/alert-image to BI/patio/alert-image-b64, because that’s the topic name I’ve used in my BlueIris config to send the base64 encoded image.

Here’s how I added a notification with an image to automations.yaml. This version is hardcoded for one camera to make it easy to understand.

- id: 'some-unique-id'
  alias: Blue Iris camera alert
  trigger:
  - platform: mqtt
    topic: BI/patio/alert-image-b64
  condition: []
  action:
  - service: notify.mobile_app_iphone
    data:
      message: Person detected on Patio
      data:
        entity_id: camera.patio_alert
  mode: queued

And this is how to make it work for any camera without hardcoding the name.

- id: 'some-unique-id'
  alias: Blue Iris camera alert
  trigger:
  - platform: mqtt
    topic: BI/+/alert-image-b64
    variables:
      camera_name: "{{ trigger.topic.split('/')[1] }}"
  condition: []
  action:
  - service: notify.mobile_app_iphone
    data:
      message: "Person detected: {{ camera_name }}"
      data:
        entity_id: camera.{{ camera_name }}_alert
  mode: queued

And now this works without NodeRed! Thanks so much @TheHolyRoger!

7 Likes