Philips Hue Tap Dial Switch - ZHA

Requires the Philips Hue Tap Dial Switch and at least one light to be controlled.

Turn on/off light(s) using the dial switch. Each of the four buttons can control a different light(s). If you setup the optional current input_text, it will dim the most recent light with the dial.

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

blueprint:
  name: Philips Tap Dial Switch
  description: 'Control lights with a Philips Hue Tap Switch.
    Use the four buttons to control up to four light(s) with an on/off toggle. The dial can be used to dim the most recently used light.
    '
  domain: automation
  input:
    remote:
      name: Philips Hue Tap Switch
      selector:
        device:
          integration: zha
          manufacturer: Signify Netherlands B.V.
          model: RDM002
    first_light:
      name: First Light
      description: The light(s) to control with first button
      selector:
        target:
          entity: {}
    second_light:
      name: (OPTIONAL) Second Light
      description: The light(s) to control with second button
      default: {}
      selector:
        target:
          entity: {}
    third_light:
      name: (OPTIONAL) Third Light
      description: The light(s) to control with third button
      default: {}
      selector:
        target:
          entity: {}
    forth_light:
      name: (OPTIONAL) Forth Light
      description: The light(s) to control with forth button
      default: {}
      selector:
        target:
          entity: {}
    current_light:
      name: (OPTIONAL) Current Light
      description:
        'Text helper to track the current light to dim. Set for the dimmer controls to change which light they are controlling according to the last one turned on.'
      default:
      selector:
        entity:
          domain: input_text
  source_url: https://github.com/apollo1220/blueprints/blob/4796905403fc9ffb79745d964df3a67139fc4c6b/philips_zigbee_dial.yaml
mode: restart
max_exceeded: silent
variables:
  first_light: !input "first_light"
  second_light: !input "second_light"
  third_light: !input "third_light"
  forth_light: !input "forth_light"
  current_light: !input "current_light"
  lights:
    first_light: !input "first_light"
    second_light: !input "second_light"
    third_light: !input "third_light"
    forth_light: !input "forth_light"
trigger:
  - platform: event
    event_type: zha_event
    event_data:
      device_id: !input "remote"
action:
  - variables:
      command: "{{ trigger.event.data.command }}"
      args: "{{ trigger.event.data.args }}"
      params: "{{ trigger.event.data.params }}"
      scene: "{{ trigger.event.data.params.scene_id }}"
      step_mode: "{{ trigger.event.data.params.step_mode }}"
      step_size: "{{ trigger.event.data.params.step_size }}"
  - choose:
      - conditions:
          - "{{ command == 'recall' }}"
          - "{{ scene == 1 }}"
        sequence:
          - service: homeassistant.toggle
            target: !input "first_light"
          - choose:
              - conditions: "{{ current_light != none }}"
                sequence:
                  - service: input_text.set_value
                    target:
                      entity_id: !input "current_light"
                    data:
                      value: first_light
      - conditions:
          - "{{ command == 'recall' }}"
          - "{{ second_light != none }}"
          - "{{ scene == 0 }}"
        sequence:
          - service: homeassistant.toggle
            target: !input "second_light"
          - choose:
              - conditions: "{{ current_light != none }}"
                sequence:
                  - service: input_text.set_value
                    target:
                      entity_id: !input "current_light"
                    data:
                      value: second_light
      - conditions:
          - "{{ command == 'recall' }}"
          - "{{ third_light != none }}"
          - "{{ scene == 5 }}"
        sequence:
          - service: homeassistant.toggle
            target: !input "third_light"
          - choose:
              - conditions: "{{ current_light != none }}"
                sequence:
                  - service: input_text.set_value
                    target:
                      entity_id: !input "current_light"
                    data:
                      value: third_light
      - conditions:
          - "{{ command == 'recall' }}"
          - "{{ forth_light != none }}"
          - "{{ scene == 4 }}"
        sequence:
          - service: homeassistant.toggle
            target: !input "forth_light"
          - choose:
              - conditions: "{{ current_light != none }}"
                sequence:
                  - service: input_text.set_value
                    target:
                      entity_id: !input "current_light"
                    data:
                      value: forth_light
      - conditions:
          - "{{ command == 'step_with_on_off' }}"
          - "{{ step_mode == 'StepMode.Up' }}"
        sequence:
          - choose:
              - conditions: "{{ current_light != none }}"
                sequence:
                  - service: light.turn_on
                    target: "{{ lights[states(current_light)] }}"
                    data:
                      brightness_step_pct: "{{ step_size }}"
                      transition: 1
            default:
              - service: light.turn_on
                target: !input "first_light"
                data:
                  brightness_step_pct: "{{ step_size }}"
                  transition: 1
      - conditions:
          - "{{ command == 'step_with_on_off' }}"
          - "{{ step_mode == 'StepMode.Down' }}"
        sequence:
          - choose:
              - conditions: "{{ current_light != none }}"
                sequence:
                  - service: light.turn_on
                    target: "{{ lights[states(current_light)] }}"
                    data:
                      brightness_step_pct: "{{ -step_size }}"
                      transition: 1
            default:
              - service: light.turn_on
                target: !input "first_light"
                data:
                  brightness_step_pct: "{{ -step_size }}"
                  transition: 1

I’ve been trying this blueprint with a tap dial and keep getting this error? I’ve even tried setting it up with only one light but still get the same error?
Executed: August 12, 2022 at 10:54:53 PM

Error: UndefinedError: ‘dict object’ has no attribute ‘event’
What am I doing wrong?

Are you trying to test it by using the ‘Run Actions’ in the UI? In that case the trigger object wouldn’t have an event which would result in this error. That is the only place an ‘event’ attribute is being referenced. If you trigger it using the buttons on the device, then it should have an event and work. This is the part the error would be coming from:

  - variables:
      command: "{{ trigger.event.data.command }}"
      args: "{{ trigger.event.data.args }}"
      params: "{{ trigger.event.data.params }}"
      scene: "{{ trigger.event.data.params.scene_id }}"
      step_mode: "{{ trigger.event.data.params.step_mode }}"
      step_size: "{{ trigger.event.data.params.step_size }}"

That was exactly what I was doing. It works perfectly. Thanks for the help and for writing the blueprint!

Really like this. I can’t figure out exactly what to put in the optional field to have the dimmer dial control the current or last button/ light pushed. It always defaults to the first light. I’ve tried Current Light and current_light. If i’m setting the automation up through the ui what should i fill in?

Settings > Devices & Service > Helpers. Create a Text helper which will be used for saving the state. Go back to the blueprint and select that new helper.

Got it working. Thaks so much