Blue Iris motion alerts to notification with image in Home Assistant

What version of BI are you using? Sounds like it sends the image unencoded if you’ve got a padding error and it works fine without

The latest version. 5. Something.

Any way to make it so when you actually click the notification it opens the correct clip? Presumably utilising something like here?

Not sure what you mean about clicking the notifications? I haven’t got any links set up in my notifications, it just sticks the image in there.

If you mean your notifications all show the same image then you need to do what I’ve shared above which is to take snapshots with the date/time in the filename, that way each notification shows up separately

Strange! Not sure why you’re able to send the image unencoded but glad it works

This is what I do. When my camera detects motion, it creates a camera snapshot and passes it to HA via a MQTT topic with a MQTT payload that includes camera name, time, and db pointer for the clip.

MQTT Topic:
BI/porch/alert-image-b64

MQTT Payload:
{“db”:"&ALERT_DB",“cam”:"&NAME",“time”:"%X"}

When I click the snapshot notification, it plays the actual clip.

Here is my rule:

alias: 'Blue Iris: Front Porch Notification'
description: ''
trigger:
  - platform: mqtt
    topic: BI/porch/alert-image-b64
condition: []
action:
  - service: camera.snapshot
    data:
      filename: /config/www/{{ file_time }}_frontporch_ha.jpg
    target:
      entity_id: camera.front_door_cam_sub
  - service: notify.mobile_app_scott_s_s21
    data:
      message: >-
        A person was detected on the {{trigger.payload_json.cam}} camera at
        {{trigger.payload_json.time}}.
      title: Person Detected on Front Porch
      data:
        ttl: 0
        priority: high
        clickAction: >-
          http://your_ip_address:81/ui3.htm?maximize=1&tab=alerts&cam={{trigger.payload_json.cam}}
          &rec={{trigger.payload_json.db}}
        image: /local/{{ file_time }}_frontporch_ha.jpg
variables:
  file_time: '{{ now().strftime(''%Y%m%d_%H%M%S'') }}'
mode: queued

I have this in my configuration.yaml file:

mqtt:
  camera:
    - topic: BI/porch/alert-image-b64
      name: Porch Alert
      unique_id: camera.porch_alert

Works like a champ!

Hope this helps.

Scott

5 Likes

Exactly what I was after thank you in terms of what i’m wanting to achieve.

I’m missing a few steps I think though. I have the camera sending mqtt alerts no worries, I have set up the ‘alert’ mqtt camera. But presumably right now it’s toppling over with the actual automation part.

For example this:

So am I right in thinking this part is generating the .jpg file from the camera.snapshot service and naming it accordingly within the /config/www/ folder? And then that same filename is referenced later in the data section to display in the alert?

I also get this error in file editor:
end of the stream or a document separator is expected at line 27, column 1:
variables:
^
(that line is the line ‘variables:’)

Yeah think i’ve become a bit lost. So your version doesn’t rely on BlueIris sending the jpg through mqtt like when using the Step 2/3 in the original post? Because there’s no @ALERT_JPEG in the payload of yours? If that doesn’t happen, do you even need the MQTT camera?

Would greatly appreciate a little expansion on this, i’m sure it’s super obvious but feel like i’m missing something…

I never could get HA to accept the BI picture with the @ALERT_JPEG. With our without the b64 encoding. I always got an error. So I scrapped that and used the camera snapshot service to generate the image to show in the alert.

I still think you need the MQTT camera entity as it uses the camera alias to make it work. If I recall, it would not work. I messed with so much stuff to get it to work, I honestly can’t remember.

Not sure what is causing that. It kind of looks like the formatting added too many single quotes, but it looks like that is what is my rule…

When I first implemented the rule, I did not use the variables. It had the same filename that kept overwriting itself each alert. I did this to ensure that it was working correctly. Now, I use the shell script from a post above to delete all snapshots that are older than a day.

Try using the static filename first and take out the variables tag. Get it working and then add it back.

Did you set an availability_topic by any chance? I just realized you can’t have an availiability topic for an mqtt camera with encoding: b64 because when it receives mesages for the availability topic it tries to pass b64 to paho mqtt as the encoding and that fails. Removing availability gets rid of the error. Just created an issue about it here:

I want to give a HUGE thank you to those who figured this out! I spent more time than I care to admit trying to figure out a way to get notifications from BlueIris to HASS. Thanks to this thread I was able to streamline my setup. I wrote a blog post on this, hope folks find it useful: Revisiting BlueIris, Deepstack and Homeassistant

5 Likes

Thanks for making that blog post. I thought it was well written, and will definitely help others get this working in their setup.

this does not work
Blueiris asks for login if i click the action.
How did you setup blueiris webserver?

Yeah, it asks for the login, but my phone saves the login info. When I click sign-in, I see the clip. I don’t get the sign in prompt all the time.

I will double check my BI settings. I don’t think I have anything special going on.

Question for anyone, and I apologize if this has already been answered somewhere in the thread. I had a quick scroll through and never saw anything

Does this work over the local network with no internet connection? Currently I have notifications through Pushbullet which works fine, but of course if the internet goes down, no more alerts

I’m looking to get push notifications with no internet

Additional question, has anyone gotten this to work while being passed though into HomeKit? I suspect in that case, push notifications would function

Okay solved it with whitelist IP of my iphone with “^192.168.178.5” in example

1 Like

First question yes it works without internet. Even using home assistant cloud the images are proxied through hass

Thanks for the blog post it was really helpful! My MQTT explorer is detecting payloads for all my human/vehicle detections correctly from BI. I made it 99% of the way through without an issue. So close. When I set up the MQTT camera in configuration.yaml I get an error after encoding: b64 - “Property encoding is not allowed”. I can add the mqtt camera as a picture entity fine but it just shows a broken link.

1 Like

@S1NK What version of Home Assistant are you running? If you don’t have the version that includes @TheHolyRoger’s change to add base64 encoding support, then I could see how you might get that error.