Hello again @badstraw, just looked over my current config.
This is my alerting automation, now using hangouts. You should be able to adapt this to any notify platform like html5 or pushbullet or something else. According to this: https://www.home-assistant.io/integrations/html5/ the html5 does not work on iOS. So consider changing to another platform. See some information here: https://companion.home-assistant.io/docs/notifications/actionable-notifications/
Hangouts should work on IOS, I think. But not sure. I use hangouts for many notifications and the reason is that it works very stable, its free, and I get a history of all notifications in the “chat history”.
Here is the hangouts notification:
- id: '1601385011168'
alias: Person Detected
description: ''
trigger:
- platform: event
event_type: deepstack.object_detected
action:
- service: rest_command.blue_iris_flag
data:
camera: '{{ camera }}'
memo: '{{ trigger.event.data.name }} {{ percent }}% confidence'
- delay:
seconds: 2
- service: notify.hangouts_owners
data:
title: A {{ trigger.event.data.name }} detected!
message: 'Confidence {{ percent }}%. Check the NVR: https://nvr.barmen.nu
for more details and recordings.'
data:
image_file: '{{ url }}'
variables:
timestamp: '{{ as_timestamp(trigger.event.time_fired) | timestamp_custom("%Y-%m-%d_%H-%M-%S")
}}'
entity_id: '{{ trigger.event.data.entity_id | regex_findall_index("\.(.*)") }}'
folder: /config/www/snapshots/
url: '{{ folder }}{{ entity_id }}_{{ timestamp }}.jpg'
camera: '{{ trigger.event.data.entity_id | regex_findall_index("deepstack_object_blueiris_(.*)") }}'
percent: '{{ trigger.event.data.confidence | int }}'
mode: single
This automation is triggered with this automation to do the object detection:
- id: '1601371973424'
alias: Object Detection Front Door
description: Check if there is a person at the front door
trigger:
- platform: state
entity_id: binary_sensor.blueiris_front_door_motion
to: 'on'
condition:
- condition: state
entity_id: input_boolean.camera_deepstack
state: 'on'
action:
- service: image_processing.scan
data: {}
entity_id: image_processing.deepstack_object_blueiris_front_door
mode: single
I have one suck automation per camera.
This is the rest command for Blue Iris:
rest_command:
blue_iris_flag:
url: http://192.168.0.22/admin?trigger&camera={{ camera }}&user=puturusernamehere&pw=passwordgoesherei&flagalert=1&trigger&memo={{ memo }}
method: GET
Replace with your IP and username&password.
This setup does the following. When there is movement on one of the cameras a picture of the movement is sent to deepstack for analysis. If there is a detected object notify (using hangouts in this case). Since I had some issues finding the current file name for the image I used the new variable function in Home Assistant. Using timestamp I am able to get the current filename and attach that to the notification.
If I get a positive person detection I also set up a rest_command to flag the video recording in Blue Iris. It triggers the current camera and flags the video. This way I can filter all recordings in Blue Iris with flagged videoes to only show the ones with persons (or cars) detected.
This is the deepstack_object configuration I use:
image_processing:
- platform: deepstack_object
ip_address: 192.168.0.21
port: 81
#api_key: mysecretkey
save_file_folder: /config/www/snapshots/
save_timestamped_file: True
# roi_x_min: 0.35
# roi_x_max: 0.8
# roi_y_min: 0.4
# roi_y_max: 0.8
targets:
- person
- car
source:
- entity_id: camera.blueiris_front_door
Again, one per camera.