请问怎样修改这个代码为按一下遥控器 传感器状态 变为开启后 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
|