我也是这个硬件,代码发你 了。要修改api key和ota password
esphome:
name: d1minia
friendly_name: d1minia
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "Ts****************************"
on_client_connected:
- logger.log:
format: "Client %s connected to API with IP %s"
args: ["client_info.c_str()", "client_address.c_str()"]
on_client_disconnected:
- logger.log: "API client disconnected!"
ota:
password: "6a***************"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "D1Minia"
password: ""
captive_portal:
web_server:
port: 80
uart:
id: ld2410_uart
tx_pin: GPIO1
rx_pin: GPIO3
# baud_rate: 9600
baud_rate: 256000
parity: NONE
stop_bits: 1
ld2410:
uart_id: ld2410_uart #指定ld2410B使用的串口
switch:
- platform: ld2410
engineering_mode:
name: "engineering mode"
bluetooth:
name: "control bluetooth"
sensor:
- platform: uptime
id: uptime_s
update_interval: 5s
- platform: ld2410
light:
name: light
moving_distance:
name : Moving Distance
still_distance:
name: Still Distance
moving_energy:
name: Move Energy
still_energy:
name: Still Energy
detection_distance:
name: Detection Distance
binary_sensor:
- platform: status
name: "d1minia Status"
- platform: ld2410
has_target:
name: Occupancy
icon: mdi:home #自定义图标
has_moving_target:
name: Moving Target
has_still_target:
name: Still Target
out_pin_presence_status:
name: out pin presence status
number:
- platform: ld2410
timeout:
name: timeout
max_move_distance_gate:
name: max move distance gate
max_still_distance_gate:
name: max still distance gate
button:
- platform: ld2410
#海凌科2410c恢复出厂设置 factory_reset:
#海凌科2410c恢复出厂设置 name: "factory reset"
restart:
name: "restart"
query_params:
name: query params
text_sensor:
- platform: version
name: version
- platform: wifi_info
ip_address:
name: "d1minia ip"
icon: mdi:ip
ssid:
name: ssid
icon: mdi:wifi
- platform: template
name: "Uptime"
lambda: |-
int seconds = (id(uptime_s).state);
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
seconds = seconds % 3600;
int minutes = seconds / 60;
seconds = seconds % 60;
return { (String(days) +"d " + String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
icon: mdi:clock-start
update_interval: 5s
- platform: ld2410
version:
name: "hlk2410c version"
mac_address:
name: "hlk2410c mac"
select:
- platform: ld2410
distance_resolution:
name: "distance resolution"
|