-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgarage-door.yaml
114 lines (99 loc) · 2.84 KB
/
garage-door.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
substitutions:
friendly_name: "Garage Door"
friendly_id: garagedoor
packages:
device_base: !include device_base_esp32.yaml
# Sensors: closed = magnetic, open = no presence.
# Top Sensor (measures door closed)
# Bottom Sensor (measures door is open)
# Top (closed) sensor is closed, DOOR IS CLOSED DOWN
# Bottom (open) sensor is closed, DOOR HAS OPENED UP
# Both sensors are open, DOOR IS MOVING
# Both sensors are closed, BUG, rare, they're both in contact.
cover:
- platform: template
name: "Garage Door v2"
id: garage_door_v2
device_class: garage
open_action:
- switch.turn_on: garage_door_relay
- lambda:
id(garage_door_v2).current_operation = COVER_OPERATION_OPENING;
close_action:
- switch.turn_on: garage_door_relay
- lambda:
id(garage_door_v2).current_operation = COVER_OPERATION_CLOSING;
stop_action:
- switch.turn_on: garage_door_relay
optimistic: false
assumed_state: false
lambda: |-
if (!id(garage_open_sensor).state) {
return COVER_OPEN;
}
else if (!id(garage_closed_sensor).state) {
return COVER_CLOSED;
}
return 1;
// } else {
// return COVER_OPEN;
// }
switch:
- platform: gpio
internal: true
pin:
number: GPIO23
inverted: true
name: "Garage Door"
id: garage_door_relay
restore_mode: ALWAYS_OFF
on_turn_on:
- delay: 1000ms
- switch.turn_off: garage_door_relay
# Sensors: closed = magnetic, open = no presence.
# Top Sensor (measures door closed)
# Bottom Sensor (measures door is open)
# Top (closed) sensor is closed, DOOR IS CLOSED DOWN
# Bottom (open) sensor is closed, DOOR HAS OPENED UP
# Both sensors are open, DOOR IS MOVING
# Both sensors are closed, BUG, rare, they're both in contact.
# Define Hall Effect Sensors
binary_sensor:
- platform: gpio
name: "Garage Door Open (Bottom) Hall Sensor"
id: garage_open_sensor
device_class: garage_door
#internal: true
pin:
number: GPIO32
mode:
pullup: true
input: true
filters:
- delayed_off: 500ms
on_release:
then:
- cover.template.publish:
id: garage_door_v2
state: !lambda |-
id(garage_door_v2).current_operation = COVER_OPERATION_IDLE;
return COVER_OPEN;
- platform: gpio
name: "Garage Door Closed (Top) Hall Sensor"
id: garage_closed_sensor
device_class: garage_door
#internal: true
pin:
number: GPIO33
mode:
pullup: true
input: true
filters:
- delayed_off: 500ms
on_release:
then:
- cover.template.publish:
id: garage_door_v2
state: !lambda |-
id(garage_door_v2).current_operation = COVER_OPERATION_IDLE;
return COVER_CLOSED;