-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathesphome-external-dual-uart.yml
282 lines (262 loc) · 6.94 KB
/
esphome-external-dual-uart.yml
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
substitutions:
name: "core300s-debug"
upper_name: Core 300s Debug
init: 'component_core300sUART::instance(id(uart_mcu2esp));'
esphome:
name: ${name}
includes:
- esphome-external-dual-uart.h
project:
name: "Levoit.Core300s"
version: "0.7.0"
esp32:
board: esp32dev
framework:
type: esp-idf
sdkconfig_options:
CONFIG_FREERTOS_UNICORE: y
logger:
baud_rate: 115200
# Enable Home Assistant API
api:
encryption:
key: "key"
ota:
password: !secret esp_home_ota_pw
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Optional manual IP
manual_ip:
static_ip: 192.168.0.195
gateway: 192.168.0.9
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
#ap:
# ssid: ${upper_name} Fallback Hotspot
# password: !secret esp_home_captive_pw
#captive_portal:
# Sync time with Home Assistant.
time:
- platform: homeassistant
id: homeassistant_time
uart:
- id: uart_mcu2esp
tx_pin:
number: GPIO17
inverted: false
rx_pin:
number: GPIO16
inverted: false
baud_rate: 115200
debug:
direction: BOTH
after:
timeout: 50ms
sequence:
- lambda: UARTDebug::log_hex(direction, bytes, ':');
custom_component:
- lambda: |-
auto c_core300_uart = ${init}
return {c_core300_uart};
sensor:
# Uptime sensor.
- platform: uptime
name: ${upper_name} Uptime
# WiFi Signal sensor.
- platform: wifi_signal
name: ${upper_name} WiFi Signal
update_interval: 60s
- platform: custom
lambda: |-
auto c_core300_uart = ${init}
return {
c_core300_uart->sensor_pm25,
c_core300_uart->sensor_roomSize
};
sensors:
- name: ${upper_name} PM25
accuracy_decimals: 1
icon: mdi:air-filter
unit_of_measurement: µg/m³
# filters:
# - throttle: 50s
# - median:
# window_size: 4
# send_every: 1
# send_first_at: 1
- name: ${upper_name} Room Size
accuracy_decimals: 0
icon: mdi:axis-arrow
# Text sensors with general information.
text_sensor:
# Expose WiFi information as sensors.
- platform: wifi_info
ip_address:
name: ${upper_name} IP
- platform: custom
lambda: |-
auto c_core300_uart = ${init}
return {
c_core300_uart->textsensor_fanSpeed,
c_core300_uart->textsensor_Power,
c_core300_uart->textsensor_FanMode,
c_core300_uart->textsensor_DisplayLit,
c_core300_uart->textsensor_DisplayLocked,
c_core300_uart->textsensor_FanAutoMode,
c_core300_uart->textsensor_mcuFW
};
text_sensors:
- name: ${upper_name} Fan Speed
icon: mdi:fan
- name: ${upper_name} Power
icon: mdi:power
- name: ${upper_name} FanMode
icon: mdi:fan
- name: ${upper_name} DisplayLit
icon: mdi:lightbulb-on-50
- name: ${upper_name} Display Locked
icon: mdi:lock
- name: ${upper_name} Fan Auto Mode
icon: mdi:fan-auto
- name: ${upper_name} FW
icon: mdi:select-inverse
entity_category: diagnostic
button:
#HA button to restart.
- platform: restart
name: ${upper_name} Restart
- platform: template
name: "Power On"
on_press:
lambda: |-
auto c_core300_uart = ${init}
c_core300_uart->power_on();
- platform: template
name: "Power Off"
on_press:
lambda: |-
auto c_core300_uart = ${init}
c_core300_uart->power_off();
- platform: template
name: "Set Fan Manual High"
on_press:
lambda: |-
auto c_core300_uart = ${init}
c_core300_uart->set_fan_manual_high();
- platform: template
name: "Set Fan Manual Medium"
on_press:
lambda: |-
auto c_core300_uart = ${init}
c_core300_uart->set_fan_manual_medium();
- platform: template
name: "Set Fan Manual Low"
on_press:
lambda: |-
auto c_core300_uart = ${init}
c_core300_uart->set_fan_manual_low();
- platform: template
name: "Set Fan Mode Manual"
on_press:
lambda: |-
auto c_core300_uart = ${init}
c_core300_uart->set_fan_mode_manual();
- platform: template
name: "Set Fan Mode Sleep"
on_press:
lambda: |-
auto c_core300_uart = ${init}
c_core300_uart->set_fan_mode_sleep();
- platform: template
name: "Set Fan Mode Auto"
on_press:
lambda: |-
auto c_core300_uart = ${init}
c_core300_uart->set_fan_mode_auto();
- platform: template
name: "Lock Display"
on_press:
lambda: |-
auto c_core300_uart = ${init}
c_core300_uart->lock_display();
- platform: template
name: "Unlock Display"
on_press:
lambda: |-
auto c_core300_uart = ${init}
c_core300_uart->unlock_display();
- platform: template
name: "Display On"
on_press:
lambda: |-
auto c_core300_uart = ${init}
c_core300_uart->display_on();
- platform: template
name: "Display Off"
on_press:
lambda: |-
auto c_core300_uart = ${init}
c_core300_uart->display_off();
- platform: template
name: "wifi_led_off"
on_press:
lambda: |-
auto c_core300_uart = ${init}
c_core300_uart->wifi_led_off();
- platform: template
name: "wifi_led_flash"
on_press:
lambda: |-
auto c_core300_uart = ${init}
c_core300_uart->wifi_led_flash();
- platform: template
name: "wifi_led_on"
on_press:
lambda: |-
auto c_core300_uart = ${init}
c_core300_uart->wifi_led_on();
- platform: template
name: "Filter Led On"
on_press:
lambda: |-
auto c_core300_uart = ${init}
c_core300_uart->filter_led_on();
- platform: template
name: "Filter Led Off"
on_press:
lambda: |-
auto c_core300_uart = ${init}
c_core300_uart->filter_led_off();
- platform: template
name: "Fan Auto PPM"
on_press:
lambda: |-
auto c_core300_uart = ${init}
c_core300_uart->set_fan_auto_ppm();
- platform: template
name: "Fan Auto PPM Quiet"
on_press:
lambda: |-
auto c_core300_uart = ${init}
c_core300_uart->set_fan_auto_ppmQuiet();
- platform: template
name: "Fan Auto RoomSize"
on_press:
lambda: |-
auto c_core300_uart = ${init}
c_core300_uart->set_fan_auto_area();
interval:
- interval: 1s
then:
if:
condition:
wifi.connected:
then:
- lambda: |-
auto c_core300_uart = ${init}
c_core300_uart->wifi_led_on();
else:
- lambda: |-
auto c_core300_uart = ${init}
c_core300_uart->wifi_led_off();