Sometimes on Reddit I’ll see someone ask how people have their Home Assistant security camera setup. There are a lot of different options. I went with Amcrest cameras because those by themselves integrate with HA, I also setup a ZoneMinder server as well. I’m not going to go into my ZoneMinder or Amcrest camera config too much, besides just disabling the recording on the cameras, and turning on motion detection. I use ZoneMinder to handle the video recording, which i leave disabled unless we leave the house then Home Assistant turns on motion recording in ZoneMinder.
The little piece of code right here whitelists the directory the camera. Snapshot service is used to store the pictures the camera takes when someone sets off motion detection, then i have an automation that sends that picture to Telegram.
homeassistant:
whitelist_external_dirs:
- /config/www/camera
Here is the ZoneMinder and Amcrest code in my configuration.yaml
zoneminder:
- host: 192.168.*.*
username: admin
password: *********
camera:
- platform: zoneminder
switch:
- platform: zoneminder
command_on: Modect
command_off: Monitor
amcrest:
- host: 192.168.*.*
username: admin
password: '*********'
name: Front Door
stream_source: mjpeg
scan_interval: 8
binary_sensors:
- motion_detected
- online
- host: 192.168.*.*
username: admin
password: '*********'
name: Back Yard
stream_source: mjpeg
scan_interval: 9
binary_sensors:
- motion_detected
- online
Here is the automation that triggers when the motion sensor on the Amcrest is set off. The piece that sends a photo to Telegram is in the script that runs. The automation also changes the color of a LED strip I have in my lab cabinet.
- id: '1578504651170'
alias: Take Photo Motion Deteched
description: ''
trigger:
- entity_id: binary_sensor.front_door_motion_detected
platform: state
to: 'on'
condition: []
action:
- service: script.1578504422540
- data:
color_name: orange
entity_id: light.ledvance_flex_rgbw_0a240700_level_light_color_on_off
service: light.turn_on
- delay: 0:01:00
- data:
color_name: blueviolet
entity_id: light.ledvance_flex_rgbw_0a240700_level_light_color_on_off
service: light.turn_on
Here is the script that takes a photo with the Home Assistant security camera, then sends that photo to Telegram.