『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 3715|回复: 19

[技术讨论] ESPHome 2023.8.0更新支持 LD2410人体存在

[复制链接]

6

主题

88

帖子

459

积分

中级会员

Rank: 3Rank: 3

积分
459
金钱
371
HASS币
0
发表于 2023-8-22 23:25:15 | 显示全部楼层 |阅读模式
本帖最后由 敬轩 于 2023-8-28 14:12 编辑

ESPHome 2023.8.0 - 16th August 2023LD2410
The LD2410 component has had a massive upgrade thanks to @regevbr! It now supports settings most if not all configuration parameters via switches / numbers and selects and exposes more data via various sensors. This includes breaking changes that mean the existing gate configuration options have been moved to the number platform.
该传感器允许您使用LD2410传感器执行不同的测量。ld2410


这下方便使用
为了校准您的传感器,请执行以下操作:ld2410
  • 启用工程模式
  • 监控gX_move_energy和gX_still_energy 传感器
  • 更改阈值并重复步骤 2,直到满意为止。
  • 禁用工程模式

                                   
    登录/注册后可看大图


number:
  - platform: ld2410
    timeout:
      name: timeout
    light_threshold:
      name: light threshold
    max_move_distance_gate:
      name: max move distance gate
    max_still_distance_gate:
      name: max still distance gate
    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
sensor:
  - 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
    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
esp8266 D1开发板简单实例
esphome:
  name: ld2410-d1
  friendly_name: LD2410-D1

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "2YFuHY0XtEzld9q4WIcwkKRbGF2Tg15sR6ikHCA="

ota:
  password: "846afe79f95f0d951b42bd7c1f2b2d8c"

# Example configuration entry
mqtt:
  broker: 192.168.2.1
  username: mqtt
  password: mqtt

wifi:
  ssid: "mqtt"
  password: "mqtt"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Ld2410-D1 Fallback Hotspot"
    password: "kp1KoFJe4QZO"

uart:
  tx_pin: GPIO1   #使用D1 mini RX
  rx_pin: GPIO3   #使用D1 mini TX
  baud_rate: 256000
  parity: NONE
  stop_bits: 1
# Example configuration entry
ld2410:
number:
  - platform: ld2410
    timeout:
      name: timeout
    light_threshold:
      name: light threshold
    max_move_distance_gate:
      name: max move distance gate
    max_still_distance_gate:
      name: max still distance gate
    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


sensor:
  - 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
    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

  - platform: dht
    pin: GPIO2   #使用D1 mini D4针脚
    temperature:
      name: "Living Room Temperature"
    humidity:
      name: "Living Room Humidity"
    update_interval: 60s

binary_sensor:
  - platform: ld2410
    has_target:
      name: Presence
    has_moving_target:
      name: Moving Target
    has_still_target:
      name: Still Target
    out_pin_presence_status:
      name: out pin presence status

学习摸索阶段不对之处还请指正
捕获.JPG
esphome的操作步骤这个写的详细;https://blog.csdn.net/qq_31400983/article/details/129054636

评分

参与人数 2金钱 +11 收起 理由
tomsunday + 1
隔壁的王叔叔 + 10

查看全部评分

回复

使用道具 举报

1

主题

27

帖子

1298

积分

金牌会员

Rank: 6Rank: 6

积分
1298
金钱
1271
HASS币
0
发表于 2023-8-23 08:37:21 | 显示全部楼层
太感谢了,正需要这个,用以前的配值文件最新版esphome报错
回复

使用道具 举报

73

主题

510

帖子

3091

积分

论坛元老

Rank: 8Rank: 8

积分
3091
金钱
2581
HASS币
0
发表于 2023-8-23 09:10:48 | 显示全部楼层
感谢,回头试试
回复

使用道具 举报

73

主题

510

帖子

3091

积分

论坛元老

Rank: 8Rank: 8

积分
3091
金钱
2581
HASS币
0
发表于 2023-8-23 11:37:10 | 显示全部楼层
本帖最后由 silas3082 于 2023-8-23 14:43 编辑

连接TX和RX,VCC和GND也需要连接吧?
请教大佬接入homeassistant之后,都显示未知是什么问题?
微信截图_20230823144156.png
微信截图_20230823144134.png
回复

使用道具 举报

6

主题

88

帖子

459

积分

中级会员

Rank: 3Rank: 3

积分
459
金钱
371
HASS币
0
 楼主| 发表于 2023-8-23 18:30:13 | 显示全部楼层
silas3082 发表于 2023-8-23 11:37
连接TX和RX,VCC和GND也需要连接吧?
请教大佬接入homeassistant之后,都显示未知是什么问题?
...

vcc 你看下ld2140 是3.3v 还是 5V 有没接错 ,多刷一次覆盖一下呢,我 这个刷了后这几天观察 感觉有些不稳定 经常掉线 ,我正在用esp32-c3合宙板尝试看稳定不。
回复

使用道具 举报

73

主题

510

帖子

3091

积分

论坛元老

Rank: 8Rank: 8

积分
3091
金钱
2581
HASS币
0
发表于 2023-8-23 18:32:47 | 显示全部楼层
敬轩 发表于 2023-8-23 18:30
vcc 你看下ld2140 是3.3v 还是 5V 有没接错 ,多刷一次覆盖一下呢,我 这个刷了后这几天观察 感觉有些不 ...

确实是5v,用他们海凌科调试的app各个参数没有问题,不行我也换一个板子试试
回复

使用道具 举报

73

主题

510

帖子

3091

积分

论坛元老

Rank: 8Rank: 8

积分
3091
金钱
2581
HASS币
0
发表于 2023-8-23 19:36:22 | 显示全部楼层
silas3082 发表于 2023-8-23 18:32
确实是5v,用他们海凌科调试的app各个参数没有问题,不行我也换一个板子试试 ...

我换了nodemcu数据就出来没问题了
回复

使用道具 举报

0

主题

210

帖子

2183

积分

金牌会员

Rank: 6Rank: 6

积分
2183
金钱
1973
HASS币
0
发表于 2023-8-24 17:41:38 | 显示全部楼层
不好用,而且接uart口后,数据量剧增
回复

使用道具 举报

73

主题

510

帖子

3091

积分

论坛元老

Rank: 8Rank: 8

积分
3091
金钱
2581
HASS币
0
发表于 2023-8-26 09:19:59 | 显示全部楼层
sxrcm 发表于 2023-8-24 17:41
不好用,而且接uart口后,数据量剧增

有数据了,但是存在状态时断时续的
回复

使用道具 举报

0

主题

68

帖子

1661

积分

金牌会员

Rank: 6Rank: 6

积分
1661
金钱
1593
HASS币
0
发表于 2023-8-27 17:31:09 | 显示全部楼层
看不懂怎么弄,大佬有没有适合新手的教程
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-4-29 11:45 , Processed in 0.065324 second(s), 35 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表