-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
269 lines (238 loc) · 5.64 KB
/
template.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
substitutions:
devicename: trelays3
friendly_devicename: T-RelayS3
esphome:
name: $devicename
friendly_name: $friendly_devicename
on_boot:
then:
# read time from RTC on boot
- pcf8563.read_time: time_onboard
# ESP32-S3-WROOM-1U-N16R8
# Flash: 16MB (QuadSPI)
# PSRAM: 8MB (OctalSPI)
esp32:
board: esp32s3box
framework:
type: arduino
psram:
mode: octal
# Enable logging
logger:
# level: VERBOSE
# Enable Home Assistant API
api:
encryption:
key: !secret "api_key"
reboot_timeout: 0s
ota:
- platform: esphome
password: !secret "ota_password"
wifi:
ssid: !secret "wifi_ssid"
password: !secret "wifi_password"
fast_connect: yes
manual_ip:
static_ip: 10.12.1.199
subnet: 255.255.255.0
gateway: !secret "wifi_gateway"
dns1: !secret "wifi_dns1"
dns2: !secret "wifi_dns2"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "$devicename"
password: !secret "wifi_fallback_password"
captive_portal:
web_server:
port: 80
version: 3
# Connectors:
# EC ... expansion connector (30 pins)
# DC ... display connector (14 pins)
# CC ... cascading connector (20 pins)
# GPIO-Mapping:
# GPIO00 ... Button BOOT
# GPIO01 ... [CC 13]
# GPIO02 ... [CC 15]
# GPIO03 ... [EC 09, DC 04 (TFT_RST)]
# GPIO04 ... SN74HC595 OE (only on board rev. 1.1) [EC 07]
# GPIO05 ... SN74HC595 Clock [CC 18]
# GPIO06 ... SN74HC595 Latch [CC 20]
# GPIO07 ... SN74HC595 Data
# GPIO08 ... [EC 10, DC 03 (TFT_CS)]
# GPIO09 ... [EC 11, DC 08 (TFT_BL)]
# GPIO10 ... [EC 14, DC 11 (TFT_TP_CS)]
# GPIO11 ... [EC 13, DC 06, DC 12 (TFT_MOSI)]
# GPIO12 ... [EC 16, DC 09, DC 13 (TFT_MISO)]
# GPIO13 ... [EC 15, DC 07, DC 10 (TFT_CLK)]
# GPIO14 ... [EC 18, DC 14 (TFT_TP_INT)]
# GPIO15 ... [EC 30]
# GPIO16 ... I2C SDA --> PCF8563 [EC 02, EC 24, CC 09]
# GPIO17 ... I2C SCL --> PCF8563 [EC 04, EC 26, CC 11]
# GPIO18 ... PCF8563 IRQ [EC 28]
# GPIO21 ... One-Wire --> DS18B20 (if connected to the board)
# GPIO38 ... [EC 21]
# GPIO45 ... [EC 29]
# GPIO46 ... [EC 12, DC 05 (TFT_DC)]
# GPIO47 ... [EC 19]
# GPIO48 ... [EC 27]
one_wire:
- platform: gpio
pin: GPIO21
i2c:
sda: GPIO16
scl: GPIO17
# Onboard RTC is PCF8563, IRQ is connected to GPIO18
time:
- platform: pcf8563
address: 0x51
id: time_onboard
update_interval: never
- platform: homeassistant
id: time_hass
on_time_sync:
then:
# update RTC after successful synchronization
- pcf8563.write_time: time_onboard
# Using green led to signal network status:
# Blinking = wifi connected
# Constantly on = api connected
interval:
- interval: 1s
then:
- if:
condition:
api.connected:
then:
- output.turn_on: out_led_green
else:
- if:
condition:
wifi.connected:
then:
- output.turn_on: out_led_green
- delay: 500ms
- output.turn_off: out_led_green
else:
- output.turn_off: out_led_green
sn74hc595:
- id: output_sr
data_pin: GPIO07
clock_pin: GPIO05
latch_pin: GPIO06
# Output enable is only on boards with rev. 1.1 connected to GPIO04 !
# oe_pin: GPIO04
sr_count: 1
switch:
- platform: gpio
name: "Relay CH1"
pin:
sn74hc595: output_sr
number: 0
inverted: false
mode: OUTPUT
- platform: gpio
name: "Relay CH2"
pin:
sn74hc595: output_sr
number: 1
inverted: false
mode: OUTPUT
- platform: gpio
name: "Relay CH3"
pin:
sn74hc595: output_sr
number: 2
inverted: false
mode: OUTPUT
- platform: gpio
name: "Relay CH4"
pin:
sn74hc595: output_sr
number: 3
inverted: false
mode: OUTPUT
- platform: gpio
name: "Relay CH5"
pin:
sn74hc595: output_sr
number: 4
inverted: false
mode: OUTPUT
- platform: gpio
name: "Relay CH6"
pin:
sn74hc595: output_sr
number: 5
inverted: false
mode: OUTPUT
output:
- platform: gpio
id: out_led_green
pin:
sn74hc595: output_sr
number: 6
inverted: false
mode: OUTPUT
# Red LED is used as status_led
# - platform: gpio
# id: out_led_red
# pin:
# sn74hc595: output_sr
# number: 7
# inverted: false
# mode: OUTPUT
light:
# Green LED is used as network status led --> interval
# - platform: binary
# name: LED green
# output: out_led_green
# Red LED is used as status_led
# - platform: binary
# name: LED red
# output: out_led_red
#Red LED is used as status LED
status_led:
pin:
sn74hc595: output_sr
number: 7
inverted: false
mode: OUTPUT
button:
- platform: restart
name: Restart
entity_category: diagnostic
sensor:
# Enable dallas_temp if DS18B20 is connected to the board
# - platform: dallas_temp
# name: Temperature
- platform: wifi_signal
name: 'WiFi Signal'
entity_category: diagnostic
- platform: uptime
name: 'Uptime'
entity_category: diagnostic
unit_of_measurement: s
binary_sensor:
- platform: gpio
name: "Boot Button"
pin:
number: GPIO00
inverted: true
text_sensor:
- platform: version
name: 'ESPHome Version'
entity_category: diagnostic
- platform: wifi_info
ip_address:
name: WiFi IP Address
entity_category: diagnostic
ssid:
name: WiFi SSID
entity_category: diagnostic
mac_address:
name: WiFi MAC Address
entity_category: diagnostic
dns_address:
name: WiFi DNS Address
entity_category: diagnostic