Last active
September 7, 2025 16:53
-
-
Save thomasmaxson/7aeffeefb4950278c5ecfca303332c12 to your computer and use it in GitHub Desktop.
Home Assistant Blueprint to control your devices with a Philips Hue Dimmer Switch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This blueprint uses a Philips Hue Dimmer (RWL020 (US), RWL021 (EU) and RWL022) Remote Control connected through the Hue integration | |
| # This blueprint allows you to control lights and/or run custom actions with the remote's buttons | |
| # | |
| # | Button Type | Interaction | Action Choices | | |
| # | -------------------- | ------------ | ------------------------------------ | | |
| # | Power On (v1) | Press | - Turn on light(s) | | |
| # | Power Button (v2) | | - Toggle light(s) state | | |
| # | | | - Run custom action | | |
| # | -------------------- | ------------ | ------------------------------------ | | |
| # | Power On (v1) | Press & Hold | - Run custom action | | |
| # | Power Button (v2) | | | | |
| # | -------------------- | ------------ | ------------------------------------ | | |
| # | Brightness, Increase | Press | - Increase light brightness (once) | | |
| # | | | - Run custom action | | |
| # | -------------------- | ------------ | ------------------------------------ | | |
| # | Brightness, Increase | Press & Hold | - Increase light brightness (repeat) | | |
| # | | | - Run custom action | | |
| # | -------------------- | ------------ | ------------------------------------ | | |
| # | Brightness, Decrease | Press | - Increase light brightness (once) | | |
| # | | | - Run custom action | | |
| # | -------------------- | ------------ | ------------------------------------ | | |
| # | Brightness, Decrease | Press & Hold | - Decrease light brightness (repeat) | | |
| # | | | - Run custom action | | |
| # | -------------------- | ------------ | ------------------------------------ | | |
| # | Power Off (v1) | Press | - Turn off light(s) | | |
| # | Hue Button (v2) | | - Run custom action | | |
| # | -------------------- | ------------ | ------------------------------------ | | |
| # | Power Off (v1) | Press & Hold | - Run custom action | | |
| # | Hue Button (v2) | | | | |
| # | -------------------- | ------------ | ------------------------------------ | | |
| blueprint: | |
| name: Philips Hue, Dimmer Remote Control | |
| description: Control devices with your Philips Hue Dimmer remote. | |
| author: Thomas Maxson | |
| source_url: https://gist.github.com/thomasmaxson/7aeffeefb4950278c5ecfca303332c12 | |
| homeassistant: | |
| min_version: 2024.6.0 | |
| domain: automation | |
| input: | |
| remote: | |
| name: Philips Hue Dimmer remote control | |
| description: Select the Philips Hue remote to trigger your automations. | |
| selector: | |
| device: | |
| multiple: false | |
| filter: | |
| - integration: hue | |
| manufacturer: Signify Netherlands B.V. | |
| model: Hue dimmer switch (RWL020) | |
| - integration: hue | |
| manufacturer: Signify Netherlands B.V. | |
| model: Hue dimmer switch (RWL021) | |
| - integration: hue | |
| manufacturer: Signify Netherlands B.V. | |
| model: Hue dimmer switch (RWL022) | |
| light: | |
| name: Light(s) | |
| description: Select the light(s) you wish to control. | |
| default: [] | |
| selector: | |
| entity: | |
| multiple: true | |
| filter: | |
| domain: light | |
| top_button_config: | |
| name: Top Button Configuration | |
| icon: mdi:power | |
| collapsed: true | |
| input: | |
| event_button_top: | |
| name: Button Event Type | |
| description: >- | |
| Select the event you want the **Top Button** to do. | |
| <br>• _Turn on light_: Turn on the light(s) | |
| <br>• _Toggle light_: Toggle the power state of the light(s) | |
| <br>• _Custom Action_: Trigger your own custom action | |
| default: "Turn on light" | |
| selector: | |
| select: | |
| options: | |
| - Turn on light | |
| - Toggle light | |
| - Custom action | |
| brightness_on_percent: | |
| name: Brightness Level When Light Turns on | |
| description: >- | |
| Level of brightness to set the light(s) to when turning on. | |
| <br>• Set 1-100 to use a specific brightness level | |
| <br>• Set to 0 to use the lights last brightness level | |
| selector: | |
| number: | |
| mode: slider | |
| unit_of_measurement: "%" | |
| min: 0 | |
| max: 100.0 | |
| step: 1.0 | |
| default: 0 | |
| action_button_press_top_single: | |
| name: Top Button, Press Action | |
| description: The action to perform on _press_. | |
| default: [] | |
| selector: | |
| action: null | |
| action_button_press_top_hold: | |
| name: Top Button, Press and Hold Action | |
| description: The action to perform on _press and hold_. | |
| default: [] | |
| selector: | |
| action: null | |
| brightness_buttons_config: | |
| name: Brightness Button Configuration | |
| icon: mdi:brightness-6 | |
| collapsed: true | |
| input: | |
| event_buttons_brightness: | |
| name: Button Event Type | |
| description: >- | |
| Select the event you want the **Brightness Buttons** to do. | |
| <br>• _Adjust brightness_: Increase/Decrease brightness of the light(s) | |
| <br>• _Custom action_: Trigger your own custom action | |
| default: "Adjust brightness" | |
| selector: | |
| select: | |
| options: | |
| - Adjust brightness | |
| - Custom action | |
| brightness_step: | |
| name: Brightness Step | |
| description: Incremental value to increase or decrease light brightness. | |
| selector: | |
| number: | |
| mode: slider | |
| unit_of_measurement: "%" | |
| min: 5 | |
| max: 100 | |
| step: 5.0 | |
| default: 20 | |
| action_button_press_raise_single: | |
| name: Brightness Increase, Press Action | |
| description: The action to perform on _press_. | |
| default: [] | |
| selector: | |
| action: null | |
| action_button_press_raise_hold: | |
| name: Brightness Increase, Press and Hold Action | |
| description: The action to perform on _press and hold_. | |
| default: [] | |
| selector: | |
| action: null | |
| action_button_press_lower_single: | |
| name: Brightness Decrease, Press Action | |
| description: The action to perform on _press_. | |
| default: [] | |
| selector: | |
| action: null | |
| action_button_press_lower_hold: | |
| name: Brightness Decrease, Press and Hold Action | |
| description: The action to perform on _press and hold_. | |
| default: [] | |
| selector: | |
| action: null | |
| bottom_button_config: | |
| name: Bottom Button Configuration | |
| icon: mdi:power-off | |
| collapsed: true | |
| input: | |
| event_button_bottom: | |
| name: Button Event Type | |
| description: >- | |
| Select the event you want the **Bottom Button** to do. | |
| <br>• _Turn off light_: Turn off the light(s) | |
| <br>• _Custom Action_: Trigger your own custom action | |
| default: "Turn off light" | |
| selector: | |
| select: | |
| options: | |
| - Turn off light | |
| - Custom action | |
| action_button_press_bottom_single: | |
| name: Bottom Button, Press Action | |
| description: The action to perform on _press_. | |
| default: [] | |
| selector: | |
| action: null | |
| action_button_press_bottom_hold: | |
| name: Bottom Button, Press and Hold Action | |
| description: The action to perform on _press and hold_. | |
| default: [] | |
| selector: | |
| action: null | |
| automation_config: | |
| name: Configuration | |
| icon: mdi:cog | |
| collapsed: true | |
| input: | |
| config_mode: | |
| name: Automation Mode | |
| description: Mode that automation runs in. | |
| default: restart | |
| selector: | |
| select: | |
| options: | |
| - single | |
| - restart | |
| - queued | |
| - parallel | |
| custom_value: false | |
| multiple: false | |
| config_max_num: | |
| name: Mode Max | |
| description: > | |
| Maximum number of runs that can be executed or queued at a time. | |
| <br>Ignored by _Single_ and _Restart_ Modes. | |
| default: 10 | |
| selector: | |
| number: | |
| mode: slider | |
| unit_of_measurement: "runs" | |
| min: 1.0 | |
| max: 15.0 | |
| step: 1.0 | |
| mode: !input config_mode | |
| max: !input config_max_num | |
| max_exceeded: silent | |
| variables: | |
| var_remote: !input remote | |
| var_light: !input light | |
| var_event_button_top: !input event_button_top | |
| var_event_buttons_brightness: !input event_buttons_brightness | |
| var_event_button_bottom: !input event_button_bottom | |
| var_brightness_on_percent: !input brightness_on_percent | |
| var_brightness_step: !input brightness_step | |
| trigger: | |
| - alias: Top Button Press (via HUE event) | |
| trigger: device | |
| domain: hue | |
| device_id: !input remote | |
| type: short_release | |
| subtype: 1 | |
| id: trigger_top_press_hue | |
| - alias: Brightness Increase Button Press (via HUE event) | |
| trigger: device | |
| domain: hue | |
| device_id: !input remote | |
| type: short_release | |
| subtype: 2 | |
| id: trigger_raise_press_hue | |
| - alias: Brightness Decrease Button Press (via HUE event) | |
| trigger: device | |
| domain: hue | |
| device_id: !input remote | |
| type: short_release | |
| subtype: 3 | |
| id: trigger_lower_press_hue | |
| - alias: Bottom Button Press (via HUE event) | |
| trigger: device | |
| domain: hue | |
| device_id: !input remote | |
| type: short_release | |
| subtype: 4 | |
| id: trigger_bottom_press_hue | |
| - alias: Top Button Press and Hold (via HUE event) | |
| trigger: device | |
| domain: hue | |
| device_id: !input remote | |
| type: repeat | |
| subtype: 1 | |
| id: trigger_top_press_hold_hue | |
| - alias: Brightness Increase Button Press and Hold (via HUE event) | |
| trigger: device | |
| domain: hue | |
| device_id: !input remote | |
| type: repeat | |
| subtype: 2 | |
| id: trigger_raise_press_hold_hue | |
| - alias: Brightness Decrease Button Press and Hold (via HUE event) | |
| trigger: device | |
| domain: hue | |
| device_id: !input remote | |
| type: repeat | |
| subtype: 3 | |
| id: trigger_lower_press_hold_hue | |
| - alias: Bottom Button Press and Hold (via HUE event) | |
| trigger: device | |
| domain: hue | |
| device_id: !input remote | |
| type: repeat | |
| subtype: 4 | |
| id: trigger_bottom_press_hold_hue | |
| conditions: | |
| - alias: "Check if remote to use is set" | |
| condition: template | |
| value_template: "{{ var_remote | count > 0 }}" | |
| actions: | |
| - variables: | |
| var_all_lights_on: >- | |
| {{ expand( var_light ) | selectattr( "state", "eq", "on" ) | map( attribute = "entity_id" ) | list }} | |
| var_all_lights_off: >- | |
| {{ expand( var_light ) | selectattr( "state", "eq", "off" ) | map( attribute = "entity_id" ) | list }} | |
| var_first_light_on: >- | |
| {{ expand( var_light ) | selectattr( "state", "eq", "on" ) | map( attribute = "entity_id" ) | list | first }} | |
| - alias: "Determine button event to execute" | |
| choose: | |
| - alias: "Button: Top, Press" | |
| conditions: | |
| - alias: "Check if triggered by top button press" | |
| condition: trigger | |
| id: trigger_top_press_hue | |
| sequence: | |
| - alias: "Determine event action to trigger" | |
| choose: | |
| - alias: "For Top button press, manage light state" | |
| conditions: | |
| - alias: "Check if should toggle light(s)" | |
| condition: template | |
| value_template: "{{ var_event_button_top == 'Toggle light' }}" | |
| sequence: | |
| - alias: "Toggle light(s) on and off" | |
| if: | |
| - alias: "Check that all light(s) are off" | |
| condition: template | |
| value_template: "{{ var_all_lights_on | length == 0 }}" | |
| then: | |
| - alias: "Check if should adjust brightness when turning on light(s)" | |
| if: | |
| - alias: "Check if light brightness option is greater than 0" | |
| condition: template | |
| value_template: "{{ var_brightness_on_percent | int > 0 }}" | |
| then: | |
| - alias: "Turn on light(s) with the set brightness option" | |
| action: light.turn_on | |
| target: | |
| entity_id: "{{ var_all_lights_off }}" | |
| data: | |
| brightness_pct: !input brightness_on_percent | |
| else: | |
| - alias: "Turn on light(s)" | |
| action: light.turn_on | |
| target: | |
| entity_id: "{{ var_all_lights_off }}" | |
| else: | |
| - alias: "Turn off light(s)" | |
| action: light.turn_off | |
| target: | |
| entity_id: "{{ var_all_lights_on }}" | |
| - alias: "For Top button press, turn on light(s)" | |
| conditions: | |
| - alias: "Check if should toggle light(s)" | |
| condition: template | |
| value_template: "{{ var_event_button_top == 'Turn on light' }}" | |
| sequence: | |
| - alias: "Check if should adjust brightness when turning on light(s)" | |
| if: | |
| - alias: "Check if light brightness option is greater than 0" | |
| condition: template | |
| value_template: "{{ var_brightness_on_percent | int > 0 }}" | |
| then: | |
| - alias: "Turn on light(s) with the set brightness option" | |
| action: light.turn_on | |
| target: | |
| entity_id: "{{ var_all_lights_off }}" | |
| data: | |
| brightness_pct: !input brightness_on_percent | |
| else: | |
| - alias: "Turn on light(s)" | |
| action: light.turn_on | |
| target: | |
| entity_id: "{{ var_all_lights_off }}" | |
| - alias: "For Top button press, run custom action" | |
| conditions: | |
| - alias: "Check if correct action choice is selected" | |
| condition: template | |
| value_template: "{{ var_event_button_top == 'Custom action' }}" | |
| sequence: !input action_button_press_top_single | |
| - alias: "Button: Top, Press and Hold" | |
| conditions: | |
| - alias: "Check if triggered by Top button press and hold" | |
| condition: trigger | |
| id: trigger_top_press_hold_hue | |
| sequence: !input action_button_press_top_hold | |
| - alias: "Button: Increase Brightness, Press" | |
| conditions: | |
| - alias: "Check if triggered by Brightness Increase button press" | |
| condition: trigger | |
| id: trigger_raise_press_hue | |
| sequence: | |
| - alias: "Determine event action to trigger" | |
| choose: | |
| - alias: "For Increase Brightness button press, manage light on/off state" | |
| conditions: | |
| - alias: "Check if correct action choice is selected" | |
| condition: and | |
| conditions: | |
| - alias: "Check if should adjust brightness" | |
| condition: template | |
| value_template: "{{ var_event_buttons_brightness == 'Adjust brightness' }}" | |
| - alias: "Check if light(s) to be controlled are set" | |
| condition: template | |
| value_template: "{{ var_all_lights_on | length > 0 }}" | |
| sequence: | |
| - alias: "Determine if to turn on or increase brightness for light(s)" | |
| if: | |
| - alias: "Check if light(s) are on or off" | |
| condition: state | |
| entity_id: !input light | |
| state: "off" | |
| then: | |
| - alias: "Determine how to turn on light(s)" | |
| if: | |
| - alias: "Check if light brightness option is greater than 0" | |
| condition: template | |
| value_template: "{{ var_brightness_on_percent | int > 0 }}" | |
| then: | |
| - alias: "Turn on light(s) with the configured brightness level" | |
| action: light.turn_on | |
| target: | |
| entity_id: "{{ var_all_lights_off }}" | |
| data: | |
| brightness_pct: !input brightness_on_percent | |
| else: | |
| - alias: "Turn on light(s)" | |
| action: light.turn_on | |
| target: | |
| entity_id: "{{ var_all_lights_off }}" | |
| - alias: "For Increase Brightness button press, run custom action" | |
| conditions: | |
| - alias: "Check if correct action choice is selected" | |
| condition: template | |
| value_template: "{{ var_event_buttons_brightness == 'Custom action' }}" | |
| sequence: !input action_button_press_raise_single | |
| - alias: "Button: Increase Brightness, Press and Hold" | |
| conditions: | |
| - alias: "Check if triggered by Brightness Increase button press and hold" | |
| condition: trigger | |
| id: trigger_raise_press_hold_hue | |
| sequence: | |
| - alias: "Determine event action to trigger" | |
| choose: | |
| - alias: "For Increase Brightness button press, manage light on/off state" | |
| conditions: | |
| - alias: "Check if correct action choice is selected" | |
| condition: and | |
| conditions: | |
| - alias: "Check if should adjust brightness" | |
| condition: template | |
| value_template: "{{ var_event_buttons_brightness == 'Adjust brightness' }}" | |
| - alias: "Check if light(s) to be controlled are set" | |
| condition: template | |
| value_template: "{{ var_all_lights_on | length > 0 }}" | |
| sequence: | |
| - alias: "Increase brightness for light(s) that are on" | |
| action: light.turn_on | |
| target: | |
| entity_id: "{{ var_all_lights_on }}" | |
| data: | |
| brightness_step_pct: "{{ var_brightness_step * 1 | int }}" | |
| - alias: "For Increase Brightness button press and hold, run custom action" | |
| conditions: | |
| - alias: "Check if correct action choice is selected" | |
| condition: template | |
| value_template: "{{ var_event_buttons_brightness == 'Custom action' }}" | |
| sequence: !input action_button_press_raise_hold | |
| - alias: "Button: Decrease Brightness, Press" | |
| conditions: | |
| - alias: "Check if triggered by Brightness Decrease button press" | |
| condition: trigger | |
| id: trigger_lower_press_hue | |
| sequence: | |
| - alias: "Determine event action to trigger" | |
| choose: | |
| - alias: "For Decrease Brightness button press, manage light on/off state" | |
| conditions: | |
| - alias: "Check if correct action choice is selected" | |
| condition: and | |
| conditions: | |
| - alias: "Check if should adjust brightness" | |
| condition: template | |
| value_template: "{{ var_event_buttons_brightness == 'Adjust brightness' }}" | |
| - alias: "Check if light(s) to be controlled are set" | |
| condition: template | |
| value_template: "{{ var_all_lights_on | length > 0 }}" | |
| sequence: | |
| - alias: "Decrease brightness for light(s) that are on" | |
| action: light.turn_on | |
| target: | |
| entity_id: "{{ var_all_lights_on }}" | |
| data: | |
| brightness_step_pct: "{{ var_brightness_step * -1 | int }}" | |
| - alias: "For Decrease Brightness button press, run custom action" | |
| conditions: | |
| - alias: "Check if correct action choice is selected" | |
| condition: template | |
| value_template: "{{ var_event_buttons_brightness == 'Custom action' }}" | |
| sequence: !input action_button_press_lower_single | |
| - alias: "Button: Decrease Brightness, Press and Hold" | |
| conditions: | |
| - alias: "Check if triggered by Brightness Decrease button press and hold" | |
| condition: trigger | |
| id: trigger_lower_press_hold_hue | |
| sequence: | |
| - alias: "Determine event action to trigger" | |
| choose: | |
| - alias: "For Decrease Brightness button press, manage light on/off state" | |
| conditions: | |
| - alias: "Check if correct action choice is selected" | |
| condition: and | |
| conditions: | |
| - alias: "Check if should adjust brightness" | |
| condition: template | |
| value_template: "{{ var_event_buttons_brightness == 'Adjust brightness' }}" | |
| - alias: "Check if light(s) to be controlled are set" | |
| condition: template | |
| value_template: "{{ var_all_lights_on | length > 0 }}" | |
| sequence: | |
| - alias: "Decrease brightness for light(s) that are on" | |
| action: light.turn_on | |
| target: | |
| entity_id: "{{ var_all_lights_on }}" | |
| data: | |
| brightness_step_pct: "{{ var_brightness_step * -1 | int }}" | |
| - alias: "For Decrease Brightness button press and hold, run custom action" | |
| conditions: | |
| - alias: "Check if correct action choice is selected" | |
| condition: template | |
| value_template: "{{ var_event_buttons_brightness == 'Custom action' }}" | |
| sequence: !input action_button_press_lower_hold | |
| - alias: "Button: Bottom, Press" | |
| conditions: | |
| - alias: "Check if triggered by bottom button press" | |
| condition: trigger | |
| id: trigger_bottom_press_hue | |
| sequence: | |
| - alias: "Determine event action to trigger" | |
| choose: | |
| - alias: "For Bottom button press, turn off light(s)" | |
| conditions: | |
| - alias: "Check if correct action choice is selected" | |
| condition: and | |
| conditions: | |
| - alias: "Check if should turn off light(s)" | |
| condition: template | |
| value_template: "{{ var_event_button_bottom == 'Turn off light' }}" | |
| - alias: "Check if any light(s) are currently on" | |
| condition: template | |
| value_template: "{{ var_all_lights_on | length > 0 }}" | |
| sequence: | |
| - alias: "Turn off light(s)" | |
| action: light.turn_off | |
| target: | |
| entity_id: "{{ var_all_lights_on }}" | |
| - alias: "For Bottom button press, run custom action" | |
| conditions: | |
| - alias: "Check if correct action choice is selected" | |
| condition: template | |
| value_template: "{{ var_event_button_bottom == 'Custom action' }}" | |
| sequence: !input action_button_press_bottom_single | |
| - alias: "Button: Bottom, Press and Hold" | |
| conditions: | |
| - alias: "Check if triggered by Bottom button press and hold" | |
| condition: trigger | |
| id: trigger_bottom_press_hold_hue | |
| sequence: !input action_button_press_bottom_hold |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment