Skip to content

Instantly share code, notes, and snippets.

@brodock
Last active September 10, 2026 17:25
Show Gist options
  • Select an option

  • Save brodock/6f5a83800298cb872ffb46c8bab3871a to your computer and use it in GitHub Desktop.

Select an option

Save brodock/6f5a83800298cb872ffb46c8bab3871a to your computer and use it in GitHub Desktop.
Philips Hue Dimmer RWL022 (Hue Light Cycle Only)
blueprint:
name: Hue Dimmer Switch v2 - Hue Button (Zigbee2MQTT)
description: >
Cycles color temperature on the hue/bottom button of a Hue Dimmer
Switch v2 (RWL022). Pairs with a Zigbee bind handling on/off/brightness
directly.
domain: automation
source_url: https://gist.github.com/brodock/6f5a83800298cb872ffb46c8bab3871a/edit
input:
controller_device:
name: Dimmer switch
description: The Hue Dimmer Switch v2 (RWL022) device.
selector:
device:
filter:
- integration: mqtt
manufacturer: Philips
model: "Hue dimmer switch gen 2"
- integration: mqtt
manufacturer: Philips
model: RWL022
light_target:
name: Light
description: The light to cycle color temp on. MQTT (Zigbee2MQTT) lights only.
selector:
entity:
filter:
- integration: mqtt
domain: light
temp_1:
name: Step 1
description: First color temp in the cycle.
default: 2200
selector:
color_temp:
unit: kelvin
min: 2000
max: 6500
temp_2:
name: Step 2
default: 2700
selector:
color_temp:
unit: kelvin
min: 2000
max: 6500
temp_3:
name: Step 3
default: 3000
selector:
color_temp:
unit: kelvin
min: 2000
max: 6500
temp_4:
name: Step 4
default: 4000
selector:
color_temp:
unit: kelvin
min: 2000
max: 6500
temp_5:
name: Step 5
description: Repeat an earlier step's value here to use fewer than 5 steps.
default: 6500
selector:
color_temp:
unit: kelvin
min: 2000
max: 6500
transition:
name: Transition (seconds)
description: How smoothly to fade to the new color temp.
default: 0
selector:
number:
min: 0
max: 5
step: 0.1
unit_of_measurement: s
hold_action:
name: (Optional) Long-press action
description: Optional action for a long press. Leave empty to ignore.
default: []
selector:
action: {}
mode: restart
trigger:
- platform: device
domain: mqtt
device_id: !input controller_device
type: action
subtype: off_press_release
id: short_press
- platform: device
domain: mqtt
device_id: !input controller_device
type: action
subtype: off_hold_release
id: hold_press
action:
- variables:
light_target: !input light_target
temp_list:
- !input temp_1
- !input temp_2
- !input temp_3
- !input temp_4
- !input temp_5
- choose:
# Short press -> cycle color temp
- conditions:
- "{{ trigger.id == 'short_press' }}"
sequence:
- variables:
current_kelvin: >
{{ state_attr(light_target, 'color_temp_kelvin') | int(default=temp_list[0]) }}
- variables:
next_kelvin: >
{% set ns = namespace(best_i=0, best_diff=999999) %}
{% for v in temp_list %}
{% set diff = (v - current_kelvin) | abs %}
{% if diff < ns.best_diff %}
{% set ns.best_diff = diff %}
{% set ns.best_i = loop.index0 %}
{% endif %}
{% endfor %}
{{ temp_list[(ns.best_i + 1) % (temp_list | length)] }}
- action: light.turn_on
target:
entity_id: !input light_target
data:
color_temp_kelvin: "{{ next_kelvin }}"
transition: !input transition
# Long press -> optional custom action
- conditions:
- "{{ trigger.id == 'hold_press' }}"
sequence: !input hold_action
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment