-
-
Notifications
You must be signed in to change notification settings - Fork 495
Expand file tree
/
Copy pathgaradget.yaml
More file actions
executable file
·360 lines (328 loc) · 12.1 KB
/
garadget.yaml
File metadata and controls
executable file
·360 lines (328 loc) · 12.1 KB
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
######################################################################
# @CCOSTAN - Follow Me on X
# For more info visit https://www.vcloudinfo.com/click-here
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
# -------------------------------------------------------------------
# Garadget Garage Doors - MQTT cover control and monitoring
# Open/close commands, status polling, and notifications.
# -------------------------------------------------------------------
# Notes: Debounces garage door open/close triggers to reduce noisy
# state flapping from spamming lights, speech, and Alexa displays.
# Setup: https://www.vcloudinfo.com/2019/03/how-to-add-garadget-to-home-assistant.html
# Token fix: https://www.vcloudinfo.com/2020/05/fixing-garadget-in-home-assistant.html
# Hardware: Garadget unit https://amzn.to/2jQLpVQ
######################################################################
mqtt:
cover:
- name: "Large Garage Door"
unique_id: garadget_large_garage_door_cover
device_class: 'garage'
command_topic: "garadget/GLarge/command"
state_topic: "garadget/GLarge/status"
value_template: >-
{% if value_json.status == 'closed' %}
closed
{% else %}
open
{% endif %}
payload_open: "open"
payload_close: "close"
payload_stop: "stop"
- name: "Small Garage Door"
unique_id: garadget_small_garage_door_cover
device_class: 'garage'
command_topic: "garadget/GSmall/command"
state_topic: "garadget/GSmall/status"
value_template: >-
{% if value_json.status == 'closed' %}
closed
{% else %}
open
{% endif %}
payload_open: "open"
payload_close: "close"
payload_stop: "stop"
sensor:
- name: "Large Garage Door Since"
unique_id: garadget_large_garage_door_since
state_topic: "garadget/GLarge/status"
value_template: '{{ value_json.time }}'
- name: "Large Garage Door Brightness"
unique_id: garadget_large_garage_door_brightness
state_topic: "garadget/GLarge/status"
unit_of_measurement: '%'
state_class: measurement
value_template: '{{ value_json.bright }}'
- name: "Small Garage Door Since"
unique_id: garadget_small_garage_door_since
state_topic: "garadget/GSmall/status"
value_template: '{{ value_json.time }}'
- name: "Small Garage Door Brightness"
unique_id: garadget_small_garage_door_brightness
state_topic: "garadget/GSmall/status"
unit_of_measurement: '%'
state_class: measurement
value_template: '{{ value_json.bright }}'
input_text:
last_person_home:
name: Last Person Home
initial: 'Carlo'
group:
garage_doors: # This group is used to check if doors are open or Closed.
name: Garage Doors
entities:
- cover.large_garage_door
- cover.small_garage_door
automation:
######################################################################
## Automation: Auto-open Large Garage Door when someone comes home
######################################################################
- alias: 'Auto Open Large Garage Door On Arrival'
id: 7e2b1c3a-4b1e-4b2a-9c1a-automated_garage_door
mode: single
trigger:
- platform: state
entity_id:
- person.carlo
- person.stacey
from: 'driving'
to: 'home'
condition:
- condition: state
entity_id: cover.large_garage_door
state: 'closed'
# - condition: state
# entity_id: group.bed
# state: 'off'
- condition: state
entity_id: group.family
state: 'home'
action:
- service: cover.open_cover
target:
entity_id: cover.large_garage_door
- service: input_text.set_value
target:
entity_id: input_text.last_person_home
data:
value: "{{ trigger.to_state.entity_id.split('.')[1] }}"
- service: script.send_to_logbook
data:
topic: "GARAGE"
message: "Large Garage was auto-opened for {{ states('input_text.last_person_home') }}."
######################################################################
## Entry helper prompt after arrival if auto-open didn’t fire.
######################################################################
- alias: 'Entry Helper'
id: 365adc21-5e96-4e78-9e94-089901a29430
mode: parallel
trigger:
- platform: state
entity_id:
- person.carlo
- person.stacey
to: 'home'
condition:
- condition: state
entity_id: cover.large_garage_door
state: 'closed'
action:
# Give the auto-open routine a chance to fire; if the door opened, skip the prompt.
- delay: "00:00:25"
- choose:
- conditions:
- condition: state
entity_id: cover.large_garage_door
state: 'closed'
sequence:
- service: input_text.set_value
target:
entity_id: input_text.last_person_home
data:
value: "{{ trigger.to_state.entity_id.split('.')[1] }}"
- service: script.notify_engine_two_button
data:
title: 'Welcome Home!'
value1: 'Choose: unlock front door or open garage?'
title1: 'Unlock Door'
action1: 'UNLOCK_FRONT_DOOR'
icon1: 'sfsymbols:lock.open'
destructive1: 'false'
title2: 'Open Garage'
action2: 'OPEN_LARGE_GARAGE'
icon2: 'sfsymbols:arrow.up.circle'
destructive2: 'false'
who: "{{ states('input_text.last_person_home') }}"
group: 'Welcome_Home'
- alias: 'Open Large Garage Door Action'
id: 85e02a74-2ecc-4815-95a6-db864a6dffd7
trigger:
platform: event
event_type: mobile_app_notification_action
event_data:
action: OPEN_LARGE_GARAGE
condition:
- condition: state
entity_id: cover.large_garage_door
state: 'closed'
- condition: state
entity_id: group.family
state: 'home'
action:
- service: cover.open_cover
entity_id: cover.large_garage_door
- alias: 'Unlock Front Door Action'
id: c3106db1-f2c4-4800-b1a3-76d440228600
trigger:
platform: event
event_type: mobile_app_notification_action
event_data:
action: UNLOCK_FRONT_DOOR
action:
- service: lock.unlock
entity_id: lock.front_door
######################################################################
## Auto-unlock front door when Paige or Justin arrive from driving
######################################################################
- alias: 'Auto Unlock Front Door on Arrival (Paige/Justin)'
id: 8f4f5f6a-9c2d-4f4c-9f6c-7d5e5b2e2c3d
mode: single
trigger:
- platform: state
entity_id:
- person.paige
- person.justin
from: 'driving'
to: 'home'
condition:
- condition: state
entity_id: lock.front_door
state: 'locked'
action:
- service: lock.unlock
target:
entity_id: lock.front_door
- service: script.notify_engine
data:
title: "Front door auto-unlocked"
value1: "Unlocking for {{ trigger.to_state.name }} arriving from driving."
who: "family"
group: "Welcome_Home"
- service: script.send_to_logbook
data:
topic: "DOORS"
message: "Front door auto-unlocked for {{ trigger.to_state.name }} arriving from driving."
######################################################################
## Garage Status Announcements - Only during normal hours.
######################################################################
- alias: 'Update Garage Get-Status'
id: 2b9e8359-c189-4399-b415-50107513fe90
trigger:
- platform: time_pattern
minutes: '/1'
action:
- service: mqtt.publish
data:
topic: "garadget/GSmall/command"
payload: "get-status"
- service: mqtt.publish
data:
topic: "garadget/GLarge/command"
payload: "get-status"
###################################
## Garadget Wind Door Checks - [Garadget](https://amzn.to/2jQLpVQ)
###################################
- alias: 'Wind Speed Garage Door Check'
id: 2819207a-1716-4552-be34-a8e0f7af004e
trigger:
- platform: numeric_state
entity_id: sensor.pirateweather_wind_speed
above: 30
condition:
- condition: or
conditions:
- condition: state
entity_id: cover.large_garage_door
state: 'open'
- condition: state
entity_id: cover.small_garage_door
state: 'open'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.alert_mode
- service: script.notify_engine
data:
title: 'Check/Close Garage Doors - High Speed Wind Alert:'
value1: "Small: {{ states('cover.small_garage_door')}}"
value2: "Large: {{ states('cover.large_garage_door')}}"
group: 'information'
who: 'parents'
- service: script.speech_engine
data:
value1: >
"The wind speed is {{ states('sensor.pirateweather_wind_speed')|round}} miles per hour. For safety, please close the garage doors.
{% if is_state('cover.large_garage_door', 'open') -%}
Large Garage Door: open
{% endif -%}
{% if is_state('cover.small_garage_door', 'open') -%}
{% if is_state('cover.large_garage_door', 'open') -%}and
{%- endif %} Small Garage Door: open.
{% endif %}"
##############################################################################
- alias: Is the Garage door Open at night - Checks every 30 minutes or 5 minutes after we drive away.
id: 4eb3e83e-4484-4102-a4ca-6bacd5b3cbdd
trigger:
- platform: time_pattern
minutes: '/30'
- platform: state
entity_id: group.family
to: not_home
for: 00:05:00
condition:
condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: group.family
state: not_home
for: 00:05:00
- condition: or
conditions:
- condition: template
value_template: "{{ states('cover.large_garage_door') == 'open' }}"
- condition: template
value_template: "{{ states('cover.small_garage_door') == 'open' }}"
- condition: and
conditions:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
- condition: or
conditions:
- condition: template
value_template: "{{ states('cover.large_garage_door') == 'open' }}"
- condition: template
value_template: "{{ states('cover.small_garage_door') == 'open'}}"
action:
- service: script.notify_engine
data:
title: 'Check Garage Doors:'
value1: >
{% set open = [
'Small garage door' if is_state('cover.small_garage_door', 'open') else '',
'Large garage door' if is_state('cover.large_garage_door', 'open') else ''
] | reject('eq', '') | list %}
{% if open|length == 0 %}
All garage doors are closed.
{% elif open|length == 1 %}
{{ open[0] }} is open.
{% else %}
{{ open|join(' and ') }} are open.
{% endif %}
who: "family"
camera_entity: "camera.garagecam"
group: 'information'
- service: script.speech_engine
data:
value1: "Check the garage doors. The Small garage is {{ states('cover.small_garage_door')}} and the large garage is {{ states('cover.large_garage_door')}} [Always mention the specific garage door that is currently open and remind us to close it for the night]"