forked from EverythingSmartHome/everything-presence-one
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheverything-presence-one.yaml
481 lines (453 loc) · 11.5 KB
/
everything-presence-one.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
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
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
substitutions:
name: "ep1-office"
room: "Office"
friendly_name: "Everything Presence One"
project_name: "Everything Smart Technology.Everything Presence One"
project_version: "1.1.4-custom"
temperature_offset: "-4"
humidity_offset: "5"
temperature_update_interval: "60s"
illuminance_update_interval: "30s"
pir_delay_off: "10s"
occupancy_delay_off: "15s"
hidden_ssid: "false"
factory_reset_disabled: "true"
uart_target_output_disabled: "false"
uart_presence_output_disabled: "true"
esphome:
name: "${name}"
name_add_mac_suffix: false
project:
name: "${project_name}"
version: "${project_version}"
includes:
- SEN0395_distance.h
esp32:
board: esp32dev
# framework:
# type: esp-idf
logger:
api:
encryption:
key: !secret encryptionkey
ota:
web_server:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
captive_portal:
improv_serial:
#esp32_improv:
# authorizer: none
#esp32_ble_tracker:
# scan_parameters:
# interval: 1100ms
# window: 1100ms
# active: true
#bluetooth_proxy:
# active: true
dashboard_import:
package_import_url: github://BradleyFord/everything-presence-one/everything-presence-one.yaml@main
import_full_config: false
light:
- platform: status_led
name: "ESP32 Status LED"
pin: GPIO32
entity_category: config
i2c:
- id: bus_a
sda: 26
scl: 25
scan: true
- id: bus_b
sda: 23
scl: 22
scan: true
sensor:
- platform: shtcx
temperature:
name: "${room} Temperature"
id: temperature
filters:
offset: ${temperature_offset}
humidity:
name: "${room} Humidity"
id: humidity
filters:
offset: ${humidity_offset}
i2c_id: bus_a
address: 0x70
update_interval: ${temperature_update_interval}
- platform: bh1750
name: "${room} Illuminance"
i2c_id: bus_a
address: 0x23
update_interval: ${illuminance_update_interval}
- platform: template
name: Target Distance m
id: target_distance_m # do not change
accuracy_decimals: 1
- platform: sgp30
eco2:
name: "${room} eCO2"
accuracy_decimals: 1
tvoc:
name: "${room} TVOC"
accuracy_decimals: 1
filters:
- lambda: return x * 2.3; #ppd -> μg/m³
# - exponential_moving_average:
# alpha: 0.1
# send_every: 10
# send_first_at: 1
unit_of_measurement: "μg/m³"
store_baseline: yes
i2c_id: bus_b
address: 0x58
update_interval: 10s
compensation:
temperature_source: temperature
humidity_source: humidity
baseline:
eco2_baseline: 0x98FC
tvoc_baseline: 0x91AE
- platform: senseair
co2:
name: "${room} CO2"
update_interval: 60s
uart_id: uart_bus2
id: senseairid
binary_sensor:
- platform: gpio
name: ${room} mmWave
id: mmwave
device_class: occupancy
pin:
number: GPIO15
mode: INPUT_PULLDOWN
- platform: gpio
pin:
number: 33
mode: INPUT_PULLDOWN
name: ${room} PIR
id: pir_motion_sensor
device_class: motion
filters:
- delayed_off: ${pir_delay_off}
- platform: template
name: ${room} Occupancy
id: occupancy
device_class: occupancy
filters:
- delayed_off: ${occupancy_delay_off}
lambda: |-
if ( id(mmwave).state or id(pir_motion_sensor).state) {
return true;
}
else if (id(mmwave).state == 0 and id(pir_motion_sensor).state == 0) {
return false;
}
else {
return id(occupancy).state;
}
uart:
- id: uart_bus
tx_pin: GPIO13
rx_pin: GPIO14
baud_rate: 115200
debug:
direction: BOTH
dummy_receiver: true
after:
delimiter: "\n"
sequence:
- lambda: UARTDebug::log_string(direction, bytes);
- id: uart_bus2
rx_pin: GPIO18
tx_pin: GPIO19
baud_rate: 9600
switch:
- platform: template
name: "mmWave Sensor"
id: "mmwave_sensor"
entity_category: config
optimistic: true
restore_state: true
turn_on_action:
- uart.write:
id: uart_bus
data: "sensorStart"
- delay: 1s
turn_off_action:
- uart.write:
id: uart_bus
data: "sensorStop"
- delay: 1s
- platform: template
name: "mmWave LED"
id: "mmwave_led"
entity_category: config
optimistic: true
restore_state: true
turn_on_action:
- switch.turn_off: mmwave_sensor
- delay: 1s
- uart.write:
id: uart_bus
data: "setLedMode 1 0"
- delay: 1s
- uart.write:
id: uart_bus
data: "saveConfig"
- delay: 3s
- switch.turn_on: mmwave_sensor
turn_off_action:
- switch.turn_off: mmwave_sensor
- delay: 1s
- uart.write:
id: uart_bus
data: "setLedMode 1 1"
- delay: 1s
- uart.write:
id: uart_bus
data: "saveConfig"
- delay: 3s
- switch.turn_on: mmwave_sensor
- platform: template
name: "uart_presence_output"
id: "uart_presence_output"
entity_category: config
internal: ${uart_presence_output_disabled}
optimistic: true
restore_state: true
turn_on_action:
- switch.turn_off: mmwave_sensor
- delay: 1s
- uart.write:
id: uart_bus
data: "setUartOutput 1 1"
- delay: 1s
- uart.write:
id: uart_bus
data: "saveConfig"
- delay: 3s
- switch.turn_on: mmwave_sensor
turn_off_action:
- switch.turn_off: mmwave_sensor
- delay: 1s
- uart.write:
id: uart_bus
data: "setUartOutput 1 0"
- delay: 1s
- uart.write:
id: uart_bus
data: "saveConfig"
- delay: 3s
- switch.turn_on: mmwave_sensor
- platform: template
name: "uart_target_output"
id: "uart_target_output"
entity_category: config
internal: ${uart_target_output_disabled}
optimistic: true
restore_state: true
assumed_state: false
turn_on_action:
- switch.turn_off: mmwave_sensor
- delay: 1s
- uart.write:
id: uart_bus
data: "setUartOutput 2 1 1 1"
- delay: 1s
- uart.write:
id: uart_bus
data: "saveConfig"
- delay: 3s
- switch.turn_on: mmwave_sensor
turn_off_action:
- switch.turn_off: mmwave_sensor
- delay: 1s
- uart.write:
id: uart_bus
data: "setUartOutput 2 0"
- delay: 1s
- uart.write:
id: uart_bus
data: "saveConfig"
- delay: 3s
- switch.turn_on: mmwave_sensor
- platform: template
name: "CO2 ABC Enable"
id: "abc_enable"
icon: "mdi:auto-fix"
entity_category: config
optimistic: true
assumed_state: true
turn_on_action:
- senseair.abc_get_period: senseairid
- senseair.abc_enable: senseairid
turn_off_action:
- senseair.abc_get_period: senseairid
- senseair.abc_disable: senseairid
number:
- platform: template
name: mmWave Distance
icon: mdi:arrow-left-right
id: mmwave_distance
entity_category: config
min_value: 0
max_value: 800
initial_value: 315
optimistic: true
step: 15
restore_value: true
unit_of_measurement: cm
mode: slider
set_action:
- switch.turn_off: mmwave_sensor
- delay: 1s
- uart.write:
id: uart_bus
data: !lambda int cm = (int)ceil(x / 15.0);
std::string cms = "detRangeCfg -1 0 " + to_string(cm);
return std::vector<unsigned char>(cms.begin(), cms.end());
- delay: 1s
- uart.write:
id: uart_bus
data: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89"
- delay: 1s
- switch.turn_on: mmwave_sensor
- platform: template
name: mmWave Off Latency
icon: mdi:clock-end
id: mmwave_off_latency
entity_category: config
min_value: 1
max_value: 60
initial_value: 15
optimistic: true
step: 1
restore_value: true
unit_of_measurement: seconds
mode: slider
set_action:
- switch.turn_off: mmwave_sensor
- delay: 1s
- uart.write:
id: uart_bus
data: !lambda |-
std::string mss = "setLatency " + to_string(id(mmwave_on_latency).state) + " " + to_string(id(mmwave_off_latency).state);
return std::vector<unsigned char>(mss.begin(), mss.end());
- delay: 1s
- uart.write:
id: uart_bus
data: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89"
- delay: 1s
- switch.turn_on: mmwave_sensor
- platform: template
name: mmWave On Latency
icon: mdi:clock-start
id: mmwave_on_latency
entity_category: config
min_value: 0
max_value: 60
initial_value: 0
optimistic: true
step: 0.5
restore_value: true
unit_of_measurement: seconds
mode: slider
set_action:
- switch.turn_off: mmwave_sensor
- delay: 1s
- uart.write:
id: uart_bus
data: !lambda |-
std::string mss = "setLatency " + to_string(id(mmwave_on_latency).state) + " " + to_string(id(mmwave_off_latency).state);
return std::vector<unsigned char>(mss.begin(), mss.end());
- delay: 1s
- uart.write:
id: uart_bus
data: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89"
- delay: 1s
- switch.turn_on: mmwave_sensor
- platform: template
name: mmWave Sensitivity
icon: mdi:target-variant
id: mmwave_sensitivity
entity_category: config
min_value: 0
max_value: 9
initial_value: 7
optimistic: true
step: 1
restore_value: true
set_action:
- switch.turn_off: mmwave_sensor
- delay: 1s
- uart.write:
id: uart_bus
data: !lambda std::string mss = "setSensitivity " + to_string((int)x);
return std::vector<unsigned char>(mss.begin(), mss.end());
- delay: 1s
- uart.write:
id: uart_bus
data: "saveConfig"
- delay: 1s
- switch.turn_on: mmwave_sensor
button:
- platform: restart
name: Restart_internal
id: restart_internal
entity_category: config
internal: true
- platform: template
name: "Restart mmWave Sensor"
id: "restart_mmwave"
entity_category: config
internal: true
on_press:
- uart.write:
id: uart_bus
data: "resetSystem"
- platform: template
name: Restart $name
icon: mdi:restart
entity_category: config
on_press:
- button.press: restart_mmwave
- button.press: restart_internal
- platform: safe_mode
internal: false
name: $name Safe Mode
entity_category: config
- platform: template
name: "Factory Reset mmWave"
icon: mdi:cog-counterclockwise
id: "factory_reset_mmwave"
internal: ${factory_reset_disabled}
entity_category: config
on_press:
- switch.turn_off: mmwave_sensor
- delay: 1s
- uart.write:
id: uart_bus
data: "resetCfg"
- delay: 3s
- switch.turn_on: mmwave_sensor
- platform: template
name: "Senseair Background Calibration"
id: "senseair_background_calibration"
icon: "mdi:tune-variant"
# internal:
entity_category: config
on_press:
then:
- senseair.background_calibration: senseairid
- delay: 3s
- senseair.background_calibration_result: senseairid
- senseair.abc_get_period: senseairid
custom_component:
- lambda: |-
auto my_custom = new Sen0395Distance(id(uart_bus));
return {my_custom};