-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLD2410.yaml
348 lines (323 loc) · 7.65 KB
/
LD2410.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
dashboard_import:
package_import_url: github://MariuszWoszczynski/LD2410/LD2410.yaml@main
import_full_config: true
substitutions:
device_name: ld2410
friendly_name: LD2410
status_led: GPIO15
esphome:
name: '${device_name}'
project:
name: esphome.LD2410
version: "1.0"
esp32:
board: lolin_s2_mini
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "gkROOOAh0xAjCVobOvDVZfPfezQvMEaK9FT1UJEshVU="
ota:
- platform: esphome
password: "3e17e1c064adcb643234d5a49982329c"
time:
- platform: sntp
id: time_sntp
wifi:
ssid: "SSID"
password: "PASSWORD"
output_power: 18dB
# manual_ip:
# static_ip: 192.168.1.160
# gateway: 192.168.1.1
# subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "LD2410"
# password: "12345"
captive_portal:
#mqtt:
# broker: 10.10.10.10
# port: 1883
# username: username
# password: password
web_server:
version: 3
port: 80
# Status LED for connection
status_led:
pin:
# Blue LED
number: ${status_led}
uart:
tx_pin: GPIO16
rx_pin: GPIO17
baud_rate: 256000
parity: NONE
stop_bits: 1
ld2410:
id: ld2410_radar
#Configuration entities
number:
- platform: ld2410
timeout:
name: Radar Timeout
max_move_distance_gate:
name: Radar Max Move Distance
max_still_distance_gate:
name: Radar Max Still Distance
g0:
move_threshold:
name: g0 move threshold
still_threshold:
name: g0 still threshold
g1:
move_threshold:
name: g1 move threshold
still_threshold:
name: g1 still threshold
g2:
move_threshold:
name: g2 move threshold
still_threshold:
name: g2 still threshold
g3:
move_threshold:
name: g3 move threshold
still_threshold:
name: g3 still threshold
g4:
move_threshold:
name: g4 move threshold
still_threshold:
name: g4 still threshold
g5:
move_threshold:
name: g5 move threshold
still_threshold:
name: g5 still threshold
g6:
move_threshold:
name: g6 move threshold
still_threshold:
name: g6 still threshold
g7:
move_threshold:
name: g7 move threshold
still_threshold:
name: g7 still threshold
g8:
move_threshold:
name: g8 move threshold
still_threshold:
name: g8 still threshold
# Setting ending of zone 1 occupancy
- platform: template
name: "Radar End Zone 1"
id: radar_z1_end
device_class: distance
min_value: 0
max_value: 600
step: 1
mode: box
update_interval: never
optimistic: true
restore_value: true
initial_value: 10
icon: "mdi:arrow-collapse-right"
entity_category: CONFIG
# Setting ending of zone 2 occupancy
- platform: template
name: "Radar End Zone 2"
id: radar_z2_end
device_class: distance
min_value: 0
max_value: 600
step: 1
mode: box
update_interval: never
optimistic: true
restore_value: true
initial_value: 36
icon: "mdi:arrow-collapse-right"
entity_category: CONFIG
# Setting ending of zone 3 occupancy
- platform: template
name: "Radar End Zone 3"
id: radar_z3_end
device_class: distance
min_value: 0
max_value: 600
step: 1
mode: box
update_interval: never
optimistic: true
restore_value: true
initial_value: 100
icon: "mdi:arrow-collapse-right"
entity_category: CONFIG
#Occupancy sensor
binary_sensor:
- platform: ld2410
has_target:
name: Radar Target
id: radar_has_target
has_moving_target:
name: Radar Moving Target
has_still_target:
name: Radar Still Target
## Set Up Radar Zones Based On Distance
- platform: template
name: "Radar Zone 1 Occupancy"
device_class: occupancy
icon: mdi:motion-sensor
lambda: |-
if ((id(radar_has_target).state) && (id(radar_detection_distance).state < id(radar_z1_end).state)) {
return true;
} else {
return false;
}
- platform: template
name: "Radar Zone 2 Occupancy"
device_class: occupancy
icon: mdi:motion-sensor
lambda: |-
if ((id(radar_has_target).state) && ((id(radar_z1_end).state < id(radar_detection_distance).state) && (id(radar_detection_distance).state < id(radar_z2_end).state))) {
return true;
} else {
return false;
}
- platform: template
name: "Radar Zone 3 Occupancy"
device_class: occupancy
icon: mdi:motion-sensor
lambda: |-
if ((id(radar_has_target).state) && ((id(radar_z2_end).state < id(radar_detection_distance).state) && (id(radar_detection_distance).state < id(radar_z3_end).state))) {
return true;
} else {
return false;
}
#Exposes configuration and status sensors
sensor:
#Device UPTIME
- platform: uptime
name: Uptime
id: sys_uptime
update_interval: 60s
#Device CPU Speed
- platform: template
id: esp_memory
icon: mdi:memory
name: ESP Free Memory
lambda: return heap_caps_get_free_size(MALLOC_CAP_INTERNAL) / 1024;
unit_of_measurement: "kB"
state_class: measurement
entity_category: "diagnostic"
#Device Temperature
- platform: template
id: sys_esp_temperature
name: ESP Temperature
lambda: return temperatureRead();
unit_of_measurement: °C
device_class: TEMPERATURE
update_interval: 60s
#Device RSSI
- platform: wifi_signal
name: RSSI
id: wifi_signal_db
update_interval: 60s
entity_category: "diagnostic"
- platform: ld2410
moving_distance:
name: Radar Moving Distance
id: moving_distance
still_distance:
name: Radar Still Distance
id: still_distance
moving_energy:
name: Radar Move Energy
still_energy:
name: Radar Still Energy
detection_distance:
name: Radar Detection Distance
id: radar_detection_distance
g0:
move_energy:
name: g0 move energy
still_energy:
name: g0 still energy
g1:
move_energy:
name: g1 move energy
still_energy:
name: g1 still energy
g2:
move_energy:
name: g2 move energy
still_energy:
name: g2 still energy
g3:
move_energy:
name: g3 move energy
still_energy:
name: g3 still energy
g4:
move_energy:
name: g4 move energy
still_energy:
name: g4 still energy
g5:
move_energy:
name: g5 move energy
still_energy:
name: g5 still energy
g6:
move_energy:
name: g6 move energy
still_energy:
name: g6 still energy
g7:
move_energy:
name: g7 move energy
still_energy:
name: g7 still energy
g8:
move_energy:
name: g8 move energy
still_energy:
name: g8 still energy
#Exposes control buttons
button:
- platform: restart
icon: mdi:power-cycle
name: "ESP Reboot"
- platform: factory_reset
disabled_by_default: True
name: "Factory Reset ESP"
id: factory_reset_all
- platform: ld2410
factory_reset:
name: "Factory Reset Radar"
restart:
name: "Restart Radar"
query_params:
name: query params
#Exposes control switches
switch:
- platform: ld2410
bluetooth:
name: "Radar Control Bluetooth"
id: radar_bluetooth
engineering_mode:
name: "Radar Engineering Mode"
#Radar firmware version
text_sensor:
- platform: ld2410
version:
name: "Radar Firmware Version"
#Set distance resolution - 0.75m or 0.2m
select:
- platform: ld2410
distance_resolution:
name: "Radar Distance Resolution"