Home Assistant: Add Camera Snapshots to Push Notifications
In this post I will share an easy way to add real-time camera snapshots to your Home Assistant push notifications. This is a great way to level up your push notifications, allowing you to actually see what is happening at the instant a notification was pushed.
In this post I will share an easy way to add real-time camera snapshots to your Home Assistant push notifications. This is a great way to level up your push notifications, allowing you to actually see what is happening at the instant a notification was pushed. For example, you can send an image from your garage camera when the cover is opened, or from your wall mounted tablet when the security system is disarmed.
Home Assistant does allow you to send snapshots from a camera entity, but the advantage of my approach is that it reaches directly into the camera to get a snapshot. This eliminates the need to use camera entities, which are often plagued with latency, compression, and bandwidth issues. All you need to make this work is a camera with an HTTP endpoint for pulling the snapshots. I will show some specific examples using my Blue Iris cameras and my Fully Kiosk-enabled tablets, and I will share a reusable flow that you can plug in to your Node-RED config.
HTTP Endpoint
The first step is to figure out the HTTP endpoint to grab a snapshot from your camera. Most IP cameras and NVR systems will provide a way to pull a snapshot, so check with your manufacturer. Test the endpoint by opening it in a browser and ensure you get an image with the current timestamp.
The URL for a BlueIris camera looks something like this:
Note: you have to set up Remote Admin in Fully Kiosk and turn on a setting called "Enable Camshot on Remote Admin"
Example #1: Garage Notifications
The flow below triggers when my garage door starts to open, only when I am away from the house. Next, it calls my Blue Iris HTTP endpoint using the user and password stored by in the credentials node. If the HTTP request succeeds, the image is saved to local storage and sent out as a push notification. If the request fails, an error is logged and the request is sent out with no image. This way, I always get a notification even if the images are not working for some reason.
Below is a screenshot of the result. The notifications are impressively quick, and there is almost no latency between the trigger and the image. I actually use this same approach for my Video Doorbell and the images always line up with the moment that you press the chime button.
And here is the code:
Copy the flow above into your editor
Change the trigger and conditions to suit your needs
Fill out the credentials node with your endpoint, username, password, and so on
Set up your notification in the Notify node
Note: this code depends on the Credentials plugin. Make sure to install this plugin first.
Example #2: Alarm Panel Notifications
Here is another example where I enhanced the push notifications for my home alarm system. The flow is very similar to the previous example, all I had to do was change the settings as outlined in the previous example so that it pulls images from my kiosk tablet.
Conclusion
With this template you can now enhance all of your push notifications to pull images from relevant cameras in your home. You can even extend this concept to push images out to other services, like a file share or a Telegram channel. Real-time images add valuable context to your notifications and make your Home Assistant even more useful. Thanks for reading!