✨ Smooth Hold-to-Dim / Brighten✨

:sparkles:Smooth Hold-to-Dim / Brighten​:sparkles:

This blueprint lets you control any light, group, or area using a 2-button remote with event entities (such as multi-press and hold events). It offers single-press toggles, double-press shortcuts, and a smooth duration-based dimming/brightening calculation when holding down the buttons.

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


Features

  • Button 1 Single Press: Turns target lights on immediately.
  • Button 1 Double Press: Sets target lights to 100% brightness instantly.
  • Button 1 Hold & Release: Smoothly ramps brightness up.
  • Button 2 Single Press: Turns target lights off.
  • Button 2 Hold & Release: Smoothly ramps brightness down.

Requirements

  • Home Assistant: 2024.1.0 or newer (uses modern action syntax and event entities).
  • Compatible Remote: Any 2-button remote that exposes event entities supporting multi_press_1, multi_press_2, long_press, and long_release event types.
    • Tested & Works Great With: IKEA BILRESA (E2489)

Inputs

  • Button 1 Event Entity: The event entity associated with Button 1 (e.g., UP / Brighten).
  • Button 2 Event Entity: The event entity associated with Button 2 (e.g., DOWN / Dim).
  • Reference Light Entity: A specific light entity used to sample the current brightness percentage before starting a dimming/brightening operation.
  • Target Lights / Area: The target entities, devices, light groups, or entire area you want to control.

Installation Options

Option 1: Import via Badge

Click the My Home Assistant import badge at the top of the post.

Option 2: Manual Import

Import a blueprint from this address: https://gist.github.com/Blightbuster/f1673ce4be3be068dbb7f7086092f4df


Usage

  1. Go to Settings > Automations & Scenes > Automations.
  2. Click + Create Automation.
  3. Select Remote Light Control with Smooth Hold-to-Dim.
  4. Map your remote event entities and choose your reference light and target entities/areas.
  5. Save and enjoy smooth remote light adjustments!

YAML Blueprint Code

Summary
blueprint:
  name: Button Light Control with Smooth Hold-to-Dim
  description: >
    Controls light brightness using a 2-button remote with single-press, double-press, 
    and smooth hold-to-dim/brighten features based on press duration.
  domain: automation
  input:
    button_1_entity:
      name: Button 1 Event Entity
      description: The event entity for Button 1 (e.g., Up/Brighten button).
      selector:
        entity:
          domain: event
    button_2_entity:
      name: Button 2 Event Entity
      description: The event entity for Button 2 (e.g., Down/Dim button).
      selector:
        entity:
          domain: event
    reference_light:
      name: Reference Light Entity
      description: >
        The specific light entity used to read the current brightness state during dimming operations.
      selector:
        entity:
          domain: light
    target_lights:
      name: Target Lights / Area
      description: The lights, group, or area to control.
      selector:
        target:
          entity:
            domain: light

mode: restart

triggers:
  - trigger: event.received
    target:
      entity_id: !input button_1_entity
    options:
      event_type:
        - multi_press_1
    id: button_1_pressed_once

  - trigger: event.received
    target:
      entity_id: !input button_2_entity
    options:
      event_type:
        - multi_press_1
    id: button_2_pressed_once

  - trigger: event.received
    target:
      entity_id: !input button_1_entity
    options:
      event_type:
        - long_press
    id: button_1_held_down

  - trigger: event.received
    target:
      entity_id: !input button_2_entity
    options:
      event_type:
        - long_press
    id: button_2_held_down

  - trigger: event.received
    target:
      entity_id: !input button_1_entity
    options:
      event_type:
        - multi_press_2
    id: button_1_pressed_twice

conditions: []

actions:
  - choose:
      # --- BUTTON 1 HELD: Brighten ---
      - conditions:
          - condition: trigger
            id:
              - button_1_held_down
        sequence:
          - variables:
              ref_light: !input reference_light
              start_time: "{{ now().timestamp() }}"
              start_brightness: >-
                {{ (state_attr(ref_light, 'brightness') | float(0) / 2.55) | round(0) }}
              target_transition: >-
                {% set start = (state_attr(ref_light, 'brightness') | float(0) / 2.55) | round(0) %}
                {{ [(100 - start) / 20, 0.1] | max }}
          - parallel:
              - action: light.turn_on
                target: !input target_lights
                data:
                  transition: "{{ target_transition }}"
                  brightness_pct: 100
                continue_on_error: true
              - sequence:
                  - wait_for_trigger:
                      - trigger: event.received
                        target:
                          entity_id: !input button_1_entity
                        options:
                          event_type:
                            - long_release
                  - action: light.turn_on
                    target: !input target_lights
                    data:
                      brightness_pct: >-
                        {% set elapsed = now().timestamp() - start_time %}
                        {% set added_pct = (elapsed / 5) * 100 %}
                        {% set final_pct = start_brightness + added_pct %}
                        {{ [final_pct | round(0), 100] | min }}

      # --- BUTTON 2 HELD: Dim ---
      - conditions:
          - condition: trigger
            id:
              - button_2_held_down
        sequence:
          - variables:
              ref_light: !input reference_light
              start_time: "{{ now().timestamp() }}"
              start_brightness: >-
                {{ (state_attr(ref_light, 'brightness') | float(0) / 2.55) | round(0) }}
              target_transition: >-
                {% set start = (state_attr(ref_light, 'brightness') | float(0) / 2.55) | round(0) %}
                {{ [start / 20, 0.1] | max }}
          - parallel:
              - action: light.turn_on
                target: !input target_lights
                data:
                  transition: "{{ target_transition }}"
                  brightness_pct: 1
                continue_on_error: true
              - sequence:
                  - wait_for_trigger:
                      - trigger: event.received
                        target:
                          entity_id: !input button_2_entity
                        options:
                          event_type:
                            - long_release
                  - action: light.turn_on
                    target: !input target_lights
                    data:
                      brightness_pct: >-
                        {% set elapsed = now().timestamp() - start_time %}
                        {% set sub_pct = (elapsed / 5) * 100 %}
                        {% set final_pct = start_brightness - sub_pct %}
                        {{ [final_pct | round(0), 1] | max }}

      # --- BUTTON 1 SINGLE PRESS: Turn On ---
      - conditions:
          - condition: trigger
            id:
              - button_1_pressed_once
        sequence:
          - action: light.turn_on
            target: !input target_lights
            data:
              transition: 0

      # --- BUTTON 2 SINGLE PRESS: Turn Off ---
      - conditions:
          - condition: trigger
            id:
              - button_2_pressed_once
        sequence:
          - action: light.turn_off
            target: !input target_lights
            data:
              transition: 0

      # --- BUTTON 1 DOUBLE PRESS: Full Brightness ---
      - conditions:
          - condition: trigger
            id:
              - button_1_pressed_twice
        sequence:
          - action: light.turn_on
            target: !input target_lights
            data:
              brightness_pct: 100

I can’t test at the moment but it’s likely this would work with RODRET remotes as well yeah?

If so I’m excited to see what the fancy dimming does on my lights.

I dont have a RODRET so cant test it myself but as long as it has a Single Press and Hold & Release event for each button, it will work.

In case it doesnt, feel free to tell me which events it supports and i’ll add some more state to the script such that it works with more basic events.

This is great - just works!

One thing I missed from the direct binding of a Bilresa to a Kajplats bulb is that it can also switch colours.

I don’t know if this is possible, but right now it seem like “double press” the last buttons is doing nothing - is there a way with HA that when you double press it, that it can switch the “smooth” up down action from dimming to hue or temperature (depending on what features are enabled for the target bulb)

It would require some form of “state” memory I guess, which I’m not sure HA supports, as this is what I guess would store the feature to target.

I am new to HA, and to Matter and Zigbee tbh - I’m a long term user of basic consumer smart home stuff, but this is a whole new world.

I updated it such that it now only dims currently enabled lights and double pressign Button 2 now dims to 1%.

Unfortunately all my testing with double press to cycle through hue/temp felt awafull or didnt work cause there needs to be some way of stopping and there doesnt seem to be a double press hold event or an event at all when holding on the second press (at least on my IKEA Bilresa remotes)