-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathfrigate_automation.yaml
65 lines (65 loc) · 2.56 KB
/
frigate_automation.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
alias: Frigate Back Door w Image
description: ""
trigger:
- platform: mqtt
topic: frigate/events
payload: back_porch/new
value_template: "{{ value_json['after']['camera'] }}/{{ value_json['type']}}"
id: frigate-event
condition: []
action:
- choose:
- alias: Frigate Event
conditions:
- condition: trigger
id: frigate-event
- condition: template
value_template: >-
{{ not this.attributes.last_triggered or (now() -
this.attributes.last_triggered).seconds > cooldown }}
sequence:
- variables:
id: "{{ trigger.payload_json['after']['id'] }}"
initial_entered_zones: "{{ trigger.payload_json['after']['entered_zones'] }}"
- alias: Notifications enabled for object label
condition: template
value_template: "{{ not labels|length or object in labels }}"
- alias: Notify on new object
choose:
- conditions:
- condition: template
value_template: "{{ not zone_only or initial_entered_zones|length > 0 }}"
- condition: template
value_template: >-
{{ not zones|length or zones|select('in',
initial_entered_zones)|list|length > 0 }}
sequence:
- service: notify.{your mobile app ID}
data:
message: Back Porch Motion
title: Back Porch Alert
data:
image: >-
{{base_url}}/api/events/{{id}}/thumbnail.jpg?format=android
clickAction: "{{action_url}}/api/events/{{id}}/clip.mp4"
actions:
- action: URI
title: View Clip
uri: "{{action_url}}/api/events/{{id}}/clip.mp4"
channel: back_porch
priority: high
ttl: 0
# THIS IS FOR HASS AGENT ON THE PC. OMIT IF NOT RUNNING HASS AGENT
- service: notify.hass_agent_superman
data:
message: Back Porch Motion
title: Back Porch Alert
data:
image: "{{base_url}}/api/events/{{id}}/thumbnail.jpg"
mode: single
variables:
base_url: {your frigate instance URL}
action_url: {your frigate instance URL}
cooldown: 90
zones:
- deck_area