本帖最后由 hdcola 于 2018-4-16 23:21 编辑
我现在用了一个笨办法:
先做两个虚拟开关(configuration.yaml):
input_boolean:
single_click:
name: 单击无线开关
initial: off
icon: mdi:car
double_click:
name: 双击无线开关
initial: off
icon: mdi:car
再加两个automation(automations.yaml):
- alias: single_click
trigger:
platform: event
event_type: click
event_data:
entity_id: binary_sensor.switch_158d0001b96e7c
click_type: single
action:
service: input_boolean.toggle
entity_id: input_boolean.single_click
- alias: double_click
trigger:
platform: event
event_type: click
event_data:
entity_id: binary_sensor.switch_158d0001b96e7c
click_type: double
action:
service: input_boolean.toggle
entity_id: input_boolean.double_click
感觉还是不够好,不知道hb里的可编程开关是怎么实现的,不知道ha里有没有。另外,我特别想在action中先开再关,也就是一个action执行两次,不知怎么做?有没大神知道
|