61 lines
1.6 KiB
YAML
61 lines
1.6 KiB
YAML
# NOTE: This file is not a stand-alone package. It is part of
|
|
# a 'root' device template and expects the substitutions that
|
|
# are hereby referenced to be defined by its parent.
|
|
|
|
binary_sensor:
|
|
# Physical Button B
|
|
- platform: gpio
|
|
name: "Button B"
|
|
id: button_b
|
|
pin:
|
|
number: ${button_b_gpio}
|
|
mode: INPUT_PULLUP
|
|
inverted: true
|
|
ignore_strapping_warning: true
|
|
|
|
filters:
|
|
- delayed_on: ${filter_delay_on}
|
|
- delayed_off: ${filter_delay_off}
|
|
|
|
on_multi_click:
|
|
# single click detection
|
|
- timing:
|
|
- ${timing_click_1}
|
|
- ${timing_click_2}
|
|
then:
|
|
- homeassistant.event:
|
|
event: esphome.on_gesture
|
|
data:
|
|
button: B
|
|
gesture: single_click
|
|
|
|
# double click detection
|
|
- timing:
|
|
- ${timing_double_click_1}
|
|
- ${timing_double_click_2}
|
|
- ${timing_double_click_3}
|
|
- ${timing_double_click_4}
|
|
then:
|
|
- homeassistant.event:
|
|
event: esphome.on_gesture
|
|
data:
|
|
button: B
|
|
gesture: double_click
|
|
|
|
# hold detection
|
|
- timing:
|
|
- ${timing_hold}
|
|
then:
|
|
- while:
|
|
condition:
|
|
binary_sensor.is_on: button_b
|
|
then:
|
|
- light.toggle: led_status
|
|
- homeassistant.event:
|
|
event: esphome.on_gesture
|
|
data:
|
|
button: B
|
|
gesture: button_hold
|
|
- delay: ${timing_hold_repeat}
|
|
- light.turn_off: led_status
|