mirror of
https://github.com/esphome/esphome.git
synced 2025-10-27 13:13:50 +00:00
Add compile tests for binary_sensor MultiClickTrigger (#11454)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
@@ -70,3 +70,69 @@ binary_sensor:
|
||||
- delay: 10s
|
||||
time_off: 200ms
|
||||
time_on: 800ms
|
||||
|
||||
# Test on_multi_click with single click
|
||||
- platform: template
|
||||
id: multi_click_single
|
||||
name: "Multi Click Single"
|
||||
on_multi_click:
|
||||
- timing:
|
||||
- state: true
|
||||
min_length: 50ms
|
||||
max_length: 350ms
|
||||
then:
|
||||
- logger.log: "Single click detected"
|
||||
|
||||
# Test on_multi_click with double click
|
||||
- platform: template
|
||||
id: multi_click_double
|
||||
name: "Multi Click Double"
|
||||
on_multi_click:
|
||||
- timing:
|
||||
- state: true
|
||||
min_length: 50ms
|
||||
max_length: 350ms
|
||||
- state: false
|
||||
min_length: 50ms
|
||||
max_length: 350ms
|
||||
- state: true
|
||||
min_length: 50ms
|
||||
max_length: 350ms
|
||||
then:
|
||||
- logger.log: "Double click detected"
|
||||
|
||||
# Test on_multi_click with complex pattern (5 events)
|
||||
- platform: template
|
||||
id: multi_click_complex
|
||||
name: "Multi Click Complex"
|
||||
on_multi_click:
|
||||
- timing:
|
||||
- state: true
|
||||
min_length: 50ms
|
||||
max_length: 350ms
|
||||
- state: false
|
||||
min_length: 50ms
|
||||
max_length: 350ms
|
||||
- state: true
|
||||
min_length: 50ms
|
||||
max_length: 350ms
|
||||
- state: false
|
||||
min_length: 50ms
|
||||
max_length: 350ms
|
||||
- state: true
|
||||
min_length: 50ms
|
||||
then:
|
||||
- logger.log: "Complex pattern detected"
|
||||
|
||||
# Test on_multi_click with custom invalid_cooldown
|
||||
- platform: template
|
||||
id: multi_click_cooldown
|
||||
name: "Multi Click Cooldown"
|
||||
on_multi_click:
|
||||
- timing:
|
||||
- state: true
|
||||
min_length: 100ms
|
||||
max_length: 500ms
|
||||
invalid_cooldown: 2s
|
||||
then:
|
||||
- logger.log: "Click with custom cooldown"
|
||||
|
||||
Reference in New Issue
Block a user