forked from AdamGit69/code-snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcctv_ai_notification_script_UPDATE
69 lines (69 loc) · 2.11 KB
/
cctv_ai_notification_script_UPDATE
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
66
67
68
69
alias: Camera - driveway - Snapshot, AI & Notification
sequence:
- service: camera.snapshot
metadata: {}
data:
filename: ./www/snapshots/driveway_snapshot1.jpg
target:
device_id: {{ DEVICE ID }}
enabled: true
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 500
enabled: true
- service: camera.snapshot
metadata: {}
data:
filename: ./www/snapshots/driveway_snapshot2.jpg
target:
device_id: {{ DEVICE ID }}
enabled: true
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 500
enabled: true
- service: camera.snapshot
metadata: {}
data:
filename: ./www/snapshots/driveway_snapshot3.jpg
target:
device_id: {{ DEVICE ID }}
enabled: true
- service: google_generative_ai_conversation.generate_content
metadata: {}
data:
prompt: >-
Motion has been detected, compare and very briefly describe what you see
in the following sequence of images from my driveway camera. What do you
think caused the motion alarm? If a person or car is present, describe
them in detail. Do not describe stationary objects or buildings. If you
see no obvious causes of motion, reply with "Camera has detected motion
however no obvious motion observed comparing snapshots". Your message
needs to be short enough to fit in a phone notification.
image_filename:
- ./www/snapshots/driveway_snapshot1.jpg
- ./www/snapshots/driveway_snapshot2.jpg
- ./www/snapshots/driveway_snapshot3.jpg
response_variable: generated_content
- if:
- condition: template
value_template: >
{{ generated_content['text'] == ' Camera has detected motion however
no obvious motion observed comparing snapshots.' }}
then:
- stop: ""
else:
- service: notify.discord
data:
target:
- "{{DISCORD ID}}"
message: "{{generated_content['text'] }}"
data:
images:
- ./www/snapshots/driveway_snapshot2.jpg
mode: single
icon: mdi:webcam