[binary_sensor] Drop Component from AutorepeatFilter, use self-keyed scheduler (#16191)

This commit is contained in:
J. Nick Koston
2026-05-03 20:05:27 -05:00
committed by GitHub
parent 9ddb828da3
commit 013dee44eb
5 changed files with 177 additions and 19 deletions

View File

@@ -0,0 +1,40 @@
esphome:
name: test-autorepeat-filter
host:
api:
batch_delay: 0ms # Disable batching to receive every state transition
logger:
level: DEBUG
binary_sensor:
# The autorepeat filter is applied directly to the template sensor, so each
# write through `binary_sensor.template.publish` runs through the filter
# chain. With the source true the filter must oscillate after `delay`; once
# the source returns to false the filter must cancel both timers and emit a
# final false.
- platform: template
name: "Autorepeat Sensor"
id: autorepeat_sensor
filters:
- autorepeat:
- delay: 200ms
time_off: 100ms
time_on: 100ms
button:
- platform: template
name: "Press"
id: press_button
on_press:
- binary_sensor.template.publish:
id: autorepeat_sensor
state: true
- platform: template
name: "Release"
id: release_button
on_press:
- binary_sensor.template.publish:
id: autorepeat_sensor
state: false