Thank you!
If you’re on HAOS these steps will work until the patch is released:
Download this file https://raw.githubusercontent.com/home-assistant/core/0fcdca2d71578b257df2938cf350e9b07c17a176/homeassistant/components/mqtt/camera.py and save in your /config directory as mqtt_cam_fix.py
Then run this command in the SSH addon in “unprotected” mode:
docker cp /config/mqtt_cam_fix.py homeassistant:/usr/src/homeassistant/homeassistant/components/mqtt/camera.py
Restart hass, done
@TheHolyRoger, since this stuff is still new with me, I have done your patch. If I don’t have to use Node Red, do I now create an automation and look for that MQTT topic and then do something with it?
For some reason, I still can’t wrap my head around it. I guess I am confused as to why your patch works and the other stuff did not???
You just set up your alerts & cameras as in this post, here’s an example yaml entry:
you just add inside the
cameras:
- ...
entry of your configuration.yaml
I have all of that I believe. I am getting the MQTT topics according to MQTT Explorer. I guess where the disconnect is, how does it connect to my phone to show the picture?
You just take a snapshot of the camera to send it to your phone. If you add the camera entity to your dashboard you’ll see the last received image there. Here is my doorbell automation though, triggered when someone rings the doorbell and sends camera snapshot notification to my phone.
alias: Doorbell Notifications
variables:
MSG: Someone's at the door
sequence:
- variables:
file_time: '{{ now().strftime(''%Y%m%d_%H%M%S'') }}'
# Take a snapshot of the camera and save to public http folder
- service: camera.snapshot
data:
filename: /config/www/{{ file_time }}_amcam1_ha.JPG
target:
entity_id: camera.alerts_amcam1
# Notify the phone app for mobile notifications
- service: notify.mobile_app_phone1
data:
message: '{{ MSG }}'
title: Doorbell
data:
channel: doorbell
importance: max
tag: persistent
persistent: true
image: /local/{{ file_time }}_amcam1_ha.JPG
# Notify HA for persistent notifications inside hass
- service: notify.persistent_notification
data:
message: '![image](/local/{{ file_time }}_ac1db_ha.JPG)'
title: Doorbell
I have a separate automation to delete old images, but you can also change the filename and re-use the same file if you’re only bothered about the latest image
Got it working with Android notifications however I get repetitive notifications. I don’t understand. My MQTT in node keeps cycling between disconnected to connecting to connected to disconnected…
Any ideas where to look?
I’ve not seen that… have you set anything up twice maybe? Which MQTT broker are you using? I’m using the HAOS mosquitto addon here
Using the same mosquitto addon. Really breaking my system with all the tweak attempts etc. Could it be a QOS setting? I looked at the Mosquitto broker log and get repetitive
New Client connected to XXX.XXX.X.XXX
New Connection from XXX.XXX.X.XXX
Client bi_alerts already connected, closing old connection
If it’s only BI having the problem then maybe an issue with BI itself? I’m on v5.5.6.21 x64 and only have critical updates for auto-install
Have you tried turning retain off/on for the MQTT messages to see how that affects it?
Maybe a version issue(5.5.4.1 x64 but I find that odd. Prior to discovering this image option I had all my alerts functioning correctly with MQTT. Its just the images?
I’ll keep playing with the MQTT node as I think it’s that setting.
You’re using an older version than me so I’d suggest updating to mine or newer, there might be MQTT bug fixes
just got through this setup and I’m getting notifications on my iPhone however no dice on the picture.
Instead I get an error message below, didn’t see this as something mentioned in the thread, any direction at what to look?
I can see the image in the viewer in node red (11.1.2). Running HAOS 8.1 with current core (2022.6.0) with mosquitto 6.1.2.
I’m not sure about the nodered setup but if you upgrade to the latest HA version you can use the simpler config above (without nodered)
honestly I cant really figure out your configuration, especially the notification portion, can you post the full notification automation instead of the just a portion? how do you trigger it?
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.
You want to create a create BI alerts and MQTT camera entities as in this post: Blue Iris motion alerts to notification with image in Home Assistant - #48 by TheHolyRoger
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:
platform: mqtt
topic: BI/alerts/amcam1
Hope that makes sense
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.
Any suggestions?
@TheHolyRoger were you able to confirm that your code was added to release 2022.6. If so, excellent news!
Yes sir it’s in the full changelog: Full Changelog for Home Assistant Core 2022.6 - Home Assistant
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!