-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathm5stack-stamplc.yaml
More file actions
350 lines (328 loc) · 6.6 KB
/
m5stack-stamplc.yaml
File metadata and controls
350 lines (328 loc) · 6.6 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
esphome:
name: m5plc
friendly_name: m5plc
build_path: /config/esphome/m5plcbuild
on_boot:
priority: 1000 #aw9523 and pi4ioe5v6408 need GPIO3 high to work.
then:
- lambda: |-
gpio_set_direction(GPIO_NUM_3, GPIO_MODE_OUTPUT);
gpio_set_level(GPIO_NUM_3, 1);
esp32:
board: esp32-s3-devkitc-1
framework:
type: esp-idf
logger:
level: DEBUG
baud_rate: 0
logs:
api.service: WARN
wifi: WARN
esp-idf: NONE
api:
encryption:
key: !secret api_key
reboot_timeout: 6h
actions:
- action: rtttl_play
variables:
song_str: string
then:
- rtttl.play:
rtttl: !lambda 'return song_str;'
ota:
- platform: esphome
#password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
reboot_timeout: 6h
#power_save_mode: LIGHT
external_components:
- source: github://patrick3399/esphome_components
# - source: github://n-serrette/esphome_sd_card #If need SD Card Support
uart:
- id: uart_485 #StamPLC RS485
tx_pin: GPIO0
rx_pin: GPIO39
# RS485_DIR GPIO46
baud_rate: 9600
- id: uart_can #StamPLC CAN
tx_pin: GPIO42
rx_pin: GPIO43
baud_rate: 9600
spi:
- id: spi_bus0
clk_pin: GPIO7
mosi_pin: GPIO8
interface: hardware
i2c:
id: main_i2c
sda: GPIO13
scl: GPIO15
scan: False
frequency: 200kHz
aw9523:
id: aw9523_hub
address: 0x59
update_interval: 0ms
i2c_id: main_i2c
pi4ioe5v6408:
id: pi4ioe5v6408_hub
address: 0x43
update_interval: 0ms
i2c_id: main_i2c
# sd_mmc_card: #If need SD Card Support
# id: micro_sd
# mode_1bit: true
# clk_pin: GPIO7
# cmd_pin: GPIO8
# data0_pin: GPIO9
# data3_pin: GPIO10
# sd_file_server: #If need SD Card Support
# id: file_server
# url_prefix: file
# root_path: "/"
# enable_deletion: true
# enable_download: true
# enable_upload: true
binary_sensor:
- platform: gpio
name: "IN1"
pin:
aw9523: aw9523_hub
number: 4
mode:
input: true
inverted: false
- platform: gpio
name: "IN2"
pin:
aw9523: aw9523_hub
number: 5
mode:
input: true
inverted: false
- platform: gpio
name: "IN3"
pin:
aw9523: aw9523_hub
number: 6
mode:
input: true
inverted: false
- platform: gpio
name: "IN4"
pin:
aw9523: aw9523_hub
number: 7
mode:
input: true
inverted: false
- platform: gpio
name: "IN5"
pin:
aw9523: aw9523_hub
number: 12
mode:
input: true
inverted: false
- platform: gpio
name: "IN6"
pin:
aw9523: aw9523_hub
number: 13
mode:
input: true
inverted: false
- platform: gpio
name: "IN7"
pin:
aw9523: aw9523_hub
number: 14
mode:
input: true
inverted: false
- platform: gpio
name: "IN8"
pin:
aw9523: aw9523_hub
number: 15
mode:
input: true
inverted: false
- platform: gpio
name: "Button C"
pin:
pi4ioe5v6408: pi4ioe5v6408_hub
number: 0
mode:
input: true
inverted: true
- platform: gpio
name: "Button B"
pin:
pi4ioe5v6408: pi4ioe5v6408_hub
number: 1
mode:
input: true
inverted: true
- platform: gpio
name: "Button A"
pin:
pi4ioe5v6408: pi4ioe5v6408_hub
number: 2
mode:
input: true
inverted: true
switch:
- platform: gpio
name: "Relay 1"
pin:
aw9523: aw9523_hub
number: 0
mode:
output: true
inverted: false
- platform: gpio
name: "Relay 2"
pin:
aw9523: aw9523_hub
number: 1
mode:
output: true
inverted: false
- platform: gpio
name: "Relay 3"
pin:
aw9523: aw9523_hub
number: 2
mode:
output: true
inverted: false
- platform: gpio
name: "Relay 4"
pin:
aw9523: aw9523_hub
number: 3
mode:
output: true
inverted: false
- platform: gpio
name: "LED Blue"
pin:
pi4ioe5v6408: pi4ioe5v6408_hub
number: 4
mode:
output: true
inverted: true
- platform: gpio
name: "LED Green"
pin:
pi4ioe5v6408: pi4ioe5v6408_hub
number: 5
mode:
output: true
inverted: true
- platform: gpio
name: "LED Red"
pin:
pi4ioe5v6408: pi4ioe5v6408_hub
number: 6
mode:
output: true
inverted: true
- platform: gpio
name: "Screen Backlight"
restore_mode: ALWAYS_ON
pin:
pi4ioe5v6408: pi4ioe5v6408_hub
number: 7
mode:
output: true
inverted: True
sensor:
- platform: lm75
id: temperature
name: "Board Temp"
update_interval: 60s
address: 0x48
i2c_id: main_i2c
- platform: internal_temperature
name: "Chip Temp"
- platform: ina226
address: 0x40
i2c_id: main_i2c
shunt_resistance: 0.1 ohm
max_current: 3.2A
adc_time: 140us
adc_averaging: 128
update_interval: 60s
current:
name: "INA226 Current"
power:
name: "INA226 Power"
bus_voltage:
name: "INA226 Bus Voltage"
shunt_voltage:
name: "INA226 Shunt Voltage"
# - platform: sd_mmc_card #If need SD Card Support
# type: used_space
# name: "SD card used space"
# - platform: sd_mmc_card
# type: total_space
# name: "SD card total space"
# text_sensor:
# - platform: sd_mmc_card #If need SD Card Support
# sd_card_type:
# name: "SD card type"
time:
- platform: homeassistant
id: homeassistant_time
update_interval: 1h
on_time_sync:
then:
rx8130ce.write_time:
id: rx8130ce_rtc
- platform: rx8130ce
id: rx8130ce_rtc
address: 0x32
update_interval: never
display:
- platform: st7789v
model: TTGO_TDISPLAY_135X240
offset_height: 52
offset_width: 40
rotation: 90
cs_pin: GPIO12
dc_pin: GPIO6
reset_pin: GPIO36 #Set Reset Pin at Unuseable Pin.
data_rate: 40MHz
update_interval: 30s
lambda: |-
it.line(3, 0, 239, 0);
it.line(239, 0, 239, 134);
it.line(3, 0, 3, 134);
it.line(3, 134, 239, 134);
it.print(121, 66, id(Roboto24), TextAlign::CENTER, id(DisplayText).state.c_str());
font:
- file: "gfonts://Roboto"
id: Roboto24
size: 24
text:
- platform: template
name: "Display TEXT"
id: DisplayText
optimistic: true
min_length: 0
max_length: 26
initial_value: 'Default TEXT'
mode: text
output:
- platform: ledc
id: rtttl_pin
pin: 44
rtttl:
output: rtttl_pin
id: rtttl_buzz
gain: 60%