ZHA - Hue Dimmer Switch - RWL022 - Blueprint

Hello! My first blueprint, so one to share with you.

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

Features:
Using ZHA, use this blueprint to listen for events from a Hue Dimmer RWL022 switch. Bind two light entities to the switch, one for the power button and one for the hue button. For example, have your main light bound to the power button and your lamps bound to the hue button. Then you can turn both lights on an off independently and use the middle dimmer buttons to dim the lights, depending on which lights are on at the time. With both lights turned off, press the dimmer up button once to set both lights to a low brightness. Good for walking around at night.

Requires;

  • Hue Dimmer Switch, RWL022 (UK Version 2 Switch)
  • Two objects in Home Assistant under the domain ‘light’.
  • Integration for the Dimmer Switch using ZHA. It cannot be imported using another method.
blueprint:
  name: Philips Hue Dimmer RWL022
  description:
    "Control lights with a Philips Hue Dimmer Switch (v2).\n\n Blueprint\
    \ Version: 1"
  domain: automation
  input:
    remote:
      name: Philips Hue Dimmer Switch
      description: Pick a RWL022 Dimmer Switch
      selector:
        device:
          integration: zha
          entity:
            domain: sensor
            device_class: battery
    power_light:
      name: The main light entity to control.
      description: The light entity which the top button will control. (Power button).
      selector:
        entity:
          domain: light
    hue_light:
      name: The secondary light entity to control.
      description: The light entity which the bottom button will control. (hue button).
      selector:
        entity:
          domain: light
  source_url: https://gist.github.com/ODickins/eb3fdfd52af13d4511ff6f1b2a5952f6
mode: restart
max_exceeded: silent
variables:
  power_light: !input "power_light"
  hue_light: !input "hue_light"
trigger:
  - platform: event
    event_type: zha_event
    event_data:
      device_id: !input "remote"
      cluster_id: 64512
action:
  - variables:
      command: "{{ trigger.event.data.command }}"
      power_light_on: "{{ states(power_light) == 'on' }}"
      hue_light_on: "{{ states(hue_light) == 'on' }}"
  - choose:
      - conditions: "{{ command == 'on_press' }}"
        sequence:
          - choose:
              - conditions:
                  - "{{ power_light_on == true }}"
                sequence:
                  service: light.turn_off
                  data:
                    entity_id: !input "power_light"
                    transition: 1
              - conditions:
                  - "{{ power_light_on == false }}"
                sequence:
                  service: light.turn_on
                  data:
                    entity_id: !input "power_light"
                    transition: 1
                    brightness: 255
      - conditions: "{{ command == 'off_press' }}"
        sequence:
          - choose:
              - conditions:
                  - "{{ hue_light_on == true }}"
                sequence:
                  service: light.turn_off
                  data:
                    entity_id: !input "hue_light"
                    transition: 1
              - conditions:
                  - "{{ hue_light_on == false }}"
                sequence:
                  service: light.turn_on
                  data:
                    entity_id: !input "hue_light"
                    transition: 1
                    brightness: 255
      - conditions:
          - condition: or
            conditions:
              - "{{ command == 'up_press' }}"
              - "{{ command == 'up_hold' }}"
        sequence:
          - choose:
              - conditions:
                  - "{{ power_light_on == false }}"
                  - "{{ hue_light_on == false }}"
                sequence:
                  service: light.turn_on
                  data:
                    entity_id:
                      - !input "power_light"
                      - !input "hue_light"
                    transition: 1
                    brightness: 26
              - conditions:
                  - "{{ power_light_on == true }}"
                  - "{{ hue_light_on == true }}"
                sequence:
                  service: light.turn_on
                  data:
                    entity_id:
                      - !input "power_light"
                      - !input "hue_light"
                    transition: 1
                    brightness_step: 25
              - conditions:
                  - "{{ power_light_on == true }}"
                sequence:
                  service: light.turn_on
                  data:
                    entity_id:
                      - !input "power_light"
                    transition: 1
                    brightness_step: 25
              - conditions:
                  - "{{ hue_light_on == true }}"
                sequence:
                  service: light.turn_on
                  data:
                    entity_id:
                      - !input "hue_light"
                    transition: 1
                    brightness_step: 25
      - conditions:
          - condition: or
            conditions:
              - "{{ command == 'down_press' }}"
              - "{{ command == 'down_hold' }}"
        sequence:
          - choose:
              - conditions:
                  - "{{ power_light_on == true }}"
                  - "{{ hue_light_on == true }}"
                sequence:
                  service: light.turn_on
                  data:
                    entity_id:
                      - !input "power_light"
                      - !input "hue_light"
                    transition: 1
                    brightness_step: -25
              - conditions:
                  - "{{ power_light_on == true }}"
                sequence:
                  service: light.turn_on
                  data:
                    entity_id:
                      - !input "power_light"
                    transition: 1
                    brightness_step: -25
              - conditions:
                  - "{{ hue_light_on == true }}"
                sequence:
                  service: light.turn_on
                  data:
                    entity_id:
                      - !input "hue_light"
                    transition: 1
                    brightness_step: -25
1 Like

Awesome blueprint. Any likelihood of you adding a double press or long press actions to it? I want to use a long press to toggle color temperature (warm vs cool) of my main lights.

:wave:Hi.

Glad you like it, it’s just a blueprint I was playing around with Home Assistant while waiting for my new home purchase to go through. So I haven’t actually implemented it for the reason I created it (yet) and will be doing soon.

I’ll see what I can do once I get back to getting Home Assistant installed and setup in my new house, since I’ve just got in this last week.

Thanks.

This integration is great for quick and easy controlling of a light. I had been using it to control the light in my nursery for a few months.

More recently I needed a blueprint with more configuration options so I created a new version earlier this week which is a little more complicated than this blueprint but gives you more explicit control over 1x, 2x, 3x, 4x, 5x, release, long hold, and long release for each button. Just wanted to share it here for others who may be interested.

I’ve forked your Blueprint and made the steps configurable. Also I modified to to use light.toggle to it preserves previous state and brightness level.

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

Source: Philips Hue Dimmer RWL022 · GitHub

I’ve been using this blueprint for a few years, but since a few Home Assistant updates it doesn’t work well anymore, it turns the lights on but doesn’t turn them off, and the light dimmer doesn’t work well anymore.

Do you have any solutions?

Thanks