Here is a quick post on integrating camera's with Home Assistant, this includes
- Pi Camera connected to Raspberry Pi 3 as part of the Hub
- Security camera that we create using a Raspberry Pi Zero, PI NOIR camera and installing Motion with Single File PHP Gallery in a previous blog post - Pi Control Hub: Spoke 1 :Security Camera
Basically, as part of Home Assistant dashboard we are going to add two sections showing the preview of Pi Cameras as shown in the pictures below
{gallery} Integrating Camera's in Home Assistant |
---|
Home Assistant dashboard with Pi Cameras preview. |
Security Camera setup with Pi Zero + NOIR camera, in a 3D printed case. |
Pi camera connected to the Raspberry Pi 3 |
Security camera feed in a separate tab |
Picture gallery of the intruders detected , using Single File PHP Gallery |
Having a close look into the picture from the Picture gallery |
Here are the steps to follow to integrate the Pi cameras with Home-Assistant
#1 Connect the Pi camera to Raspberry Pi 3 and run the following commands to create a directory called picamera
pi@hub:~ $ cd /home/hass
pi@hub:~ $sudo mkdir picamera
pi@hub:/home/hass $ ls
picamera
pi@hub:/home/hass $ sudo chown hass picamera
and then create a image file
pi@hub:/home/hass/picamera $ touch image.jpg
#2 Update the configuration.yaml file
camera: platform: rpi_camera name: Raspberry Pi Camera image_width: 640 image_height: 480 image_quality: 7 image_rotation: 0 timelapse: 1000 horizontal_flip: 0 vertical_flip: 0 file_path: /home/hass/picamera/image.jpg
and then stop and start Home-Assistant and test
sudo systemctl stop home-assistant@hass
sudo systemctl start home-assistant@hass
#3 Adding the Security camera to the dashboard
modify the configuration.yaml to include the following under the camera section
- platform: mjpeg mjpeg_url: http://192.168.0.21:8081 name: Security Camera
change the ip address above with the security camera Pi's ip address
#4 To add Security camera Preview tab and the Intruder detection tab which show the picture gallery
Add the following under the panel_iframe section of the configuration.yaml file
intruder: title: 'Intruder detection' icon: 'mdi:nature-people' url: 'http://192.168.0.21/' securitycam: title: 'Security Cam' icon: 'mdi:camera' url: 'http://192.168.0.21:8081/'
change the ip address above with the security camera Pi's ip address
Top Comments