-
Notifications
You must be signed in to change notification settings - Fork 157
/
locks.yaml
executable file
·206 lines (175 loc) · 5.44 KB
/
locks.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
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#################################################################
## Door Lock Automations
#################################################################
##########################################################
## Doorbell Fingerprint Unlock Front Door
##########################################################
- alias: Locks - doorbell fingerprint unlock front door
id: 'locks_doorbell_fingerprint_unlock_front_door'
triggers:
- platform: event
event_type: state_changed
event_data:
entity_id: event.front_door_camera_fingerprint
conditions:
- condition: state
entity_id: lock.front_door
state: 'locked'
- condition: state
entity_id: input_boolean.disable_lock_unlock_doors
state: 'off'
- condition: state
entity_id: binary_sensor.front_door_opened
state: 'off'
- condition: template
value_template: >
{{
not trigger.event.data.old_state.attributes.get('restored', false) and
not trigger.event.data.old_state.state == 'unavailable' and
trigger.event.data.new_state is not none and
trigger.event.data.new_state.attributes.event_type == 'identified' and
(trigger.event.data.new_state.attributes.ulp_id|default('')) != '' and
trigger.event.data.new_state.attributes.ulp_id in ['REDACTED', 'REDACTED']
}}
actions:
- action: lock.unlock
entity_id: lock.front_door
##########################################################
## Lock Front Door After 30 Mins
##########################################################
- alias: Locks - Lock Front Door After 30 Mins
id: 'locks_lock_front_door_after_30_mins'
triggers:
- trigger: state
entity_id: lock.front_door
from: 'locked'
to: 'unlocked'
for:
hours: 0
minutes: 30
seconds: 0
conditions:
- condition: state
entity_id: input_boolean.disable_lock_unlock_doors
state: 'off'
- condition: state
entity_id: binary_sensor.front_door_opened
state: 'off'
- condition: state
entity_id: lock.front_door
state: 'unlocked'
actions:
- action: lock.lock
entity_id: lock.front_door
##########################################################
## Lock Back Door After 2 Hours
##########################################################
- alias: Locks - Lock Back Door After 2 Hours
id: 'locks_lock_back_door_after_2_hours'
triggers:
- trigger: state
entity_id: lock.back_door
from: 'locked'
to: 'unlocked'
for:
hours: 2
minutes: 0
seconds: 0
conditions:
- condition: state
entity_id: input_boolean.disable_lock_unlock_doors
state: 'off'
- condition: state
entity_id: binary_sensor.back_door_opened
state: 'off'
for:
hours: 1
minutes: 0
seconds: 0
- condition: state
entity_id: lock.back_door
state: 'unlocked'
actions:
- action: lock.lock
entity_id: lock.back_door
##########################################################
## Lock Basement Door After 2 hours
##########################################################
- alias: Locks - Lock Basement Door After 45 Mins
id: 'locks_lock_basement_door_after_45_mins'
triggers:
- trigger: state
entity_id: lock.basement_door
from: 'locked'
to: 'unlocked'
for:
hours: 2
minutes: 0
seconds: 0
conditions:
- condition: state
entity_id: input_boolean.disable_lock_unlock_doors
state: 'off'
- condition: state
entity_id: binary_sensor.basement_door_opened
state: 'off'
for:
hours: 1
minutes: 0
seconds: 0
- condition: state
entity_id: lock.basement_door
state: 'unlocked'
actions:
- action: lock.lock
entity_id: lock.basement_door
##########################################################
## Lock Doors at 2a
##########################################################
- alias: Locks - Lock Doors at 2a
id: 'locks_lock_back_door_at_2a'
triggers:
- trigger: time
at: '02:00:00'
conditions:
- condition: state
entity_id: input_boolean.disable_lock_unlock_doors
state: 'off'
- condition: state
entity_id: binary_sensor.doors
state: 'off'
actions:
- action: lock.lock
target:
entity_id:
- lock.front_door
- lock.back_door
- lock.basement_door
#################################################################
## Notifications
#################################################################
##########################################################
## Locks Low Battery Notification
##########################################################
- alias: Locks - Low Battery Notification
id: 'locks_low_battery_notification'
mode: parallel
triggers:
- trigger: numeric_state
entity_id:
- sensor.front_door_lock_batt
- sensor.back_door_lock_batt
- sensor.basement_door_lock_batt
below: 30
for:
hours: 1
minutes: 0
seconds: 0
conditions:
- condition: state
entity_id: input_boolean.disable_notifications
state: 'off'
actions:
- action: notify.USER1_devices
data:
message: "{{ trigger.to_state.attributes.friendly_name }} Low"