2
30
226
中级会员
output: - platform: gpio pin: 0 id: 'unlock' #解锁/开锁开关定义位gpio0=继电器 inverted: true #低电平输出 - platform: gpio pin: 2 id: 'autounlock' #解锁/开锁开关定义位gpio2=板载指示灯 inverted: true #低电平输出 switch: - platform: output id: autoopendoorlock name: "自动开锁模式" output: 'autounlock' on_turn_on: if: condition: binary_sensor.is_on: sounddoor #自动开锁模式开关打开时,if sounddoor触发 then 触发开锁按钮一次 then: button.press: unlockbutton button: - platform: output id: unlockbutton name: "开锁" icon: "mdi:lock" output: 'unlock' duration: 500ms binary_sensor: #检测单元门呼叫rx引脚 gpio3 - platform: gpio id: sounddoor pin: number: 3 inverted: true mode: input: true pullup: true #内部上拉 name: "响铃" device_class: sound filters: - delayed_on: 500ms #100ms延时滤波 - delayed_off: 300ms
使用道具 举报
25
199
1046
金牌会员
007潜水了
14
255
2364
book123 发表于 2024-2-27 13:10 试着分析一下,供参考: 问题可能出在binary_sensor sounddoor上,因为是inverted: true,且pullup: true ...
demacia 发表于 2024-2-27 13:06 你这个逻辑 应该要放在 binary_sensor sounddoor 下吧,你说的同理的情况是指这个吗?then是可以打日志的 ...
leeh 发表于 2024-2-27 13:33 感谢回复,我查阅了logger.log后使用 使用传感器自动化 on_press then logger.log: "传感器on" 进行记录 ...
book123 发表于 2024-2-27 14:34 根据你的描述“我将代码中if条件去掉,每次打开自动开锁模式开关时,可以触发一次 button.press: unlockbut ...
binary_sensor: #检测单元门呼叫rx引脚 gpio3 - platform: gpio id: sounddoor pin: number: 3 inverted: true mode: input: true pullup: true #内部上拉 name: "响铃" device_class: sound filters: - delayed_on: 500ms #100ms延时滤波 - delayed_off: 300ms on_press: then: - logger.log: "响铃is on"
demacia 发表于 2024-2-27 14:10 ison判定正常是什么意思,每次把autoopendoorlock 打开时,看sounddoor 是on的,然后unlockbutton吗? ...
本版积分规则 发表回复 回帖后跳转到最后一页
Archiver|手机版|小黑屋|Hassbian ( 晋ICP备17001384号-1 )
GMT+8, 2025-5-15 09:42 , Processed in 0.112230 second(s), 22 queries .
Powered by Discuz! X3.5
© 2001-2025 Discuz! Team.