本帖最后由 yb997471 于 2025-5-18 22:33 编辑
完整代码,自己复制一份即可。
esphome:
name: weishengjian1-2410c
friendly_name: weishengjian1_2410c
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "2UU/ayxp7RWpUUlPiqOE+9PGPNXcKI="
ota:
- platform: esphome
password: "6ce8c4512ebe363d09f"
wifi:
ssid: ithome_2.4
password: 123456
# Optional manual IP
manual_ip:
static_ip: 192.168.0.231
gateway: 192.168.3.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "chufangld2410AP"
password: "12345678"
# prefix for Home Assistant entities --> CHANGE to our yown prefix
substitutions:
device_name: _
web_server:
port: 8080
captive_portal:
# UART for the LD2410 board --> CHANGE to your GPIO!!
uart:
#可以手动指定 UART 组件的 ID 使用
id: uart_bus
tx_pin:
number: GPIO1
rx_pin:
number: GPIO3
baud_rate: 256000
parity: NONE
stop_bits: 1
ld2410:
switch:
#该开关允许您控制 LD2410 传感器
- platform: ld2410
engineering_mode:
#启用/禁用工程模式
name: ${device_name}engineering_mode
bluetooth:
#打开/关闭蓝牙适配器
name: ${device_name}control_bluetooth
button:
- platform: restart
#单独
name: ${device_name}restart_device
- platform: ld2410
factory_reset:
#此命令用于将所有配置值还原为其原始值
name: ${device_name}factory_reset
restart:
#重启设备
name: ${device_name}restart
query_params:
#刷新设备的所有传感器值
name: ${device_name}query_params
#该传感器允许您使用 LD2410 传感器执行不同的 测量。
sensor:
- platform: ld2410
light:
#可选,int):在工程模式下,表示光敏度,否则。 介于 和 包含之间的值。尽管该值似乎是完全黑暗时的最低值
name: ${device_name}light_sensitivity
moving_distance:
#检测到的移动目标的距离(以厘米为单位)
name : ${device_name}moving_distance
still_distance:
#检测到的静止目标的距离(以厘米为单位)
name: ${device_name}still_distance
moving_energy:
#移动目标的能量。 介于 和 包含之间的值
name: ${device_name}moving_energy
still_energy:
#静止目标的能量。 介于 和 包含之间的值
name: ${device_name}still_energy
detection_distance:
#距离目标的距离(以厘米为单位)
name: ${device_name}detection_distance
g0:
#第 X 个门的能量 门的移动能量&门的静止能量
move_energy:
name: ${device_name}g0_move_energy
still_energy:
name: ${device_name}g0_still_energy
g1:
move_energy:
name: ${device_name}g1_move_energy
still_energy:
name: ${device_name}g1_still_energy
g2:
move_energy:
name: ${device_name}g2_move_energy
still_energy:
name: ${device_name}g2_still_energy
g3:
move_energy:
name: ${device_name}g3_move_energy
still_energy:
name: ${device_name}g3_still_energy
g4:
move_energy:
name: ${device_name}g4_move_energy
still_energy:
name: ${device_name}g4_still_energy
g5:
move_energy:
name: ${device_name}g5_move_energy
still_energy:
name: ${device_name}g5_still_energy
g6:
move_energy:
name: ${device_name}g6_move_energy
still_energy:
name: ${device_name}g6_still_energy
g7:
move_energy:
name: ${device_name}g7_move_energy
still_energy:
name: ${device_name}g7_still_energy
g8:
move_energy:
name: ${device_name}g8_move_energy
still_energy:
name: ${device_name}g8_still_energy
binary_sensor:
- platform: ld2410
has_target:
#如果为 true,则目标检测到静止或移动
name: ${device_name}presence
has_moving_target:
#如果为 true,则检测到移动目标
name: ${device_name}moving_target
has_still_target:
#如果为 true,则检测到静止目标
name: ${device_name}still_target
out_pin_presence_status:
#当处于工程模式时,指示 OUT 引脚是否指示存在,否则。 OUT 引脚指示取决于光功能配置
name: ${device_name}engineering_occupancy
# LD2410 PINOUT GPIO --> CHANGE to your own GPIO!!
- platform: gpio
pin: GPIO5
name: ${device_name}occupancy
device_class: presence
number:
- platform: ld2410
timeout:
#状态保持存在的时间(以秒为单位) 离开后
name: ${device_name}timeout
light_threshold:
#设置 light 函数的 light 阈值
name: ${device_name}light_threshold
max_move_distance_gate:
#:用于移动检测的最大距离门
name: ${device_name}max_move_distance_gate
max_still_distance_gate:
#用于静止检测的最大距离门
name: ${device_name}max_still_distance_gate
g0:
#第 X 个门的阈值
move_threshold:
#运动检测门的阈值。 对于所考虑的门 (距离) ,高于此级别,将触发移动检测
name: ${device_name}g0_move_threshold
still_threshold:
#用于静止检测的门阈值。 对于所考虑的门 (距离) ,高于此水平时,仍将触发检测
name: ${device_name}g0_still_threshold
g1:
move_threshold:
name: ${device_name}g1_move_threshold
still_threshold:
name: ${device_name}g1_still_threshold
g2:
move_threshold:
name: ${device_name}g2_move_threshold
still_threshold:
name: ${device_name}g2_still_threshold
g3:
move_threshold:
name: ${device_name}g3_move_threshold
still_threshold:
name: ${device_name}g3_still_threshold
g4:
move_threshold:
name: ${device_name}g4_move_threshold
still_threshold:
name: ${device_name}g4_still_threshold
g5:
move_threshold:
name: ${device_name}g5_move_threshold
still_threshold:
name: ${device_name}g5_still_threshold
g6:
move_threshold:
name: ${device_name}g6_move_threshold
still_threshold:
name: ${device_name}g6_still_threshold
g7:
move_threshold:
name: ${device_name}g7_move_threshold
still_threshold:
name: ${device_name}g7_still_threshold
g8:
move_threshold:
name: ${device_name}g8_move_threshold
still_threshold:
name: ${device_name}g8_still_threshold
select:
- platform: ld2410
distance_resolution:
#控制浇口距离分辨率
name: ${device_name}distance_resolution
light_function:
#如果设置,将根据光阈值影响 OUT 引脚值
name: ${device_name}ligh_function
out_pin_level:
#控制 OUT 引脚值
name: ${device_name}out_pin_level
|