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

标题: ESPHome 2023.8.0更新支持 LD2410人体存在 [打印本页]

作者: 敬轩    时间: 2023-8-22 23:25
标题: ESPHome 2023.8.0更新支持 LD2410人体存在
本帖最后由 敬轩 于 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.
代码网址:https://esphome.io/components/sensor/ld2410.html?highlight=ld2410
该传感器允许您使用LD2410传感器执行不同的测量。ld2410


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

                                   
    登录/注册后可看大图


  1. number:
  2.   - platform: ld2410
  3.     timeout:
  4.       name: timeout
  5.     light_threshold:
  6.       name: light threshold
  7.     max_move_distance_gate:
  8.       name: max move distance gate
  9.     max_still_distance_gate:
  10.       name: max still distance gate
  11.     g0:
  12.       move_threshold:
  13.         name: g0 move threshold
  14.       still_threshold:
  15.         name: g0 still threshold
  16.     g1:
  17.       move_threshold:
  18.         name: g1 move threshold
  19.       still_threshold:
  20.         name: g1 still threshold
  21.     g2:
  22.       move_threshold:
  23.         name: g2 move threshold
  24.       still_threshold:
  25.         name: g2 still threshold
  26.     g3:
  27.       move_threshold:
  28.         name: g3 move threshold
  29.       still_threshold:
  30.         name: g3 still threshold
  31.     g4:
  32.       move_threshold:
  33.         name: g4 move threshold
  34.       still_threshold:
  35.         name: g4 still threshold
  36.     g5:
  37.       move_threshold:
  38.         name: g5 move threshold
  39.       still_threshold:
  40.         name: g5 still threshold
  41.     g6:
  42.       move_threshold:
  43.         name: g6 move threshold
  44.       still_threshold:
  45.         name: g6 still threshold
  46.     g7:
  47.       move_threshold:
  48.         name: g7 move threshold
  49.       still_threshold:
  50.         name: g7 still threshold
  51.     g8:
  52.       move_threshold:
  53.         name: g8 move threshold
  54.       still_threshold:
  55.         name: g8 still threshold
复制代码
  1. sensor:
  2.   - platform: ld2410
  3.     light:
  4.       name: light
  5.     moving_distance:
  6.       name : Moving Distance
  7.     still_distance:
  8.       name: Still Distance
  9.     moving_energy:
  10.       name: Move Energy
  11.     still_energy:
  12.       name: Still Energy
  13.     detection_distance:
  14.       name: Detection Distance
  15.     g0:
  16.       move_energy:
  17.         name: g0 move energy
  18.       still_energy:
  19.         name: g0 still energy
  20.     g1:
  21.       move_energy:
  22.         name: g1 move energy
  23.       still_energy:
  24.         name: g1 still energy
  25.     g2:
  26.       move_energy:
  27.         name: g2 move energy
  28.       still_energy:
  29.         name: g2 still energy
  30.     g3:
  31.       move_energy:
  32.         name: g3 move energy
  33.       still_energy:
  34.         name: g3 still energy
  35.     g4:
  36.       move_energy:
  37.         name: g4 move energy
  38.       still_energy:
  39.         name: g4 still energy
  40.     g5:
  41.       move_energy:
  42.         name: g5 move energy
  43.       still_energy:
  44.         name: g5 still energy
  45.     g6:
  46.       move_energy:
  47.         name: g6 move energy
  48.       still_energy:
  49.         name: g6 still energy
  50.     g7:
  51.       move_energy:
  52.         name: g7 move energy
  53.       still_energy:
  54.         name: g7 still energy
  55.     g8:
  56.       move_energy:
  57.         name: g8 move energy
  58.       still_energy:
  59.         name: g8 still energy
复制代码
esp8266 D1开发板简单实例
  1. esphome:
  2.   name: ld2410-d1
  3.   friendly_name: LD2410-D1

  4. esp8266:
  5.   board: esp01_1m

  6. # Enable logging
  7. logger:

  8. # Enable Home Assistant API
  9. api:
  10.   encryption:
  11.     key: "2YFuHY0XtEzld9q4WIcwkKRbGF2Tg15sR6ikHCA="

  12. ota:
  13.   password: "846afe79f95f0d951b42bd7c1f2b2d8c"

  14. # Example configuration entry
  15. mqtt:
  16.   broker: 192.168.2.1
  17.   username: mqtt
  18.   password: mqtt

  19. wifi:
  20.   ssid: "mqtt"
  21.   password: "mqtt"

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

  26. uart:
  27.   tx_pin: GPIO1   #使用D1 mini RX
  28.   rx_pin: GPIO3   #使用D1 mini TX
  29.   baud_rate: 256000
  30.   parity: NONE
  31.   stop_bits: 1
  32. # Example configuration entry
  33. ld2410:
  34. number:
  35.   - platform: ld2410
  36.     timeout:
  37.       name: timeout
  38.     light_threshold:
  39.       name: light threshold
  40.     max_move_distance_gate:
  41.       name: max move distance gate
  42.     max_still_distance_gate:
  43.       name: max still distance gate
  44.     g0:
  45.       move_threshold:
  46.         name: g0 move threshold
  47.       still_threshold:
  48.         name: g0 still threshold
  49.     g1:
  50.       move_threshold:
  51.         name: g1 move threshold
  52.       still_threshold:
  53.         name: g1 still threshold
  54.     g2:
  55.       move_threshold:
  56.         name: g2 move threshold
  57.       still_threshold:
  58.         name: g2 still threshold
  59.     g3:
  60.       move_threshold:
  61.         name: g3 move threshold
  62.       still_threshold:
  63.         name: g3 still threshold
  64.     g4:
  65.       move_threshold:
  66.         name: g4 move threshold
  67.       still_threshold:
  68.         name: g4 still threshold
  69.     g5:
  70.       move_threshold:
  71.         name: g5 move threshold
  72.       still_threshold:
  73.         name: g5 still threshold
  74.     g6:
  75.       move_threshold:
  76.         name: g6 move threshold
  77.       still_threshold:
  78.         name: g6 still threshold
  79.     g7:
  80.       move_threshold:
  81.         name: g7 move threshold
  82.       still_threshold:
  83.         name: g7 still threshold
  84.     g8:
  85.       move_threshold:
  86.         name: g8 move threshold
  87.       still_threshold:
  88.         name: g8 still threshold


  89. sensor:
  90.   - platform: ld2410
  91.     light:
  92.       name: light
  93.     moving_distance:
  94.       name : Moving Distance
  95.     still_distance:
  96.       name: Still Distance
  97.     moving_energy:
  98.       name: Move Energy
  99.     still_energy:
  100.       name: Still Energy
  101.     detection_distance:
  102.       name: Detection Distance
  103.     g0:
  104.       move_energy:
  105.         name: g0 move energy
  106.       still_energy:
  107.         name: g0 still energy
  108.     g1:
  109.       move_energy:
  110.         name: g1 move energy
  111.       still_energy:
  112.         name: g1 still energy
  113.     g2:
  114.       move_energy:
  115.         name: g2 move energy
  116.       still_energy:
  117.         name: g2 still energy
  118.     g3:
  119.       move_energy:
  120.         name: g3 move energy
  121.       still_energy:
  122.         name: g3 still energy
  123.     g4:
  124.       move_energy:
  125.         name: g4 move energy
  126.       still_energy:
  127.         name: g4 still energy
  128.     g5:
  129.       move_energy:
  130.         name: g5 move energy
  131.       still_energy:
  132.         name: g5 still energy
  133.     g6:
  134.       move_energy:
  135.         name: g6 move energy
  136.       still_energy:
  137.         name: g6 still energy
  138.     g7:
  139.       move_energy:
  140.         name: g7 move energy
  141.       still_energy:
  142.         name: g7 still energy
  143.     g8:
  144.       move_energy:
  145.         name: g8 move energy
  146.       still_energy:
  147.         name: g8 still energy

  148.   - platform: dht
  149.     pin: GPIO2   #使用D1 mini D4针脚
  150.     temperature:
  151.       name: "Living Room Temperature"
  152.     humidity:
  153.       name: "Living Room Humidity"
  154.     update_interval: 60s

  155. binary_sensor:
  156.   - platform: ld2410
  157.     has_target:
  158.       name: Presence
  159.     has_moving_target:
  160.       name: Moving Target
  161.     has_still_target:
  162.       name: Still Target
  163.     out_pin_presence_status:
  164.       name: out pin presence status
复制代码

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

作者: alabo    时间: 2023-8-23 08:37
太感谢了,正需要这个,用以前的配值文件最新版esphome报错
作者: silas3082    时间: 2023-8-23 09:10
感谢,回头试试
作者: silas3082    时间: 2023-8-23 11:37
本帖最后由 silas3082 于 2023-8-23 14:43 编辑

连接TX和RX,VCC和GND也需要连接吧?
请教大佬接入homeassistant之后,都显示未知是什么问题?

作者: 敬轩    时间: 2023-8-23 18:30
silas3082 发表于 2023-8-23 11:37
连接TX和RX,VCC和GND也需要连接吧?
请教大佬接入homeassistant之后,都显示未知是什么问题?
...

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

作者: silas3082    时间: 2023-8-23 18:32
敬轩 发表于 2023-8-23 18:30
vcc 你看下ld2140 是3.3v 还是 5V 有没接错 ,多刷一次覆盖一下呢,我 这个刷了后这几天观察 感觉有些不 ...

确实是5v,用他们海凌科调试的app各个参数没有问题,不行我也换一个板子试试
作者: silas3082    时间: 2023-8-23 19:36
silas3082 发表于 2023-8-23 18:32
确实是5v,用他们海凌科调试的app各个参数没有问题,不行我也换一个板子试试 ...

我换了nodemcu数据就出来没问题了
作者: sxrcm    时间: 2023-8-24 17:41
不好用,而且接uart口后,数据量剧增
作者: silas3082    时间: 2023-8-26 09:19
sxrcm 发表于 2023-8-24 17:41
不好用,而且接uart口后,数据量剧增

有数据了,但是存在状态时断时续的
作者: oulianxian    时间: 2023-8-27 17:31
看不懂怎么弄,大佬有没有适合新手的教程
作者: 敬轩    时间: 2023-8-28 12:35
本帖最后由 敬轩 于 2023-8-28 12:37 编辑
oulianxian 发表于 2023-8-27 17:31
看不懂怎么弄,大佬有没有适合新手的教程

https://blog.csdn.net/qq_31400983/article/details/129054636
这个写的比较详细,代码复制我的就可以了,端口换成你自己开发板的TX RX 端口,wifi 和 mqtt 修改成你自己的
作者: 敬轩    时间: 2023-8-28 14:09
oulianxian 发表于 2023-8-27 17:31
看不懂怎么弄,大佬有没有适合新手的教程

https://blog.csdn.net/qq_31400983/article/details/129054636
这是操作步骤
作者: oulianxian    时间: 2023-8-29 09:44
敬轩 发表于 2023-8-28 14:09
https://blog.csdn.net/qq_31400983/article/details/129054636
这是操作步骤

搞定了,不过接线有什么要求吗,我随便弄两个接口,接入tr等就能用了,贼奇怪
作者: zsxiaojz    时间: 2023-9-4 16:15
好像很复杂,新手没看明白。
作者: xiaoma5015369    时间: 2023-10-6 21:14
请问大佬,我用d1 mini,用ha的esphome编译好,数据一直是未知,怎么解决?谢谢
作者: 敬轩    时间: 2023-10-7 10:00
xiaoma5015369 发表于 2023-10-6 21:14
请问大佬,我用d1 mini,用ha的esphome编译好,数据一直是未知,怎么解决?谢谢 ...

电源 要接5V 的,tx rx交叉接线。上面代码就是D1的
可以网上搜索看视频,先生成一个模板,在模板中添加上面的代码
现在版本更新经常出问题,多刷几次固件
作者: mengzhucanyun    时间: 2023-10-13 16:32
问下大佬们,自己做传感器的话,电源和壳子是怎么解决的呢
作者: 敬轩    时间: 2023-10-26 17:17
mengzhucanyun 发表于 2023-10-13 16:32
问下大佬们,自己做传感器的话,电源和壳子是怎么解决的呢

我用的是买传感器厂家装模块的塑料盒,长度刚好,低功耗一般没安全隐患,

作者: tanbobo    时间: 2023-11-19 16:38
为什么 dht11 的温度传感器 没有数据 我的是d1 mini的板子 +5 接1号 中间接的GIO2 零线接零线
作者: tomsunday    时间: 2023-12-17 23:56
好好学习




欢迎光临 『瀚思彼岸』» 智能家居技术论坛 (https://bbs.hassbian.com/) Powered by Discuz! X3.5