Watch the video here https://youtu.be/qG-dnAN8HMY
Camera Integration with Home Assistant was one of the first items I wanted to get working after the first build as I had a number of IP camera’s installed at home each from different manufacturers meaning their own management application which had to be installed to my own and wife’s mobile phones for monitoring, motion sensors etc.
The integration of the IP camera’s was relatively straight forward in the sense of obtaining the RSTP link for each camera together with their respective username and password. This was then added to the configuration.yaml file in Home Assistant together with a description and before you know it we have camera entities available which could be displayed on a central dashboard!
Fast forward a couple days after the camera integration with Home Assistant it quickly became evident that this platform was fine for having a live view of what was going on around the house but when there are motion sensors involved or wanting to get back to record history it pretty much stops you in your tracks and we were left having to reach for the phone to jump on the manufacturer app to manage that.
Enter Blue Iris…
There had to be a way to simplify this process ! and that lead to the introduction of an NVR…
With a bit of sifting through Home Assistant related forums it quickly became apparent that I would have my hands full as there are quite a few options out there. An open source option called MotionEye was one of the first that I tested out and not long after lead to iSpy and so my search continued changing with the goal of finding something that offer ease of use, as it was not only myself making use of the platform but the wife and kids as well.
After a month or so I found a write up on Blue Iris which a lot of community members rated as one of the most preferred for the exact reason I was but the unfortunate part was that it came with a price tag. This is usually a big NO in my books and a deal breaker but after much deliberation and soul searching I opted for the BI solution.
I will be honest up front, the supporting installation documentation from BI was not the best but with a bit of trial and error the installation was relatively straight forward and the integration with Home Assistant not much different from adding the usual IP camera’s as described before to enable you having that live view. I have also spent a lot of time since on motion sensors, alerts etc. and yes my colleagues will most likely never let me live this down but since the installation of BI, I have not looked back!
This Blue Iris instance has been installed on a standard PC which is running Windows 10 and become the NVR.
Adding the Camera is relatively straight forward in Blue Iris.
- Add a new camera from the Blue Iris Dashboard
- Provide descriptive full and short names
- Type, select Network IP
- Options, only select Direct to disc recording (no re-encoding) as this helps with performance.
- Select OK to proceed the next part of the configuration.
Note: The camera should already be added to the network and you should have the RSTP link at this stage.
- Enter the link together with username and password and leave the rest as default before selecting OK.
Note: A live display of the camera on the Blue Iris Dashboard.
Integrate the Blue Iris Camera with Home Assistant
Start by navigating to the configuration.yaml file in Home Assistant. You will require the following lines to get the camera integrated. This needs to be customized to your instance configuration. Once completed save the changes and restart Home Assistant.
#Blue Iris Integrated Cameras
camera:
– platform: mjpeg
mjpeg_url: {http://Blue Iris Server IP: Port}/mjpg/TestCamera
username: !secret BI_username
password: !secret BI_password
name: Milney Demo Camera
Note: The mjpeg_url will be custom to what your BI server and port is and the “TestCamera” to what your camera shortname was configured to.
- Open Developer Tools within Home Assistant, Under States, Current entities
- Find the new camera entity configured and select the More Info
- You should have a live feed of the camera which can now be added to the Home Assistant Dashboard.
Preparing Blue Iris for Facial Recognition
First we need to setup a location for the snapshot files that will be taken and processed for face recognition first.
- Open the BI Dashboard and select your server configuration.
- Select the Clips and archiving tab
- Under folders select a spare Aux folder and specify the snapshot folder that you will be using for facial recognition. Also specify some limitation to the disk usage and file retention.
- On the Web Server Tab and ensure you have your local LAN access set followed by selecting Advanced.
- Set the Authentication is set as follows:
- Open the Users tab
- Create a new User Account which will be used by the Facial Recognition service. Select Privileges/Administrator and Accessible Times/ LAN only:
- Select OK
Note: Next we need to add the camera which will be performing the snapshots, so we have to create a new camera.
- Add new Camera and specify the relevant naming and Network IP as Type.
- Under the Options we need to Enable motion detector and Direct to disc recording before selecting OK.
- Specify the RSTP link under Network IP Camera Configuration followed by User and Password and leaving the rest as defaults.
- Select OK
- Open the Trigger tab.
- Ensure Motion Sensor is selected still and select Configure…
- Make the following config changes to match yours.
- Open the Record tab next and make the following changes.
Note: You will be specifying the Aux folder created earlier so don’t miss this setting.
Deepstack and AI Tool Setup
There are two items that need to be completed as part of the configuration. AI tool that will be processing and forwarding the new images placed by the camera motion sensor in our specified folder to another service called Deepstack which will essentially be processing the images and making sense of the objects.
I won’t be covering the installation and config as there is already a very good article on the process to follow.
https://ipcamtalk.com/threads/tool-tutorial-free-ai-person-detection-for-blue-iris.37330/
Home Assistant Facial Recognition Setup
Assuming you already have the Home Assistant Community Store installed let’s head over there and get the Deepstack Face Custom Integration by @robmarkcole added.
Please check out the link for more configuration information: https://github.com/robmarkcole/HASS-Deepstack-face
- Next, go to configuration.yaml file and add the following text.
#Deepstack Image Processing for AI and Face Recognition
image_processing:
– platform: deepstack_face
ip_address: “Your Deepstack Instance IP”
port: “Your Deepstack Instance Port”
timeout: 10
detect_only: false
save_file_folder: /config/www/“Custom Folder”/
save_timestamped_file: True
save_faces_folder: /config/www/“Custom Folder”/
show_boxes: True
source:
– entity_id: “Your Camera”
name: face_counter
- Restart Home Assistant and check if the new entity is available in Developer Tools.
Note: The State is unknown and no faces detected at this point so the next step will be to perform an image scan to get the service working.
- While remaining in Developer tools select Services followed by specifying Image Processing: scan as your service and target as the entity you looked up in the previous step.
- Make sure you have the camera facing you and select Call Service. It will take a minute to run the scan service which you can confirm running if you head over to the deepstack service.
Deepstack Service Performing Scan
- Open the Status area again and check the result of image: processing which should now represent the status as 1 and attributes reflecting that a face has been detected.