init upload
This commit is contained in:
60
sonoff-m5/button-c.yaml
Normal file
60
sonoff-m5/button-c.yaml
Normal file
@@ -0,0 +1,60 @@
|
||||
# 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 C
|
||||
- platform: gpio
|
||||
name: "Button C"
|
||||
id: button_c
|
||||
pin:
|
||||
number: ${button_c_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: C
|
||||
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: C
|
||||
gesture: double_click
|
||||
|
||||
# hold detection
|
||||
- timing:
|
||||
- ${timing_hold}
|
||||
then:
|
||||
- while:
|
||||
condition:
|
||||
binary_sensor.is_on: button_c
|
||||
then:
|
||||
- light.toggle: led_status
|
||||
- homeassistant.event:
|
||||
event: esphome.on_gesture
|
||||
data:
|
||||
button: C
|
||||
gesture: button_hold
|
||||
- delay: ${timing_hold_repeat}
|
||||
- light.turn_off: led_status
|
||||
Reference in New Issue
Block a user