[External Component] led_flasher – Non-blocking LED blinking until a timeout or custom condition (no scripts/globals needed)

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_ms variable: Easily combine custom timeout limits and state checks directly inside your until lambda.
  • 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 TemplatableFn and play_complex tracking.

Quick Setup

external_components:
  - source:
      type: git
      url: https://github.com
    components: [led_flasher]

led_flasher:

Feedback, forks, and PRs are very welcome!

since it’s the WTH month i would say, WTH! Why i have to build weird loops that can’t nests to blink a led

WTH! :rofl: The repository link is missing (invalid)!