Files
fresh-home/automations/frigate/frigate_person_from_street.yaml
T
2026-05-04 21:01:23 -04:00

159 lines
6.3 KiB
YAML

id: "automation_frigate_person_from_street"
alias: Frigate Person From Street
description: "Fire a notification if a person is detected by Frigate coming towards the house from the street"
mode: single
max_exceeded: silent
trigger:
platform: mqtt
topic: frigate/events
payload: new
value_template: "{{ value_json.type }}"
variables:
id: "{{ trigger.payload_json['after']['id'] }}"
camera: "{{ trigger.payload_json['after']['camera'] }}"
camera_name: "{{ camera | replace('_', ' ') | title }}"
object: "{{ trigger.payload_json['after']['label'] }}"
label: "{{ object | title }}"
entered_zones: "{{ trigger.payload_json['after']['entered_zones'] }}"
type: "{{ trigger.payload_json['type'] }}"
stationary: "{{ trigger.payload_json['after']['stationary'] }}"
base_url: https://automation.clintweaver.com
group_target: ""
zone_only: true
before_zones:
- from_street
after_zones:
- driveway
- parking_spot
input_zones:
- from_street
zones: "{{ input_zones | list }}"
input_labels:
- person
labels: "{{ input_labels | list }}"
presence_entity: person.clint
condition:
- "{{ type != 'end' }}"
- "{{ not zone_only or entered_zones|length > 0 }}"
- "{{ not stationary }}"
- "{{ not zones|length or zones|select('in', entered_zones)|list|length > 0 }}"
- "{{ not labels|length or object in labels }}"
- "{{ is_state('input_boolean.outdoor_snapshots','on') }}"
#- "{{ not presence_entity or not is_state(presence_entity, 'home') }}"
#- "{{ not garage_door or not is_state(garage_door, 'on') }}"
action:
- choose:
- conditions: "{{ not group_target }}"
sequence:
- device_id: 99193a9cdfd7a8cb893c54665d710e7d
domain: mobile_app
type: notify
message: A {{ label }} was detected on the {{ camera_name }} camera.
data:
tag: "{{ id }}"
group: frigate-notification-{{ camera }}
image: /api/frigate/notifications/{{id}}/thumbnail.jpg?format=android
attachment:
url: /api/frigate/notifications/{{id}}/thumbnail.jpg
- action: persistent_notification.create
data:
title: A {{ label }} was detected on the {{ camera_name }} camera.
message: 'A {{ label }} was detected on the {{ camera_name }} camera. ![image](https://automation.clintweaver.com/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/thumbnail.jpg)'
notification_id: "{{ id }}"
default:
- action: notify.{{ group_target }}
data:
message: A {{ label }} was detected on the {{ camera_name }} camera.
data:
tag: "{{ id }}"
group: frigate-notification-{{ camera }}
image: /api/frigate/notifications/{{id}}/thumbnail.jpg?format=android
attachment:
url: /api/frigate/notifications/{{id}}/thumbnail.jpg
- repeat:
sequence:
- wait_for_trigger:
- platform: mqtt
topic: frigate/events
payload: "{{ id }}"
value_template: "{{ value_json['after']['id'] }}"
timeout:
minutes: 2
continue_on_timeout: false
- condition: template
value_template: "{{ wait.trigger.payload_json['type'] == 'end' }}"
- choose:
- conditions: "{{ not group_target }}"
sequence:
- device_id: 99193a9cdfd7a8cb893c54665d710e7d
domain: mobile_app
type: notify
message: A {{ label }} was detected on the {{ camera_name }} camera.
data:
tag: "{{ id }}"
group: frigate-notification-{{ camera }}
url: >-
{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
clickAction: >-
{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
image: >-
/api/frigate/notifications/{{id}}/thumbnail.jpg?format=android
sound: none
attachment:
url: /api/frigate/notifications/{{id}}/thumbnail.jpg
actions:
- action: URI
title: View Clip
uri: >-
{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
- action: URI
title: View Snapshot
uri: >-
{{base_url}}/api/frigate/notifications/{{id}}/snapshot.jpg
- action: silence-{{ camera }}
title: Silence Notifications
destructive: true
default:
- action: notify.{{ group_target }}
data:
message: A {{ label }} was detected on the {{ camera_name }} camera.
data:
tag: "{{ id }}"
group: frigate-notification-{{ camera }}
url: >-
{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
clickAction: >-
{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
image: >-
/api/frigate/notifications/{{id}}/thumbnail.jpg?format=android
sound: none
attachment:
url: /api/frigate/notifications/{{id}}/thumbnail.jpg
actions:
- action: URI
title: View Clip
uri: >-
{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
- action: URI
title: View Snapshot
uri: >-
{{base_url}}/api/frigate/notifications/{{id}}/snapshot.jpg
- action: silence-{{ camera }}
title: Silence Notifications
destructive: true
until: "{{ wait.trigger.payload_json['type'] == 'end' }}"
- wait_for_trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: silence-{{ camera }}
timeout:
seconds: 30
continue_on_timeout: false
- delay:
minutes: 30