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

 找回密码
 立即注册
123
返回列表 发新帖
楼主: HHHhhhH

[已解决] nodemcu+LD2410B制作人体存在传感器(新版配置文件)

[复制链接]

6

主题

138

帖子

1531

积分

金牌会员

Rank: 6Rank: 6

积分
1531
金钱
1393
HASS币
0
 楼主| 发表于 2023-10-27 19:10:39 | 显示全部楼层

看不到你传的图片,注意一下配置文件的定义RX引脚应该连接传感器的TX,我的配置文件你看一下
esphome:
  name: "ld2410-1"

esp8266:
  board: nodemcuv2

wifi:
  ssid: "H3"
  password: "31222.."
  manual_ip:
    static_ip: 192.168.0.131
    gateway: 192.168.0.1
    subnet: 255.255.255.0
  
  ap:
    ssid: "2410"
    password: "123456789"

captive_portal:

logger:
  baud_rate: 0

api:
  password: "123456789"
ota:
  password: "123456789"

uart:
  id: uart1
  tx_pin: GPIO1
  rx_pin: GPIO3
  baud_rate: 256000
  parity: NONE
  stop_bits: 1

ld2410:
  uart_id: uart1 #指定串口 就是上面uart设置的ID
  timeout: 10s #无人持续时间(秒),默认5秒,不宜设置的过小,以保证动态静态目标在短时间都丢失后给予一定的冗余
  max_move_distance : 6m #运动检测的最大距离 设置你想感应的范围
  max_still_distance: 6m #静态检测的最大距离 设置你想感应的范围
  g0_move_threshold: 40 # 动态感应门灵敏度,高于此值则触发 0米
  g0_still_threshold: 0 # 静态感应门灵敏度,高于此值则触发 0米
  g1_move_threshold: 30 # 0~0.75米
  g1_still_threshold: 0 # 0~0.75米
  g2_move_threshold: 10 # 0.75~1.5米
  g2_still_threshold: 10 # 0.75~1.5米
  g3_move_threshold: 10 # 1.5~2.25米
  g3_still_threshold: 10 # 1.5~2.25米
  g4_move_threshold: 20 # 2.25~3米
  g4_still_threshold: 35 # 2.25~3米
  g5_move_threshold: 15 # 3~3.75米
  g5_still_threshold: 60 # 3~3.75米 
  g6_move_threshold: 100 # 3.75~4.5米
  g6_still_threshold: 100 # 3.75~4.5米
  g7_move_threshold: 100 # 4.5~5.25米
  g7_still_threshold: 100 # 4.5~5.25米
  g8_move_threshold: 100 # 5.25~6米
  g8_still_threshold: 100 # 5.25~6米

sensor:
  - platform: ld2410
    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: ld2410
    has_target: # 静止或移动目标是否存在
      name: Presence
    has_moving_target: # 运动目标是否存在
      name: Moving Target
    has_still_target: # 静止目标是否存在
      name: Still Target
回复

使用道具 举报

0

主题

59

帖子

306

积分

中级会员

Rank: 3Rank: 3

积分
306
金钱
247
HASS币
0
发表于 2023-10-28 12:39:35 | 显示全部楼层
sorrypqa 发表于 2023-3-10 15:35
用uart是为了更多属性和设置

这个可以分享一下代码吗,下面4项参数不错。
回复

使用道具 举报

0

主题

59

帖子

306

积分

中级会员

Rank: 3Rank: 3

积分
306
金钱
247
HASS币
0
发表于 2023-10-28 12:56:24 | 显示全部楼层
这样提示是什么意思,跑码跑不出来。
QQ图片20231028125517.png
回复

使用道具 举报

6

主题

138

帖子

1531

积分

金牌会员

Rank: 6Rank: 6

积分
1531
金钱
1393
HASS币
0
 楼主| 发表于 2023-10-28 14:41:59 | 显示全部楼层
zsxiaojz 发表于 2023-10-28 12:56
这样提示是什么意思,跑码跑不出来。

配置文件有问题,检查配置,或者直接用我发的
回复

使用道具 举报

0

主题

59

帖子

306

积分

中级会员

Rank: 3Rank: 3

积分
306
金钱
247
HASS币
0
发表于 2023-10-29 21:55:16 | 显示全部楼层
HHHhhhH 发表于 2023-10-28 14:41
配置文件有问题,检查配置,或者直接用我发的

uart:
  id: uart1
  tx_pin: GPIO1
  rx_pin: GPIO3
  baud_rate: 256000
  parity: NONE
  stop_bits: 1
就是复制你的代码从上面那段开始到最后
回复

使用道具 举报

6

主题

138

帖子

1531

积分

金牌会员

Rank: 6Rank: 6

积分
1531
金钱
1393
HASS币
0
 楼主| 发表于 2023-10-30 16:41:36 | 显示全部楼层
zsxiaojz 发表于 2023-10-29 21:55
uart:
  id: uart1
  tx_pin: GPIO1

我用的设备是nodemcu,你的什么设备?
回复

使用道具 举报

0

主题

59

帖子

306

积分

中级会员

Rank: 3Rank: 3

积分
306
金钱
247
HASS币
0
发表于 2023-10-30 22:40:04 | 显示全部楼层
HHHhhhH 发表于 2023-10-30 16:41
我用的设备是nodemcu,你的什么设备?

nodemcu,d1,esp01s也是这个报错
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-5-3 16:20 , Processed in 0.520757 second(s), 29 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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