找回密码
 立即注册

微信扫码登录

搜索
查看: 3305|回复: 5

[技术探讨] ESPHOME 接收433信号设置为点动开关

[复制链接]

26

主题

143

回帖

652

积分

高级会员

积分
652
金钱
483
HASS币
0
发表于 2022-1-4 02:33:02 | 显示全部楼层 |阅读模式
请问怎样修改这个代码为按一下遥控器   传感器状态 变为开启后 1秒后自动变回关闭状态?
现在的状态是按一下遥控器 开启,再按一下遥控器 才关闭。这样子不好做自动化。

请求各位帮个忙修改下。谢谢


remote_receiver:
  pin: GPIO2
  dump:
    - rc_switch
  tolerance: 50%
  filter: 250us
  idle: 4ms
  buffer_size: 2kb


binary_sensor:


# 1  433遥控器


  - platform: template
    name: "433button"
    id: a433button
  - platform: remote_receiver
    name: "433button"
    internal: true
    rc_switch_raw:
      code: "000111011110010110001010"
      protocol: 1
    filters:
      delayed_off: 100ms  
    on_press:
      if:
        condition:
          binary_sensor.is_on: a433button  
        then:
          - binary_sensor.template.publish:
              id: a433button
              state: OFF
        else:
          - binary_sensor.template.publish:
              id: a433button
              state: ON
              
2.png screenshot.png

回复

使用道具 举报

26

主题

143

回帖

652

积分

高级会员

积分
652
金钱
483
HASS币
0
 楼主| 发表于 2022-1-4 17:11:29 来自手机 | 显示全部楼层
hunterfox 发表于 2022-1-4 12:14
delay: 1s 然后关闭

请问怎样修改?谢谢
回复

使用道具 举报

26

主题

143

回帖

652

积分

高级会员

积分
652
金钱
483
HASS币
0
 楼主| 发表于 2022-1-4 23:32:45 来自手机 | 显示全部楼层
mildrabbit 发表于 2022-1-4 17:20
esphome:
  name: dswitch_computer
  platform: ESP8266

你这代码是开关代码自动复位是没问题,但传感器不适用这代码。
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian ( 晋ICP备17001384号-1 )

GMT+8, 2025-9-4 12:00 , Processed in 1.104654 second(s), 11 queries , MemCached On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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