ZHA - Philips Hue Tap Switch Mini - Custom Controls (RDM002)

Important Note: RMD002 support is added to the November 2024 release of Home Assistant. This blueprint will not work with earlier versions.

This blueprint enables complete automation of a Philips Hue Tap Dial/Switch (RMD002) control. This includes support for rotation events as well as long press and single, double, triple, and quadruple presses of all buttons.

I’ve made another blueprint which is pre-configured for control of a “Media Player” device such as Sonos, Roon, and others. That blueprint can be found here: ZHA - Philips Hue Tap Switch Media Controls (RDM002)

How To:

  • Install the blueprint
  • Select your RDM002 controller
  • Follow the detailed description in the blueprint to customize all actions

This blueprint support velocity-sensitive control of the dial which means that you can provide different actions depending on how quickly the dial is rotated. Complete instructions are provided within the blueprint.

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

This illustrates the blueprint’s support for rotation controls. The first section is used to tweak how “small”, “medium”, and “large” rotations are determined. Below that are the automations you want to occur for each direction and size of rotation. Logbook support is available to help debug and tweak how this works for your individual setup.

This illustrates the blueprint’s support for all of the various types of button events for a specific button. The customizations exist for buttons 1, 2, 3, and 4.

Blueprint code is available at this gist.

2 Likes

Hi! Thanks for this BP this is exactly what I was looking for a while now. :slight_smile: Slight notice, somehow the double and multiple press doesn’t work. If I check it in the traces, it shows me that it somehow completely passes the code lines on the side and comes nothing out. Press or hold works as intended.

1 Like

Hello and thank you very much. Looks like zha is reognizing the different press typees now, which is great.

fyi. I had to adapt the command for all buttons in your blueprint like from “button_1_double” to “button_1_double_press”.

Thanks for this info. I’m sorry about the bugs. I’m traveling now but will be home in a week and will fix the issues in an update.

Loving this blueprint! It is working beautifully in the kitchen to control the music.

Question for you… Is there any way to have it control the volume of a group of speakers? I currently have this configured to control the Sonos speaker in my Kitchen. But we fairly regularly group the Living Room, Office, and/or Living Room (also all Sonos). It could be any permutation of those four zones, so unfortunately, I can’t set it up to always be the the same 2 or 3 combined as it regularly changes. As it stands right now, it will just control the Kitchen when they are grouped.

Appreciate the work on this! Thank you!

The blueprint has been updated to fix multi-press events. You can re-install with the installation button in the first post. Sorry for the issues.

Thank you to @LightBringer81 and @Schurki for reporting the issue.

2 Likes

Is there a good way to set this up in a way for the dial to control dimming of an area?

Most definitely.

You just need to provide behaviors for the three clockwise and three counter clockwise rotation events.

For each, just choose “Add Action”, then “Light”. Then choose the specific light device or the area that contains the lights you want to control and set the brightness step. You can play with what you want the brightness step to be for small, medium, and large rotations. You can make them all the same or give them different values based on the behavior you like.

It’s pretty straightforward.

Thanks for the idea, I’ll try it out! I was hoping it the brightness could be automatically proportional to how much the dial has been turned, but I will try my had at advanced automation one of these days

It will be proportional to how much it’s turned if you automate it the way I described.

A small turn of the dial will change the light a little bit. A medium turn of the dial will change it more. A large turn will change it even more.

First up, big thanks to @gTunes !

I liked the original, but because I use mine for lights, I though it’s more appropriate to just have two actions for rotation: Clockwise and Counter-Clockwise.

To still have proportional dimming, I just pass the step_size to the script I use for controlling the lights, this in turn calculates the brightness_step to adjust the lights by, assuming the dial’s step size is proportional to degrees turned, which seems to be the case (more or less).

This way you have more granular control. This is probably as close as you can get to having realtime control of lights using the Philips dial in Home Assistant using ZHA. Using this setup, I have a minimum brightness_step of about 5, which is perfect for my purposes.

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

Bugs fixed:

  • Long Pressing Buttons also triggered rotation action
    • Holding down one of the buttons also fires a step_with_on_off zha event with a transition_time of 8
  • Rotation action doesn’t always fire
    • When turning the dial I noticed that sometimes the action wouldn’t fire, this was cause because the step_mode can also be 0 and 1 not just StepMode.Up/Down
  • Warnings in Log
    • Because the variables were always rendered even when pressing buttons, you would get warnings in the logs. I removed unused variables and made them render conditionally so the step_size and step_mode are only accessed/rendered if the dial is turned

This is what an action with the step_size looks like:

action: script.dial_dimmer
metadata: {}
data:
  dial_helper: input_text.dial_1_helper
  step_size: "{{ step_size }}"
enabled: true

I use it together with this script I made:

alias: Dial Dimmer
mode: restart
sequence:
  - if:
      - condition: template
        value_template: "{{ is_negative }}"
    then:
      - action: light.turn_on
        metadata: {}
        data_template:
          entity_id: "{{ states(dial_helper) }}"
          brightness_step: "{{ -1 * (255 * (step_size) | int / 360) | int }}"
    else:
      - action: light.turn_on
        metadata: {}
        data_template:
          entity_id: "{{ states(dial_helper) }}"
          brightness_step: "{{ (255 * (step_size) | int / 360) | int }}"
fields:
  step_size:
    selector:
      number:
        min: 1
        max: 360
        step: 1
    name: Step Size
    required: true
  dial_helper:
    selector:
      entity: {}
    required: true
    name: Dial Helper
    description: The Input Text to get the lights entity id from
  is_negative:
    selector:
      boolean: {}
    name: is_negative
    default: false
    required: true

(the dial_helper is something I came up with, to be able to dim different zones with one dial. It saves the last selected light’s entity id. So this way I can have the dial controll different lamps with the rotary encoder)

alias: Dial Zone Updater
sequence:
  - action: input_text.set_value
    metadata: {}
    data:
      entity_id: "{{ dial_helper }}"
      value: "{{ lights }}"
  - condition: template
    value_template: "{{ feedback }}"
  - action: light.toggle
    metadata: {}
    data_template:
      entity_id: "{{ lights }}"
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 250
  - action: light.toggle
    metadata: {}
    data_template:
      entity_id: "{{ lights }}"
fields:
  dial_helper:
    selector:
      entity: {}
    required: true
    name: Dial Helper
    description: The Input Text to update with the entity Id of the lights
  lights:
    selector:
      entity: {}
    name: Lights
    description: The entity Id of the lights to be controlled
    required: true
  feedback:
    selector:
      boolean: {}
    name: Feedback
    description: Enable to pulse the lights (toggle twice with short delay)
    default: true
    required: true

Hi, @david_kalbermatten.

Thanks for sharing your blueprint and for crediting mine as inspiration :slight_smile:

You might be better off with a new thread for you blueprint rather than posting it here, in mine. A new thread will make it discoverable and will also allow you to have conversations with your users without those being intermixed with discussions of this blueprint.

The issue you identified with long presses generating step events was, coincidentally, very recently discovered by another user and was being discussed on the PR thread for the RDM002 changes. A new issue was created today to track it: [BUG] Philips RDM002 long press indistinguishable from dial left rotation · Issue #3696 · zigpy/zha-device-handlers · GitHub

Your observation that we may be able to use transition_time to discriminate the events is very helpful. I’m investigating using that workaround in my blueprints until (or unless) the underlying issue gets fixed.

I’m working on another Blueprint which is based on yours as a start but with more functions added, like dimming/volume per button so it gets more multi functional.

I managed to filter out the wrong long press commands with:

conditions: "{{ command == 'step_with_on_off' and step_mode == 'StepMode.Down' and step_size != 255 }}"

I uploaded my own Blueprint as well.

I didn’t see @david_kalbermatten already made the fixes, but the same are fixed in my Blueprint as well.