WLED Countdown Timer

: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:

2 Likes