forked from miiky-ning/ESPHome-LD2410s
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hlkld2410s.yaml
103 lines (87 loc) · 2.11 KB
/
hlkld2410s.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
esphome:
name: hlkld2410s
friendly_name: hlkld2410s
includes:
- components/ld2410s_uart_mini.h
on_boot:
priority: 600
then:
- lambda: |-
auto uart_component = static_cast<LD2410S *>(ld2410s);
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "+22DOjWm0VId4sD1dIGLTPBe1vBn9Qn2nthBeXOZsQk="
ota:
- platform: esphome
password: "f9fe20c00bce9301e3bd38d27cf1a042"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Deepsleep2410S Fallback Hotspot"
captive_portal:
uart:
- id: uart_2410s
tx_pin: 25
rx_pin: 27
baud_rate: 115200
stop_bits: 1
deep_sleep:
sleep_duration:
minutes: 10
run_duration:
seconds: 10
wakeup_pin: 26
wakeup_pin_mode: KEEP_AWAKE
custom_component:
- lambda: |-
return {new LD2410S(id(uart_2410s))};
components:
- id: ld2410s
#binary_sensor:
# - platform: gpio
# pin: 33
# name: "people exist"
# device_class: motion
# sensor:
# - platform: template
# name: "Wakeup Cause"
# accuracy_decimals: 0
# lambda: return esp_sleep_get_wakeup_cause();
binary_sensor:
- platform: custom
lambda:
auto uart_component = static_cast<LD2410S *>(ld2410s);
return {uart_component->hasTarget,uart_component->lastCommandSuccess};
binary_sensors:
- name: "Has Target"
device_class: motion
- name: "Last Command Success"
sensor:
- platform: custom
lambda:
auto uart_component = static_cast<LD2410S *>(ld2410s);
return {uart_component->TargetDistance};
sensors:
- name: "Target Distance"
unit_of_measurement: "cm"
device_class: distance
- platform: template
name: "Wakeup Cause"
accuracy_decimals: 0
lambda: return esp_sleep_get_wakeup_cause();
text_sensor:
- platform: custom
lambda:
auto uart_component = static_cast<LD2410S *>(ld2410s);
return {uart_component->outputMode};
text_sensors:
- name: "output Mode"