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

 找回密码
 立即注册
查看: 246|回复: 5

[求助] 求助8266+2410b离网自动运行

[复制链接]

1

主题

3

帖子

28

积分

新手上路

Rank: 1

积分
28
金钱
25
HASS币
0
发表于 2024-3-17 22:59:27 | 显示全部楼层 |阅读模式
HASS新手,不会编程,想着跟坛子里的大佬们学一些智能家居类知识
手上买了D1mini+LD2410B+5v继电器,想给老家的房子过道里弄一个自动感应开关灯,顺便学习一下相关知识
我的想法是,让D1mini每5分钟判断一次是否连接了HA,如果连接了ha,那么由ha负责开关灯;
如果没有连接ha,则自动运行开关灯:
触发条件:有人运动或者人在,D5引脚高电平,继电器吸合开灯,无人运动或无人存在状态时,延迟2分钟D5脚低电平继电器分离,关闭灯光。


现在的代码是(坛子里抄来的)这样的:




esphome:
  name: tex-2410b
  friendly_name: tex-2410b

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "1+T95bSX5RQsKa9wYEhTCF5NLAMXKpSDLYy3PBxFPJM="

ota:
  password: "f4a67f10fbcbeb4aa399fbed8bd865c6"

wifi:
  ssid: "hukala"
  password: "biubiu1234*#"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Tex-2410B Fallback Hotspot"
    password: "ucBXg6c6Zb35"

captive_portal:


web_server:
  port: 80

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

switch:
  - platform: ld2410
    engineering_mode:
      name: "engineering mode"
    bluetooth:
      name: "control bluetooth"

button:
  - platform: ld2410
    factory_reset:
      name: "factory reset"
    restart:
      name: "restart"
    query_params:
      name: query params

text_sensor:
  - platform: ld2410
    version:
      name: "firmware version"
    mac_address:
      name: "mac address"

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
回复

使用道具 举报

1

主题

62

帖子

293

积分

中级会员

Rank: 3Rank: 3

积分
293
金钱
231
HASS币
0
发表于 2024-3-18 08:59:09 | 显示全部楼层
回复

使用道具 举报

1

主题

3

帖子

28

积分

新手上路

Rank: 1

积分
28
金钱
25
HASS币
0
 楼主| 发表于 2024-3-18 14:01:56 | 显示全部楼层
pengguilian 发表于 2024-3-18 08:59
这个也许更适合你
https://bbs.hassbian.com/thread-24522-1-1.html

感谢你朋友,我看了他的方案,其实本身来讲,只用5V电源+ld2410b(甚至是5.8G或10G雷达)+继电器本身就可以实现我所讲的开关灯部分,不需要任何遥控器,但是爱折腾的手,想要多一些的知识去实现,按照心意去部署。外加下半年新房要装修了,想把智能家居部分加进去,买房子掏空了我的身体,想自己动手学点知识省点钱,哈哈哈,
回复

使用道具 举报

1

主题

62

帖子

293

积分

中级会员

Rank: 3Rank: 3

积分
293
金钱
231
HASS币
0
发表于 2024-3-18 16:39:44 | 显示全部楼层
火然火尧 发表于 2024-3-18 14:01
感谢你朋友,我看了他的方案,其实本身来讲,只用5V电源+ld2410b(甚至是5.8G或10G雷达)+继电器本身就可 ...

只靠1个传感器覆盖有限,一般体验很差的,要考虑多接1、2个辅助
回复

使用道具 举报

109

主题

1582

帖子

5000

积分

元老级技术达人

积分
5000
金钱
3413
HASS币
30
发表于 2024-3-18 17:55:47 | 显示全部楼层
pengguilian 发表于 2024-3-18 16:39
只靠1个传感器覆盖有限,一般体验很差的,要考虑多接1、2个辅助

现在的商品房应该没有这么大,正常的卧室都是 20平方以内,客厅一般最多50平方吧,应该是可以覆盖到,
回复

使用道具 举报

1

主题

62

帖子

293

积分

中级会员

Rank: 3Rank: 3

积分
293
金钱
231
HASS币
0
发表于 2024-3-18 18:08:12 | 显示全部楼层
bugensui 发表于 2024-3-18 17:55
现在的商品房应该没有这么大,正常的卧室都是 20平方以内,客厅一般最多50平方吧,应该是可以覆盖到, ...

他说的是老家的房子过道,这类地方不像1个LD2410B就好用的
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-4-29 21:27 , Processed in 0.410119 second(s), 27 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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