forked from ratgdo/esphome-ratgdo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
base.yaml
298 lines (276 loc) · 7.67 KB
/
base.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
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
---
external_components:
- source:
type: git
url: https://github.com/ratgdo/esphome-ratgdo
refresh: 1s
safe_mode:
preferences:
flash_write_interval: 1min
text_sensor:
- platform: version
name: "Firmware Version"
ratgdo:
id: ${id_prefix}
input_gdo_pin: ${uart_rx_pin}
output_gdo_pin: ${uart_tx_pin}
input_obst_pin: ${input_obst_pin}
on_sync_failed:
then:
- homeassistant.service:
service: persistent_notification.create
data:
title: "${friendly_name} sync failed"
message: "Failed to communicate with garage opener on startup."
notification_id: "esphome_ratgdo_${id_prefix}_sync_failed"
api:
services:
- service: wipe_devices_from_gdo_memory
variables:
devices_to_wipe: string
then:
- lambda: !lambda |-
if(devices_to_wipe.compare("all") == 0) {
id($id_prefix).clear_paired_devices(ratgdo::PairedDevice::ALL);
} else if (devices_to_wipe.compare("remote") == 0) {
id($id_prefix).clear_paired_devices(ratgdo::PairedDevice::REMOTE);
} else if (devices_to_wipe.compare("keypad") == 0) {
id($id_prefix).clear_paired_devices(ratgdo::PairedDevice::KEYPAD);
} else if (devices_to_wipe.compare("wall") == 0) {
id($id_prefix).clear_paired_devices(ratgdo::PairedDevice::WALL_CONTROL);
} else if (devices_to_wipe.compare("accessory") == 0) {
id($id_prefix).clear_paired_devices(ratgdo::PairedDevice::ACCESSORY);
}
ota:
- platform: esphome
id: ratgdo_ota
sensor:
- platform: ratgdo
id: ${id_prefix}_openings
type: openings
entity_category: diagnostic
ratgdo_id: ${id_prefix}
name: "Openings"
unit_of_measurement: "openings"
icon: mdi:open-in-app
- platform: ratgdo
id: ${id_prefix}_paired_devices_total
type: paired_devices_total
entity_category: diagnostic
ratgdo_id: ${id_prefix}
name: "Paired Devices"
icon: mdi:remote
lock:
- platform: ratgdo
id: ${id_prefix}_lock_remotes
ratgdo_id: ${id_prefix}
name: "Lock remotes"
switch:
- platform: gpio
id: "${id_prefix}_status_door"
internal: true
pin:
number: ${status_door_pin} # output door status, HIGH for open, LOW for closed
mode:
output: true
name: "Status door"
entity_category: diagnostic
- platform: gpio
id: "${id_prefix}_status_obstruction"
internal: true
pin:
number: ${status_obstruction_pin} # output for obstruction status, HIGH for obstructed, LOW for clear
mode:
output: true
name: "Status obstruction"
entity_category: diagnostic
- platform: ratgdo
id: "${id_prefix}_learn"
type: learn
ratgdo_id: ${id_prefix}
name: "Learn"
icon: mdi:plus-box
entity_category: config
binary_sensor:
- platform: ratgdo
type: motion
id: ${id_prefix}_motion
ratgdo_id: ${id_prefix}
name: "Motion"
device_class: motion
- platform: ratgdo
type: obstruction
id: ${id_prefix}_obstruction
ratgdo_id: ${id_prefix}
name: "Obstruction"
device_class: problem
on_press:
- switch.turn_on: ${id_prefix}_status_obstruction
on_release:
- switch.turn_off: ${id_prefix}_status_obstruction
- platform: ratgdo
type: button
id: ${id_prefix}_button
ratgdo_id: ${id_prefix}
name: "Button"
entity_category: diagnostic
- platform: ratgdo
type: motor
id: ${id_prefix}_motor
ratgdo_id: ${id_prefix}
name: "Motor"
device_class: running
entity_category: diagnostic
- platform: gpio
id: "${id_prefix}_dry_contact_open"
pin:
number: ${dry_contact_open_pin} # dry contact for opening door
inverted: true
mode:
input: true
pullup: true
name: "Dry contact open"
entity_category: diagnostic
filters:
- delayed_on_off: 500ms
on_press:
then:
script.execute: "${id_prefix}_dry_contact_door_control"
- platform: gpio
id: "${id_prefix}_dry_contact_close"
pin:
number: ${dry_contact_close_pin} # dry contact for closing door
inverted: true
mode:
input: true
pullup: true
name: "Dry contact close"
entity_category: diagnostic
filters:
- delayed_on_off: 500ms
on_press:
then:
script.execute: "${id_prefix}_dry_contact_door_control"
- platform: gpio
id: "${id_prefix}_dry_contact_light"
pin:
number: ${dry_contact_light_pin} # dry contact for triggering light (no discrete light commands, so toggle only)
inverted: true
mode:
input: true
pullup: true
name: "Dry contact light"
entity_category: diagnostic
filters:
- delayed_on_off: 500ms
on_press:
- light.toggle: ${id_prefix}_light
script:
- id: "${id_prefix}_dry_contact_door_control"
then:
- delay: 0.1s
- if:
condition:
and:
- binary_sensor.is_on: ${id_prefix}_dry_contact_close
- binary_sensor.is_on: ${id_prefix}_dry_contact_open
then:
- cover.toggle: ${id_prefix}_garage_door
- if:
condition:
and:
- binary_sensor.is_off: ${id_prefix}_dry_contact_close
- binary_sensor.is_on: ${id_prefix}_dry_contact_open
then:
- cover.open: ${id_prefix}_garage_door
- if:
condition:
and:
- binary_sensor.is_on: ${id_prefix}_dry_contact_close
- binary_sensor.is_off: ${id_prefix}_dry_contact_open
then:
- cover.close: ${id_prefix}_garage_door
number:
- platform: ratgdo
id: ${id_prefix}_rolling_code_counter
type: rolling_code_counter
entity_category: config
ratgdo_id: ${id_prefix}
name: "Rolling code counter"
mode: box
unit_of_measurement: "codes"
- platform: ratgdo
id: ${id_prefix}_opening_duration
type: opening_duration
entity_category: config
ratgdo_id: ${id_prefix}
name: "Opening duration"
unit_of_measurement: "s"
- platform: ratgdo
id: ${id_prefix}_closing_duration
type: closing_duration
entity_category: config
ratgdo_id: ${id_prefix}
name: "Closing duration"
unit_of_measurement: "s"
- platform: ratgdo
id: ${id_prefix}_client_id
type: client_id
entity_category: config
ratgdo_id: ${id_prefix}
name: "Client ID"
mode: box
cover:
- platform: ratgdo
id: ${id_prefix}_garage_door
device_class: garage
name: "Door"
ratgdo_id: ${id_prefix}
on_closed:
- switch.turn_off: ${id_prefix}_status_door
on_open:
- switch.turn_on: ${id_prefix}_status_door
light:
- platform: ratgdo
id: ${id_prefix}_light
name: "Light"
ratgdo_id: ${id_prefix}
button:
- platform: restart
id: ${id_prefix}_restart
name: "Restart"
- platform: safe_mode
id: ${id_prefix}_safe_mode
name: "Safe mode boot"
entity_category: diagnostic
- platform: template
id: ${id_prefix}_query_status
entity_category: diagnostic
name: "Query status"
on_press:
then:
lambda: !lambda |-
id($id_prefix).query_status();
- platform: template
id: ${id_prefix}_query_openings
name: "Query openings"
entity_category: diagnostic
on_press:
then:
lambda: !lambda |-
id($id_prefix).query_openings();
- platform: template
id: ${id_prefix}_sync
name: "Sync"
entity_category: diagnostic
on_press:
then:
lambda: !lambda |-
id($id_prefix).sync();
- platform: template
id: ${id_prefix}_toggle_door
name: "Toggle door"
on_press:
then:
lambda: !lambda |-
id($id_prefix).door_toggle();