跳转到内容

简单车库门

以下是用于由两个继电器控制的车库门的可能配置文件: 一个用于打开,另一个用于关闭车库门。当其中任一短暂开启时,关闭/打开动作开始。

switch:
- platform: gpio
pin: GPIOXX
name: "车库门打开开关"
id: open_switch
- platform: gpio
pin: GPIOXX
name: "车库门关闭开关"
id: close_switch
cover:
- platform: template
name: "车库门"
open_action:
# 取消任何先前的动作
- switch.turn_off: close_switch
# 短暂打开 OPEN 开关
- switch.turn_on: open_switch
- delay: 0.1s
- switch.turn_off: open_switch
close_action:
- switch.turn_off: open_switch
- switch.turn_on: close_switch
- delay: 0.1s
- switch.turn_off: close_switch
stop_action:
- switch.turn_off: close_switch
- switch.turn_off: open_switch
optimistic: true
assumed_state: true