Hi everyone!
If you are tired of writing complex repeat + if + delay loops or managing global variables and scripts just to blink a status LED, I created an external component to streamline this: led_flasher.
GitHub Repository: https://github.com
What it replaces
Instead of verbose nested YAML boilerplate for blinking LEDs based on state conditions, you can simply use:
- led_flasher.flash:
led: state_led_pin
duty_cycle: 250ms
until: !lambda 'return id(system_state) != 3 || elapsed_ms >= ((uint32_t)id(grace_time_sec).state * 1000);'
Key Features
- Non-blocking & concurrency-safe: Powered by ESPHome’s internal scheduler with zero global state, allowing multiple independent LED patterns simultaneously.
- Built-in
elapsed_msvariable: Easily combine custom timeout limits and state checks directly inside youruntillambda. - Native automation lifecycle: Pauses sequences until conditions are met and safely turns off LEDs if the automation stops.
- ESPHome 2026.4+ compatible: Built with modern
TemplatableFnandplay_complextracking.
Quick Setup
external_components:
- source:
type: git
url: https://github.com
components: [led_flasher]
led_flasher:
Feedback, forks, and PRs are very welcome!