mirror of
https://github.com/esphome/esphome.git
synced 2026-09-26 04:04:45 +08:00
CI / Create common environment (push) Canceled after 0s
CI / Seed apt package cache (push) Canceled after 0s
CI / Determine which jobs to run (push) Canceled after 0s
CI / Run script/ci-custom (push) Canceled after 0s
CI / Check pylint (push) Canceled after 0s
CI / Check lint and formatting (push) Canceled after 0s
CI / Run pytest (macOS-latest, 3.12) (push) Canceled after 0s
CI / Run pytest (macOS-latest, 3.14) (push) Canceled after 0s
CI / Run pytest (ubuntu-latest, 3.12) (push) Canceled after 0s
CI / Run pytest (ubuntu-latest, 3.13) (push) Canceled after 0s
CI / Run pytest (ubuntu-latest, 3.14) (push) Canceled after 0s
CI / Run pytest (windows-latest, 3.12) (push) Canceled after 0s
CI / Run pytest (windows-latest, 3.14) (push) Canceled after 0s
CI / Report no coverage to Codecov (push) Canceled after 0s
CI / Run integration tests () (push) Canceled after 0s
CI / Check import esphome.__main__ time (push) Canceled after 0s
CI / Run CodSpeed benchmarks (push) Canceled after 0s
CI / Run C++ unit tests (push) Canceled after 0s
CI / Run script/clang-tidy for LibreTiny (push) Canceled after 0s
CI / Run script/clang-tidy for ESP8266 (push) Canceled after 0s
CI / Run script/clang-tidy for RP2 (push) Canceled after 0s
CI / Run script/clang-tidy for ESP32 Arduino (push) Canceled after 0s
CI / Run script/clang-tidy for ZEPHYR (push) Canceled after 0s
CI / Run script/clang-tidy for ESP32 IDF (push) Canceled after 0s
CI / Run script/clang-tidy for ESP32 IDF 1/3 (push) Canceled after 0s
CI / Run script/clang-tidy for ESP32 IDF 2/3 (push) Canceled after 0s
CI / Run script/clang-tidy for ESP32 IDF 3/3 (push) Canceled after 0s
CI / Run script/clang-tidy for ESP32 C6 (push) Canceled after 0s
CI / Run script/clang-tidy for ESP32 P4 (push) Canceled after 0s
CI / Run script/clang-tidy for ESP32 S3 (push) Canceled after 0s
CI / Test components batch () (push) Canceled after 0s
CI / Test esp32 components with PlatformIO (push) Canceled after 0s
CI / Test downstream esphome/device-builder (push) Canceled after 0s
CI / Build target branch for memory impact (push) Canceled after 0s
CI / Build PR branch for memory impact (push) Canceled after 0s
CI / Comment memory impact (push) Canceled after 0s
CI / CI Status (push) Canceled after 0s
155 lines
4.1 KiB
YAML
155 lines
4.1 KiB
YAML
binary_sensor:
|
|
- platform: template
|
|
trigger_on_initial_state: true
|
|
id: binary_sensor_some_binary_sensor
|
|
name: "Random binary"
|
|
lambda: return (random_uint32() & 1) == 0;
|
|
filters:
|
|
- invert:
|
|
- delayed_on: 100ms
|
|
- delayed_off: 100ms
|
|
# Templated, delays for 1s (1000ms) only if a reed switch is active
|
|
- delayed_on_off: !lambda "return 1000;"
|
|
- delayed_on_off:
|
|
time_on: 10s
|
|
time_off: !lambda "return 1000;"
|
|
- autorepeat:
|
|
- delay: 1s
|
|
time_off: 100ms
|
|
time_on: 900ms
|
|
- delay: 5s
|
|
time_off: 100ms
|
|
time_on: 400ms
|
|
- lambda: |-
|
|
if (id(binary_sensor_some_binary_sensor).state) {
|
|
return x;
|
|
}
|
|
return {};
|
|
- settle: 100ms
|
|
- timeout: 10s
|
|
|
|
on_state_change:
|
|
then:
|
|
- logger.log:
|
|
format: "Old state was %s"
|
|
args: ['x_previous.has_value() ? ONOFF(x_previous) : "Unknown"']
|
|
- logger.log:
|
|
format: "New state is %s"
|
|
args: ['x.has_value() ? ONOFF(x) : "Unknown"']
|
|
- binary_sensor.invalidate_state: binary_sensor_some_binary_sensor
|
|
|
|
# Test autorepeat with default configuration (no timings)
|
|
- platform: template
|
|
id: autorepeat_default
|
|
name: "Autorepeat Default"
|
|
filters:
|
|
- autorepeat:
|
|
|
|
# Test autorepeat with single timing entry
|
|
- platform: template
|
|
id: autorepeat_single
|
|
name: "Autorepeat Single"
|
|
filters:
|
|
- autorepeat:
|
|
- delay: 2s
|
|
time_off: 200ms
|
|
time_on: 800ms
|
|
|
|
# Test autorepeat with three timing entries
|
|
- platform: template
|
|
id: autorepeat_multiple
|
|
name: "Autorepeat Multiple"
|
|
filters:
|
|
- autorepeat:
|
|
- delay: 500ms
|
|
time_off: 50ms
|
|
time_on: 950ms
|
|
- delay: 2s
|
|
time_off: 100ms
|
|
time_on: 900ms
|
|
- 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"
|
|
|
|
# Test on_click and on_double_click (compiles match_interval via
|
|
# USE_BINARY_SENSOR_CLICK_TRIGGER)
|
|
- platform: template
|
|
id: click_triggers
|
|
name: "Click Triggers"
|
|
on_click:
|
|
min_length: 50ms
|
|
max_length: 350ms
|
|
then:
|
|
- logger.log: "Clicked"
|
|
on_double_click:
|
|
min_length: 50ms
|
|
max_length: 350ms
|
|
then:
|
|
- logger.log: "Double clicked"
|