I use zoneminder, running on another machine, with zmeventnotification, an AI capability to do object detection. ZMeventntofication is used to identify cars, people and some animals. When any of these are detected I use an add-on associated with zmeventnotification to FTP the pictures to HA, making objects tagged pictures available in HA. This uses the HA FTP add-on receive the pictures. Both ZM and HA access the video streams, so I can pull up a live feed in either system. I also use aqara motion and contact sensors with HA’s alarm panel to provide security system functionality in HA. When motion or contact sensors detect an alarm event I grab snapshots with the camera’s on HA and email a picture to whoever is monitoring the house via an automation. I also use twilio to send send an SMS to whoever is watching the place. For each camera I can also pull up the last 15 tagged ZM photos in HA. I use the HACS gallery card to present the ZM tagged photo’s. Here’s a shot of the gallery card for one camera:
This shows accessing one of the camera’s using HA:
Here’s a shot from ZM showing the event interface to look at all detected activity:
An example of my automation and associated scripts called when alarm system is activated and motion is detected
alias: picture on motion
trigger:
- entity_id: binary_sensor.basement_finished_motion_aq2
platform: state
to: "on"
action:
- service: script.capture_pic_seq
data_template:
evEntity: camera.basement_camera
evPath: /config/www/images/basement_finished/
evTimeTag: "{{ states('sensor.date') }}-{{ states('sensor.time') }}"
- condition: template
value_template: "{{ states.alarm_control_panel.home_alarm.state != 'disarmed' }}"
- service: notify.sendtsms
data_template:
title: House Alarm
message: >-
Motion Detected in basement {{ states('sensor.date_time') }} so check
email
target:
- "+1xxxxxxxxxx"
- service: script.send_pic_seq
data: {}
The sendtsms uses twillio to send me a message telling whoever is monitoring that event happened.
associated script, this is script.capture_pic_seq:
sequence:
- service: camera.snapshot
data_template:
entity_id: "{{ evEntity }}"
filename: "{{ evPath}}{{ evTimeTag }}-1.jpg"
- service: shell_command.save_file
data_template:
fileName: "{{ evPath}}{{ evTimeTag }}-1.jpg"
- condition: template
value_template: "{{ states('input_number.pic_count') |int > 1 }}"
- service: camera.snapshot
data_template:
entity_id: "{{ evEntity }}"
filename: "{{ evPath}}{{ evTimeTag }}-2.jpg"
- condition: template
value_template: "{{ states('input_number.pic_count') |int > 2 }}"
- service: camera.snapshot
data_template:
entity_id: "{{ evEntity }}"
filename: "{{ evPath}}{{ evTimeTag }}-3.jpg"
- condition: template
value_template: "{{ states('input_number.pic_count') |int > 3 }}"
- service: camera.snapshot
data_template:
entity_id: "{{ evEntity }}"
filename: "{{ evPath}}{{ evTimeTag }}-4.jpg"
- condition: template
value_template: "{{ states('input_number.pic_count') |int > 4 }}"
- service: camera.snapshot
data_template:
entity_id: "{{ evEntity }}"
filename: "{{ evPath}}{{ evTimeTag }}-5.jpg"
- condition: template
value_template: "{{ states('input_number.pic_count') |int > 5 }}"
- service: camera.snapshot
data_template:
entity_id: "{{ evEntity }}"
filename: "{{ evPath}}{{ evTimeTag }}-6.jpg"
- condition: template
value_template: "{{ states('input_number.pic_count') |int > 6 }}"
- service: camera.snapshot
data_template:
entity_id: "{{ evEntity }}"
filename: "{{ evPath}}{{ evTimeTag }}-7.jpg"
- condition: template
value_template: "{{ states('input_number.pic_count') |int > 7 }}"
- service: camera.snapshot
data_template:
entity_id: "{{ evEntity }}"
filename: "{{ evPath}}{{ evTimeTag }}-8.jpg"
- condition: template
value_template: "{{ states('input_number.pic_count') |int > 8 }}"
- service: camera.snapshot
data_template:
entity_id: "{{ evEntity }}"
filename: "{{ evPath}}{{ evTimeTag }}-9.jpg"
- condition: template
value_template: "{{ states('input_number.pic_count') |int > 9 }}"
- service: camera.snapshot
data_template:
entity_id: "{{ evEntity }}"
filename: "{{ evPath}}{{ evTimeTag }}-10.jpg"
alias: ""
mode: single
And script.send_pic_seq
sequence:
- service: notify.sendemail
data:
title: Motion Detection
message: Alarm armed in basement {{ states('sensor.date_time') }}
data:
images:
- /config/www/images/outbound/photo1.jpg
alias: ""
mode: single
Added configuration in configuration.yaml to make notifications work:
twilio:
account_sid: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
auth_token: XXXXXXXXXXXXXXXXXXXXXXXXXX
notify:
- name: sendemail
platform: smtp
server: smtp.mail.yahoo.com
port: 587
timeout: 15
sender: [email protected]
starttls: true
username: [email protected]
password: !secret yahoo_password
sender_name: Home Assistant
recipient:
- [email protected]
- name: sendtsms
platform: twilio_sms
from_number: '+1xxxxxxxxxx'
I probably need to convert some things to blueprints, but this was done well before that was an option.