Skip to content

Commit 271175e

Browse files
authored
Merge pull request #147 from jakub-k-dev/feature/configurable-button-click-delay
Make button multi-click delay configurable
2 parents b0de015 + b667403 commit 271175e

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,7 @@ script:
189189
button: uint8_t
190190
click_count: uint8_t
191191
then:
192-
- delay:
193-
milliseconds: ${BUTTON_MULTI_CLICK_DELAY}
192+
- delay: !lambda return nr_button_multi_click_delay->state;
194193
- lambda: |-
195194
std::string event_name;
196195
if (click_count == 1) event_name = "click";

ESPHome/TX-Ultimate-Easy-ESPHome_hw_touch.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
---
1414
substitutions:
1515
TOUCH_POSITION_MAX_VALUE: '10' # Maximum touch position value returned by the touch pad via uart
16+
BUTTON_MULTI_CLICK_DELAY: '250' # The time to wait for another click, in msec
1617

1718
ID_SWIPE_LEFT_TEXT: "left"
1819
ID_SWIPE_RIGHT_TEXT: "right"
@@ -230,6 +231,21 @@ number:
230231
optimistic: true
231232
restore_value: true
232233

234+
- id: nr_button_multi_click_delay
235+
name: Button multi-click delay
236+
icon: mdi:timer-outline
237+
unit_of_measurement: ms
238+
mode: box
239+
internal: false
240+
entity_category: config
241+
platform: template
242+
min_value: 0
243+
max_value: 2000
244+
step: 10
245+
initial_value: ${BUTTON_MULTI_CLICK_DELAY}
246+
optimistic: true
247+
restore_value: true
248+
233249
script:
234250
- id: !extend boot_initialize
235251
then:

0 commit comments

Comments
 (0)