The automation is triggered by someone ringing my doorbell. But that’s entirely separate to getting a working MQTT camera entity in HA that receives images from the BI alert trigger.
That should give you camera entities which show the last triggered image from BI.
Then you set up an automation (completely separate) to snapshot the MQTT camera and send the notification to your phone.
The trigger for that automation is entirely up to you, if you want to trigger it on every BI alert then you’d use a MQTT trigger. In my above examples the MQTT automation trigger would be:
I have been able to get the BI>HA(Node red) setup working for Android with an image with one issue. Upon a single alert from BI I get continuous notifications on my phone. The notify node stays on continually sending out notifications.
Oh, neat! Thanks for showing me! I had obviously only been reading the mini version of that. Well done, mate!
EDIT: Updated, and immediately it’s working perfectly!
sorry i assumed you had it setup to work like the node red configuration which triggers from the MQTT topic and not off the motion events, which was the part i was trying to wrap my head around.
Also took me a bit to figure out you have it running via a script instead of directly in the automation.
Which MQTT topic are you talking about? The trigger can be anything you want.
Also it’s not running in a script, this is a very simple automation. I’m the confused one now
Edit: Sorry yeah I see my doorbell code above is a script and not an automation but just copy and paste the individual actions you want. I just pasted the whole thing so you could see my example which is triggered by the doorbell instead of the motion alert. Triggering on the MQTT topic should be a simpler automation using the trigger in one of my posts above
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
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.
First time playing around with images and automation. Got the native b64 image to camera entity working, but how do you do the automation for the image notification using node-red?
I attempted the node-red route and never got it working correctly. I went @TheHolyRoger route with automation. While not 100% it’s very close. For my version, I simplified the file management and created individual automations for my 4 cameras.
My setup is the latest version of HA, android phone.
@ColfaxUpton Thanks for spotting that error with the three backticks. They were needed to post here in code format, but I needed to move them to the next line of the post so they wouldn’t get included in the Node Red import.
I think the Node Red code in the first post is fixed now and there’s nothing to remove.
@gmow1 I was close but could not get the encoding: b64 method of @TheHolyRoger to work. I kept getting a padding error from the MQTT JSON payload.
But I used some of his methods as well as @ronaldjeremy to finally get it to work on Android with success. I get the notification in the companion app. It saves to the www folder and I can click the notification image to actually view the clip.
This looks good, thanks for sharing your script. Currently, I am using automation(Not Node-Red) for my notifications. My automation overwrites the image file every new alert. I’ve created individual automation for each camera.
Yeah, I ditched the Node Red version too. Every now and then, I do not get an image; about every 1 out of 10. But I do get the db marker where I can watch the alert.
Sometimes, even with the Blue Iris Push notification, I don’t get an alert at all either, so it may be a timing issue.