-
Notifications
You must be signed in to change notification settings - Fork 0
/
ghtp.yaml
216 lines (188 loc) · 4.46 KB
/
ghtp.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
substitutions:
name: esphome-ghtp
friendly_name: ESP D1 Mini V3 USB-C
short_name: ESP Rez
core_name: $short_name Core
ld2410_name: $short_name mmWave
mq2_name: $short_name Gaz
dht22_name: $short_name H&T
comment: MQ2 Gaz - DHT22 T&H - HLK-LD2410C-P Presence & BLE
esphome:
name: ${name}
name_add_mac_suffix: false
friendly_name: ${friendly_name}
comment: ${comment}
on_boot:
- priority: 900.0
then:
- lambda: |-
id(cpu_speed) = ESP.getCpuFreqMHz();
# Define Card type
esp8266:
board: d1_mini
# Enable logging & ota
logger:
improv_serial:
ota:
- platform: esphome
# Enable Home Assistant API
api:
encryption:
key: "YOUR_KEY"
# Enable ESPHome Web
web_server:
local: true
# Define CPU Speed
globals:
- id: cpu_speed
type: int
restore_value: no
initial_value: "0"
# Define time & sync
time:
- platform: sntp
id: time_sntp
# Define HLK-LD2410C-P
uart:
id: ld2410_uart
tx_pin: TX
rx_pin: RX
baud_rate: 256000
parity: NONE
stop_bits: 1
ld2410:
uart_id: ld2410_uart
id: mmwave
# Binary sensors
binary_sensor:
# HLK-LD2410C-P data from OUT PIN on pin D1
- platform: gpio
pin: D1
name: "$ld2410_name Out Pin"
device_class: presence
# HLK-LD2410C-P data from UART
- platform: ld2410
has_target:
name: "$ld2410_name Presence"
has_moving_target:
name: "$ld2410_name Moving Target"
has_still_target:
name: "$ld2410_name Still Target"
# Exposes control switches
switch:
# HLK-LD2410C-P
- platform: ld2410
bluetooth:
name: "$ld2410_name Control bluetooth"
# Exposes control selection
select:
# HLK-LD2410C-P
- platform: ld2410
distance_resolution:
name: "$ld2410_name Distance resolution"
light_function:
name: "$ld2410_name Light function"
# Exposes control number
number:
# HLK-LD2410C-P
- platform: ld2410
timeout:
name: "$ld2410_name Timeout"
light_threshold:
name: "$ld2410_name Light threshold"
max_move_distance_gate:
name: "$ld2410_name Max move distance gate"
max_still_distance_gate:
name: "$ld2410_name Max still distance gate"
# Sensors
sensor:
# Reports the WiFi signal strength/RSSI in dB
- platform: wifi_signal
name: "$core_name WiFi Signal dB"
id: wifi_signal_db
update_interval: 60s
entity_category: "diagnostic"
# Reports the WiFi signal strength in %
- platform: copy
source_id: wifi_signal_db
name: "$core_name WiFi Signal"
filters:
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
unit_of_measurement: "%"
entity_category: "diagnostic"
device_class: ""
# Reports the uptime
- platform: uptime
name: "$core_name Uptime Sensor"
id: uptime_seconds
# Device CPU Speed
- platform: template
name: "$core_name Cpu Speed"
accuracy_decimals: 0
unit_of_measurement: Mhz
lambda: |-
return (id(cpu_speed));
entity_category: "diagnostic"
# MQ2 - Gaz Detector on pin A0
- platform: adc
pin: A0
name: "$mq2_name Smoke Sensor"
update_interval: 30s
filters:
- multiply: 100
unit_of_measurement: "%"
icon: "mdi:percent"
# DHT22 - Temp & Humidity on pin D0
- platform: dht
pin: D0
temperature:
name: "$dht22_name Temperature"
humidity:
name: "$dht22_name Humidity"
update_interval: 20s
# HLK-LD2410C-P
- platform: ld2410
light:
name: "$ld2410_name Light"
moving_distance:
name : "$ld2410_name Moving Distance"
still_distance:
name: "$ld2410_name Still Distance"
moving_energy:
name: "$ld2410_name Move Energy"
still_energy:
name: "$ld2410_name Still Energy"
detection_distance:
name: "$ld2410_name Detection Distance"
# Text Sensors
text_sensor:
# HLK-LD2410C-P
- platform: ld2410
version:
name: "$ld2410_name Firmware version"
mac_address:
name: "$ld2410_name MAC address"
# Exposes control buttons
button:
# ESP
- platform: restart
icon: mdi:power-cycle
name: "$core_name Reboot"
# HLK-LD2410C-P
- platform: ld2410
restart:
name: "$ld2410_name Restart"
# WiFi configuration
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Manual IP config - Remove for DHCP
manual_ip:
static_ip: 192.168.1.173
gateway: 192.168.1.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: ${name}
password: !secret wifi_ap_password
captive_portal: