Skip to content

Instantly share code, notes, and snippets.

@Belphemur
Last active November 28, 2025 19:10
Show Gist options
  • Select an option

  • Save Belphemur/155dec2f425b3e7781518ce7ae371d75 to your computer and use it in GitHub Desktop.

Select an option

Save Belphemur/155dec2f425b3e7781518ce7ae371d75 to your computer and use it in GitHub Desktop.
blueprint:
name: Button Light Control with Brightness Stepping
description: |
Control lights with a button that supports single press (toggle), double press (scene),
and brightness stepping (hold up/down). Perfect for buttons that emit brightness_step
events with direction attributes.
**Features:**
- Single press: Toggle light on/off
- Double press: Set warm scene (50% brightness, 2700K)
- Hold button: Brightness up/down stepping
**Requirements:**
- Button device that emits `brightness_step` events with `direction` attribute
- No additional helpers needed - brightness step is configured via slider
domain: automation
author: Home Assistant User
homeassistant:
min_version: "2025.11.0"
input:
button_entity:
name: Button Entity
description: The button event entity that triggers the automation
selector:
entity:
filter:
- domain: event
target_light:
name: Target Light
description: The light(s) to control
selector:
target:
entity:
- domain: light
brightness_step_size:
name: Brightness Step Size
description: How much to increase/decrease brightness with each step
default: 10
selector:
number:
min: 5
max: 50
step: 5
unit_of_measurement: "%"
mode: slider
toggle_color_temp:
name: Toggle Color Temperature
description: Color temperature when toggling light on (in Kelvin)
default: 3005
selector:
number:
min: 2000
max: 6500
step: 5
unit_of_measurement: "K"
mode: box
toggle_brightness:
name: Toggle Brightness
description: Brightness when toggling light on
default: 100
selector:
number:
min: 1
max: 100
step: 1
unit_of_measurement: "%"
mode: slider
scene_color_temp:
name: Scene Color Temperature
description: Color temperature for double-press scene (in Kelvin)
default: 2700
selector:
number:
min: 2000
max: 6500
step: 5
unit_of_measurement: "K"
mode: box
scene_brightness:
name: Scene Brightness
description: Brightness for double-press scene
default: 50
selector:
number:
min: 1
max: 100
step: 1
unit_of_measurement: "%"
mode: slider
# Convert !input values to variables for use in templates
variables:
button_entity: !input button_entity
target_light: !input target_light
brightness_step_size: !input brightness_step_size
toggle_color_temp: !input toggle_color_temp
toggle_brightness: !input toggle_brightness
scene_color_temp: !input scene_color_temp
scene_brightness: !input scene_brightness
mode: single
triggers:
- trigger: state
entity_id: !input button_entity
not_from: unavailable
not_to: unavailable
conditions: []
actions:
- choose:
# Single press - Toggle light
- conditions:
- condition: template
value_template: "{{ trigger.to_state.attributes.event_type == 'single' }}"
sequence:
- action: light.toggle
target: !input target_light
data:
color_temp_kelvin: !input toggle_color_temp
brightness_pct: !input toggle_brightness
# Double press - Warm scene
- conditions:
- condition: template
value_template: "{{ trigger.to_state.attributes.event_type == 'double' }}"
sequence:
- action: light.turn_on
target: !input target_light
data:
color_temp_kelvin: !input scene_color_temp
brightness_pct: !input scene_brightness
# Brightness stepping (hold button)
- conditions:
- condition: template
value_template: "{{ trigger.to_state.attributes.event_type == 'brightness_step' }}"
- condition: template
value_template: "{{ expand(target_light.entity_id) | selectattr('state', 'eq', 'on') | list | length > 0 }}"
sequence:
- action: light.turn_on
target: !input target_light
data:
brightness_step_pct: >
{% if trigger.to_state.attributes.direction == 'up' %}
{{ brightness_step_size }}
{% else %}
{{ -brightness_step_size }}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment