forked from blakadder/esphome-configs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
athom_ps01.yaml
353 lines (319 loc) · 8.67 KB
/
athom_ps01.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
substitutions:
name: "athom-presence-sensor"
friendly_name: "presence sensor"
room: ""
device_description: "mmwave radar human presence sensor"
project_name: "Athom Technology.Presence Sensor"
project_version: "1.0-blak"
pir_delay_off: "5s" # set the PIR no occupancy delay here, it also influences delay for Occupancy sensor
esphome:
name: "${name}"
friendly_name: "${friendly_name}"
name_add_mac_suffix: true
project:
name: "${project_name}"
version: "${project_version}"
esp8266:
board: esp8285
restore_from_flash: True
logger:
api:
ota:
mdns:
disabled: false
web_server:
port: 80
wifi:
ap: {}
captive_portal:
dashboard_import:
package_import_url: github://blakadder/esphome-configs/athom_ps01.yaml
light:
- platform: status_led
name: "Status LED"
id: led
pin: GPIO16
disabled_by_default: true
entity_category: config
i2c:
sda: GPIO4
scl: GPIO5
scan: true
uart:
tx_pin: GPIO15
rx_pin: GPIO13
baud_rate: 115200
# debug:
# direction: BOTH
# dummy_receiver: true
# after:
# delimiter: "\n"
# sequence:
# - lambda: UARTDebug::log_string(direction, bytes);
binary_sensor:
- platform: status
name: "Status"
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: true
name: "Button"
disabled_by_default: true
internal: true
on_multi_click:
- timing:
- ON for at least 10s
then:
- button.press: factory_reset_device
- platform: gpio
pin:
number: GPIO14
mode:
input: true
pullup: true
name: "Pir Sensor"
id: pir
filters:
# - delayed_on: 50ms
# - delayed_off: 500ms
- delayed_off: ${pir_delay_off}
device_class: motion
# on_press:
# then:
# - light.turn_on: led
- platform: gpio
pin:
number: GPIO12
mode:
input: true
pullup: true
name: "mmWave Sensor"
id: mmwave
# filters:
# - delayed_on: 50ms
device_class: occupancy
# 2023-10-26 harryinet
# on_press:
# then:
# - light.turn_on: led
on_release:
then:
- light.turn_off: led
- platform: template
name: "Occupancy"
id: occupancy
device_class: occupancy
lambda: |-
if ( id(mmwave).state or id(pir).state) {
return true;
}
else if (id(mmwave).state == 0 and id(pir).state == 0) {
return false;
}
else {
return id(occupancy).state;
}
sensor:
- platform: uptime
name: "Uptime Sensor"
- platform: wifi_signal
name: "WiFi Signal Sensor"
update_interval: 60s
- platform: bh1750
name: "Light Sensor"
address: 0x23
update_interval: 5s
switch:
- platform: template
name: "mmWave Status"
id: "mmwave_sensor"
internal: true
entity_category: config
optimistic: true
restore_mode: DISABLED
turn_on_action:
- uart.write: "sensorStart\r\n"
turn_off_action:
- uart.write: "sensorStop\r\n"
number:
- platform: template
name: Farthest Detection #Value range: 1.9 ~ 12m Default: 6
id: Farthest_Detection
entity_category: config
min_value: 1.9
max_value: 12
initial_value: 6
optimistic: true
step: 0.1
restore_value: true
unit_of_measurement: m
mode: box
set_action:
- switch.turn_off: mmwave_sensor
- delay: 500ms
- uart.write: !lambda
std::string ranges = "setRange 1.8 " + str_sprintf("%.1f",id(Farthest_Detection).state) + "\r\n";
return std::vector<uint8_t>(ranges.begin(), ranges.end());
- delay: 500ms
- uart.write: "saveConfig\r\n"
- delay: 500ms
- switch.turn_on: mmwave_sensor
- platform: template
name: Maintain Sensitivity #Value range: 0 ~ 9 Default Maintain sensitivity: 7
id: Maintain_Sensitivity
entity_category: config
min_value: 0
max_value: 9
initial_value: 7
optimistic: true
step: 1
restore_value: true
mode: slider
set_action:
- switch.turn_off: mmwave_sensor
- delay: 500ms
- uart.write: !lambda
std::string sensitivitys = "setSensitivity " + str_sprintf("%.0f",id(Maintain_Sensitivity).state) + " " + str_sprintf("%.0f",id(Trigger_Sensitivity).state) + "\r\n";
return std::vector<uint8_t>(sensitivitys.begin(), sensitivitys.end());
- delay: 500ms
- uart.write: "saveConfig\r\n"
- delay: 500ms
- switch.turn_on: mmwave_sensor
- platform: template
name: Trigger Sensitivity #Value range: 0 ~ 9 Default Trigger sensitivity: 5
id: Trigger_Sensitivity
entity_category: config
min_value: 0
max_value: 9
initial_value: 5
optimistic: true
step: 1
restore_value: true
mode: slider
set_action:
- switch.turn_off: mmwave_sensor
- delay: 500ms
- uart.write: !lambda
std::string sensitivityss = "setSensitivity " + str_sprintf("%.0f",id(Maintain_Sensitivity).state) + " " + str_sprintf("%.0f",id(Trigger_Sensitivity).state) + "\r\n";
return std::vector<uint8_t>(sensitivityss.begin(), sensitivityss.end());
- delay: 500ms
- uart.write: "saveConfig\r\n"
- delay: 500ms
- switch.turn_on: mmwave_sensor
- platform: template
name: Detection Delay #Confirmation delay Value range: 0 ~ 100 default 0.050 seconds.
id: Detection_Delay
entity_category: config
min_value: 0.05
max_value: 60
initial_value: 0.05
optimistic: true
step: 0.05
mode: box
restore_value: true
unit_of_measurement: seconds
set_action:
- switch.turn_off: mmwave_sensor
- delay: 500ms
- uart.write: !lambda |-
std::string detections = "setLatency " + str_sprintf("%.1f",id(Detection_Delay).state) + " " + str_sprintf("%.0f",id(Fading_Time).state) + "\r\n";
return std::vector<uint8_t>(detections.begin(),detections.end());
- delay: 500ms
- uart.write: "saveConfig\r\n"
- delay: 500ms
- switch.turn_on: mmwave_sensor
- platform: template
name: Fading Time #Fade-out delay Value range: 0.5 ~ 1500, default 15 seconds.
id: Fading_Time
entity_category: config
min_value: 0.5
max_value: 300
initial_value: 15
optimistic: true
step: 0.5
restore_value: true
unit_of_measurement: seconds
mode: auto
set_action:
- switch.turn_off: mmwave_sensor
- delay: 500ms
- uart.write: !lambda |-
std::string fadings = "setLatency " + str_sprintf("%.1f",id(Detection_Delay).state) + " " + str_sprintf("%.0f",id(Fading_Time).state) + "\r\n";
return std::vector<uint8_t>(fadings.begin(), fadings.end());
- delay: 500ms
- uart.write: "saveConfig\r\n"
- delay: 500ms
- switch.turn_on: mmwave_sensor
- platform: template
name: Blockade Time #Configure block time Value range: 1 ~ 255, default 1 seconds.
id: Blockade_Time
entity_category: config
min_value: 1
max_value: 255
initial_value: 1
optimistic: true
step: 1
restore_value: true
unit_of_measurement: seconds
mode: box
set_action:
- switch.turn_off: mmwave_sensor
- delay: 500ms
- uart.write: !lambda
std::string blockades = "setInhibit " + str_sprintf("%.0f",x) + "\r\n";
return std::vector<uint8_t>(blockades.begin(), blockades.end());
- delay: 500ms
- uart.write: "saveConfig\r\n"
- delay: 500ms
- switch.turn_on: mmwave_sensor
button:
- platform: factory_reset
name: Restart with Factory Default Settings
id: Reset
entity_category: config
internal: true
- platform: template
name: "Reset device"
id: "factory_reset_device"
entity_category: config
internal: true
on_press:
- switch.turn_off: mmwave_sensor
- delay: 500ms
- uart.write: "resetCfg\r\n"
- delay: 1s
- switch.turn_on: mmwave_sensor
- button.press: Reset
- platform: restart
name: Restart_esp
id: restart_esp
entity_category: config
internal: true
- platform: template
name: "Restart_mmWave"
id: "restart_mmwave"
entity_category: config
internal: true
on_press:
- uart.write: "resetSystem\r\n"
- platform: template
name: Restart device
entity_category: config
on_press:
- button.press: restart_mmwave
- delay: 1s
- button.press: restart_esp
text_sensor:
- platform: wifi_info
ip_address:
name: "IP Address"
ssid:
name: "Connected SSID"
disabled_by_default: true
mac_address:
name: "Mac Address"
disabled_by_default: true
time:
- platform: sntp
id: my_time