/
garage-door.yaml
120 lines (112 loc) · 3.07 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
115
116
117
118
119
120
esphome:
name: garage-door
platform: ESP8266
board: d1_mini
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
password: "WHATESPHOMEMADE"
wifi:
ssid: "SSID OF YOUR NETWORK"
password: "PASSWORD"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "THESSIDESPHOMECREATES"
password: "PASSWORD"
captive_portal:
# Switch definiations for the RELAY that is on pin D1
switch:
- platform: gpio
pin: D1
name: "Garage Door Open Switch"
id: open_switch
- platform: gpio
pin: D1
name: "Garage Door Close Switch"
id: close_switch
cover:
- platform: template
name: "Garage Door"
open_action:
# Cancel any previous action
- switch.turn_off: close_switch
# Turn the OPEN switch on briefly
- switch.turn_on: open_switch
# Tun on the LED to show status activity
- light.turn_on: led
- delay: 0.5s
- switch.turn_off: open_switch
- delay: 15s
# Turn off LED to show door is closed (adust timing for your own doors)
- light.turn_off: led
close_action:
- switch.turn_off: open_switch
- switch.turn_on: close_switch
# Tun on the LED to show status activity
- light.turn_on: led
- delay: 0.5s
- switch.turn_off: close_switch
- delay: 15s
# Turn off LED to show door is closed (adust timing for your own doors)
- light.turn_off: led
stop_action:
- switch.turn_off: close_switch
- switch.turn_off: open_switch
optimistic: true
assumed_state: true
lambda: !lambda |-
if (id(garage_door).state) {
return COVER_OPEN;
} else {
return COVER_CLOSED;
}
# GPIO for the REED SWITCH
binary_sensor:
- platform: gpio
# I had a NO switch, if you have a NC switch you will need to use the invert filter.
# filters:
# - invert:
pin:
# This is the RX on the D1 Mini
# Can change as needed but I found this pin works best in my testing of my reed switch
number: GPIO3
name: Garage Door
id: garage_door
device_class: garage_door
# IR SENSOR
- platform: gpio
pin:
number: D0
name: Garage Door IR Sensor
id: garage_door_ir
device_class: motion
# I like to map the LED to D4
light:
- platform: monochromatic
name: "Garage Onboard LED"
output: onboard_led
id: led
# Here is where we define the led that we are turning on as a light.
output:
- platform: esp8266_pwm
id: onboard_led
pin:
number: D4
inverted: true
# Wifi signal sensor defined just so you know what the wifi is like on these little boards.
sensor:
- platform: wifi_signal
name: "Garage ESP WiFi Signal Sensor"
update_interval: 60s
# This is a TMP36 Temprature sensor.
# I have to sometimes change the values of the +32 to calibrate it (in cases + 24 instead)
- platform: adc
pin: A0
name: "Garage Temperature"
update_interval: 60s
filters:
- multiply: 3.3
- lambda: return ((x - 0.5) * 100) * (9.0/5.0) + 32.0;
unit_of_measurement: "°F"