WLED Countdown Timer

This is a blueprint to do a countdown timer on WLED powered strips. It:

  • makes a new segment (of whatever length you choose)
  • displays a coloured bar on it that gradually grows over the given duration
  • plays another animation for a while to signal the end of the time.

Note: it does require that the WLED devices have MQTT switched on, and the dev_name input needs the MQTT IDs (where the MQTT topic is mqtt//api)

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

File: https://raw.githubusercontent.com/mo-seph/ha_blueprints/refs/heads/main/scripts/countdown_mqtt.yaml

3 Likes

Cool! I just did similar about 2 weeks ago but used Node Red. I only setup a 5 minute version for now but will add 10, 15, and 20 minute versions in near future. They help giving kids time limits or warning until bedtime.

1 Like

Hello dmr,

Thanks for contributing to the community with a new Blueprint.

I have a suggestion for you. Many people who are not familiar with directory structures will have problems installing this without the Home Assistant MY tools.

Adding a MY link for this Blueprint to your top post would help them a lot.

Here is the link to make that.
Create a link – My Home Assistant

1 Like

Done! It’s up on github now, with a button link.

Hi @dmr,

I tried to set this up and it doesn´t work, but I´m pretty sure it´s because I´m doing something wrong, could you please check what I need to change in my setup:

I just found the issue, as I was using WLED-ID instead of only the ID in the field dev_name.

Now that it´s working I have another question. It would be really cool to be able to dinamically set the duration from an automation, for example to say “hey google, set a timer for 7 minutes”, is there any way to do this?

I haven’t looked into this, but scripts can expose variables that are called when they are run, so it should be possible.

1 Like

oh this is awesome, thank you! I have some wled panels around my desktop this is very useful!

:clock3: WLED Countdown Timer — Without MQTT, Using Live View Proxy

Hey everyone :wave:

Just dropping in to share an alternative way to run a countdown timer on WLED without needing MQTT or Node-RED.

I’ve been building a Home Assistant integration called WLED Live View Proxy, and it now supports sending full JSON commands to your WLED devices over WebSocket. Using this, I put together a flexible script that:

:white_check_mark: Reads the LED count dynamically from your WLED segment
:white_check_mark: Displays a smooth green progress bar across the strip
:white_check_mark: Last 10% of LEDs blink red at the end
:white_check_mark: Automatically resets after the timer ends
:white_check_mark: Works with any WLED setup and doesn’t require MQTT

:bulb: No MQTT, no polling, just JSON over WS using wled_liveviewproxy.send_command


:jigsaw: Full YAML Script

alias: WLED Progress with Final Blink and Reset
mode: restart
fields:
  duration:
    name: Timer duration (seconds)
    description: Total time in seconds
    required: true
    selector:
      number:
        min: 1
        max: 600
        unit_of_measurement: sec
  target_light:
    name: WLED Light
    description: Select your WLED light
    required: true
    selector:
      entity:
        domain: light
        integration: wled_liveviewproxy
variables:
  segment_id: 0
  palette: 0
  fx_id: 98
  color1: "00ff00"
  color2: "000000"
  brightness: 255
  flash_color: "ff0000"

sequence:
  - alias: "Request WLED state"
    action: wled_liveviewproxy.send_command
    data:
      targets:
        entity_id: "{{ target_light }}"
      command:
        v: true
    response_variable: wled_state

  - alias: "Prepare variables"
    variables:
      response_key: "{{ wled_state.responses.keys() | list | first }}"
      seg: "{{ wled_state.responses[response_key].state.seg[segment_id] }}"
      led_count: "{{ seg.stop - seg.start }}"
      step_count: "{{ duration | int }}"
      leds_per_step: "{{ 100 / step_count }}"
      last_led_index: "{{ seg.stop - 1 }}"
      flash_leds_count: "{{ (led_count * 0.1) | round(0, 'ceil') }}"
      flash_start_index: "{{ seg.stop - flash_leds_count }}"

  - alias: "Run countdown timer"
    repeat:
      count: "{{ step_count }}"
      sequence:
        - variables:
            current_ix: "{{ ((repeat.index) * leds_per_step) | round(0) }}"
        - alias: "Update progress"
          action: wled_liveviewproxy.send_command
          response_variable: response
          data:
            targets:
              entity_id: "{{ target_light }}"
            command:
              seg:
                - id: "{{ segment_id }}"
                  start: "{{ seg.start }}"
                  stop: "{{ seg.stop }}"
                  fx: "{{ fx_id }}"
                  ix: "{{ [current_ix, 100] | min }}"
                  col: ["{{ color1 }}", "{{ color2 }}"]
                  pal: "{{ palette }}"
                  bri: "{{ brightness }}"
        - delay:
            seconds: 1

  - alias: "Blink last 10% LEDs red"
    repeat:
      count: 4
      sequence:
        - alias: "ON — last 10% in red"
          action: wled_liveviewproxy.send_command
          response_variable: response
          data:
            targets:
              entity_id: "{{ target_light }}"
            command:
              seg:
                - id: "{{ segment_id }}"
                  i: >
                    [
                    {% for i in range(seg.start, flash_start_index) %}
                      {{ i }}, "{{ color1 }}",
                    {% endfor %}
                    {% for i in range(flash_start_index, seg.stop) %}
                      {{ i }}, "{{ flash_color }}",
                    {% endfor %}
                    ]
        - delay:
            milliseconds: 300
        - alias: "OFF — turn off red only"
          action: wled_liveviewproxy.send_command
          response_variable: response
          data:
            targets:
              entity_id: "{{ target_light }}"
            command:
              seg:
                - id: "{{ segment_id }}"
                  i: >
                    [
                    {% for i in range(seg.start, flash_start_index) %}
                      {{ i }}, "{{ color1 }}",
                    {% endfor %}
                    {% for i in range(flash_start_index, seg.stop) %}
                      {{ i }}, "000000",
                    {% endfor %}
                    ]
        - delay:
            milliseconds: 300

  - alias: "Reset effect"
    action: wled_liveviewproxy.send_command
    response_variable: response
    data:
      targets:
        entity_id: "{{ target_light }}"
      command:
        seg:
          - id: "{{ segment_id }}"
            frz: false


:link: Learn More and Join the Discussion

:left_speech_bubble: WLED Live View Proxy for Home Assistant – Forum Thread

Let me know what you think — and if you build something cool with it, I’d love to see it! :rocket: