Blue Iris motion alerts to notification with image in Home Assistant

This is the only similar case I can find and unfortunately he has no replies: https://blueirissoftware.com/forum/viewtopic.php?t=2392

My guess is that maybe it adds NO RECORD on the front if recording is disabled?

Or maybe it’s a problem with the database? Could try rebuilding

It’s definitely a problem in blue iris, I’d suggest watching the mqtt explorer and changing settings until you stop seeing NO RECORD at the front of the base64 data

1 Like

Despite my efforts, I still receive “NO RECORD”.
Is it possible that my Blue Iris is an old version 5.5.0.15 that is causing the problem?

Could be, that’s definitely older than I’m using

1 Like

This! This is an awesome solution. No camera entities, one automation for all notifications. Brilliant.

Just a couple of things to note for anyone else setting this up.
The first two “BI_IP” entries are your internal BI IP addresses. Set up your BI instance to not require authentication from inside the LAN. The next two IP address are your external BI IP address (or Tailscale IP which I highly recommend as you dont have to expose your BI server to the internet…). These need to be external so when you click on the view clip or view live button it will work no matter where you are.

priority: high
          clickAction: "http://<**BI_INTERNAL_IP**>:81/ui3.htm?maximize=1&tab=alerts&cam={{ trigger.payload_json.camera }}&rec={{ trigger.payload_json.id }}"
          image: "http://<**BI_INTERNAL_IP**>:81/alerts/{{ trigger.payload_json.id }}<s>&fulljpeg</s>"
          actions:
            - action: "URI"
              title: "Live View"
              uri: http://<BI_EXTERNAL_IP>:81/ui3.htm?maximize=1&cam={{ trigger.payload_json.camera }}
            - action: "URI"
              title: "View Clip"
              uri: http://<BI_EXTERNAL_IP>:81/ui3.htm?maximize=1&tab=alerts&cam={{ trigger.payload_json.camera }}&rec={{ trigger.payload_json.id }}

Lastly, I had to remove the “&fulljpeg” from the image uri to get the image in the notification to work for me.

Cheers!

4 Likes

Thank you so much for your help!!!

It’s finally working!!!

Would it be possible to display the last alerts that were received in the Lovelace card?

What was the fix in the end?

Please note, in the Dec 2022 releases of Home Assistant, the definition for the MQTT Camera with Base64 image data has changed somewhat. I was unable to successfully use your June 2022 configuration. Here’s my Jan 2023 definition. Note the encoding keyword is now image_encoding.

This is the result of other changes documented here:

mqtt:
  camera:
  - unique_id: living_room_alert
    topic:     BlueIris/LivingRoom/Image
    name:    "Alert LivingRoom"
    image_encoding:  b64
1 Like

Thanks for this. It’s perfect!

So, I have notifications from the Blue Iris app on my iPhone working. :slight_smile: They display the JPEG image with the message. But clicking on the notification always opens the Home Assistant app. Not really certain why it’s not respecting the click action provided:
Apparently, it’s because I did not include the url: value, as well. :confounded:
Now, if we can just get iPhone to trust LetsEncrypt certificates. :stuck_out_tongue_winking_eye:

service: notify.mobile_app_freds_iphone
data:
  message: Activity in {{ cam_name }} at {{ img_time }}
  data:
    image: /local/{{ cam_name }}.jpg
    ttl: 0
    priority: high
    clickAction: >-
      https://myhost.duckdns.org:12345/ui3.htm?maximize=1&tab=alerts&cam={{
      cam_name }}&rec={{ bi_dbid }}
1 Like

Has anyone got it working to send the alert video at all?

Legend this worked perfectly

Yes. You should approach this as a multi-step process, verifying each step:
a) MQTT broker up and running in Home Assistant
b) MQTT Explorer diagnostic monitoring tool on your PC
c) MQTT event messages defined in Blue Iris alerts
d) Blue Iris MQTT alert messages arriving in HA’s MQTT broker (verify using MQTT Explorer)
e) MQTT cameras defined in Home Assistant
f) Automation defined in Home Assistant
g) trace automation processing in Home Assistant

Hope this helps.

Yeah but I’m not sure what code to put in blue iris to send the video. Note video not the image as I’ve got that working

Blue Iris Alert actions:

MQTT topic:    BlueIris/&CAM/JSON
Payload:       { "camera":"&CAM", "time":"%Y%m%d_%H%M%S", "dbid":"&ALERT_DB", "clipid":"&ALERT_CLIP", "memo":"&MEMO" }

Home Assistant automation:

- id: '1672586866679'
  alias: Alert JSON Received
  description: Activity detected by Blue Iris camera motion detection
  trigger:
  - platform: mqtt
    topic: BlueIris/+/JSON
  condition: []
  action:
  - service: camera.snapshot
    target:
      entity_id: camera.alert_{{ cam_name }}
    data:
      filename: /config/www/{{ cam_name }}.jpg
  - service: notify.mobile_app_freds_iphone
    data:
      title: Blue Iris activity alert
      message: Activity in {{ cam_name }} at {{ img_time }}
      data:
        image: /local/{{ cam_name }}.jpg
        url: https://myurl.duckdns.org:12435/ui3.htm?maximize=1&tab=alerts&cam={{
          cam_name }}&rec={{ bi_clip }}&timeout=0
        clickAction: https://myurl.duckdns.org:12345/ui3.htm?maximize=1&tab=alerts&cam={{
          cam_name }}&rec={{ bi_clip }}&timeout=0
  mode: queued
  variables:
    cam_name: "{{ trigger.payload_json.camera  }}"
    img_time: "{{ trigger.payload_json.time    }}"
    bi_dbid: "{{  trigger.payload_json.dbid    }}"
    bi_clip: "{{  trigger.payload_json.clipid  }}"
    ai_memo: "{{  trigger.payload_json.memo    }}"

You would need to update the phone/remote device name and the https:// URL and port number for your specific definitions.

What I’m trying to get it tondo is to send the actual video file like this does with the photo.
So HA can then show the video in the notification

I started to have some issues with my previous alert setup and wanted to give this option a try as it looks to be much more secure than what I had previously.

I got BlueIris setup and verified with MQTT explorer but seem to be getting tripped up with a basic step defining the MQTT camera entities in my configurations.yaml file. I reviewed the documentation here: MQTT Camera - Home Assistant and saw the update made in December (Fix MQTT camera encoding by jbouwh · Pull Request #76124 · home-assistant/core · GitHub) but for some reason I am getting a “Property image_encoding is not allowed.” warning from the helper.

Does anyone have a suggestion of something I can look closer at?

I saw this post (Blue Iris motion alerts to notification with image in Home Assistant - #123 by suddenly-sarcastic) above and wondered if it has something to do with the Studio Code Server tool. @suddenly-sarcastic did you ever get yours to work?

image

Good Job! :slight_smile:

Regarding the iPhone and trusting LetsEncrypt certificates:
It was an stunnel configuration issue. I was previously using just the certificate file, when what I should have been using was the “full chain” file that includes all the certificates in the chain of trust. With this change, iPhone now fully trusts the LetsEncrypt certificate(s) served by stunnel on the Blue Iris system.

I’ve setup before, but using DeepStack, now I’ve switched to CodePorject AI as new AI detect method. I’ve followed the thread and mqtt able to receive the information, but picture is broken. Wondering if there different variable for payload on MQTT if I’m not using DeepStack as AI server?

update: fixed by
using image_encoding: b64 instead of encoding: b64

I have struggled for about three weeks with this.

STUDIO CODE SERVER is the problem!!!

I used the Terminal & SSH add-on to add the image_encoding part and it worked flawlessly.

I don’t know if you can make all your edits in Studio Code Server and it still work with the “Property image_encoding is not aloud” message still being displayed.

I plan on trying it today. I’ll let you know.

-Update

Even though Studio Code does not like the property “image_encoding” it will work!!!

I recommend running a configuration check in the Developer Menu before restarting.

I hope this helps.

1 Like