blob: 0430266763b14acad1a427d787db1ff6a7d19132 (
plain)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
blueprint:
name: Security Camera Streamer
description: Stream photos from security camera
domain: script
input:
camera:
name: Camera
description: Camera
default: camera.192_168_50_51
selector:
entity:
domain: camera
motion_sensor:
name: Motion Sensor
description: Sensor detecting if there are motions to trigger the camera
selector:
entity:
domain: binary_sensor
device_class: motion
host:
name: Host
description: Host running camera server
default: http://127.0.0.1:8123
caption:
name: Caption
description: Caption to send in telegram message
default: 'Intusion Alert: '
lights_on:
name: Lights On
description: List of lights to turn on
default: []
selector:
entity:
multiple: true
domain: [light, switch]
lights_off:
name: Lights Off
description: List of lights to turn off
default: []
selector:
entity:
multiple: true
domain: [light, switch]
prepare:
name: prepare
description: Actions to perform before shooting photos
default: []
selector:
action:
delay:
name: Delay
description: Delay between shots (seconds)
default: 5
selector:
number:
min: 1
max: 3600
unit_of_measurement: s
fast_shots:
name: Fast Shots
description: Number of initial shots with short delay
default: 10
selector:
number:
min: 0
max: 50
fast_delay:
name: Fast Delay
description: Delay between fast shots (milliseconds)
default: 1000
selector:
number:
min: 100
max: 10000
unit_of_measurement: ms
variables:
camera: !input camera
smartpi: !input host
caption: !input caption
delay: !input delay
fast_shots: !input fast_shots
fast_delay: !input fast_delay
mode: restart
sequence:
- parallel:
- service: homeassistant.turn_on
target:
entity_id: !input lights_on
- service: homeassistant.turn_off
target:
entity_id: !input lights_off
- choose: []
default: !input "prepare"
- sequence:
- service: telegram_bot.send_photo
data:
disable_notification: false
caption: '{{ caption }} at {{ states("sensor.date_time_iso")
}}'
url: '{{ smartpi + state_attr(camera, "entity_picture") }}'
- repeat:
while:
- condition: template
value_template: '{{ repeat.index < fast_shots }}'
sequence:
- service: telegram_bot.send_photo
data:
disable_notification: true
caption: '{{ caption }} {{ repeat.index }} (fast)'
url: '{{ smartpi + state_attr(camera, "entity_picture") }}'
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: '{{ fast_delay }}'
- repeat:
# About 30 seconds delay before occupancy clears (both ways via state or device)
until:
- condition: state
entity_id: !input motion_sensor
state: 'off'
# for:
# seconds: 2
# - type: is_no_motion
# condition: device
# device_id: 6deb0a6fb7a4a849ba22afc166cf9919
# device_id: '{{ device_id("binary_sensor.0x00158d0004485e0b_occupancy") }}'
# entity_id: binary_sensor.0x00158d0004485e0b_occupancy
# domain: binary_sensor
sequence:
- service: telegram_bot.send_photo
data:
disable_notification: true
caption: '{{ caption }} {{ repeat.index + fast_shots - 1 }}'
url: '{{ smartpi + state_attr(camera, "entity_picture") }}'
- delay:
hours: 0
minutes: 0
seconds: '{{ delay }}'
milliseconds: 0
|