参考下:(应该是定义了一个多方式按钮,可以用的!)
binary_sensor:
- platform: gpio
pin: GPIO0
id: btntonecontrol
name: "btnToneControl"
internal: true
filters:
- invert:
on_multi_click: # 模仿按键
- timing: #Double Clicked
- ON for at most 1s
- OFF for at most 1s
- ON for at most 1s
- OFF for at least 0.2s
then:
- switch.turn_on:
id: stonestop
- switch.turn_on:
id: stonesleep
- timing: #Single Long Clicked
- ON for 3s to 5s
- OFF for at least 0.5s
then:
- switch.turn_on:
id: stonestop
- delay: 00:00:01
- switch.turn_on:
id: stonecontinue
- timing: #Single Short Clicked
- ON for at most 2s
- OFF for at least 0.5s
then:
- switch.turn_on:
id: stonestop
- delay: 00:00:01
- switch.turn_on:
id: stoneonce