Philips Hue Tap Dial Switch - ZHA

If the tap dial supports it in ZHA, it should only be a matter of replacing command == 'step_with_on_off' with command == 'step' in the blueprint.

Both are valid zigbee commands, but it would depend on the device cluster and whether it was implemented with the quirks.

1 Like

Sorry for the late reply, I’m using the following:

So far it works great, it can control 4 different lightgroups and also dim them separately!!

Thank you for your template, I mixed your and @timothi’s and created one that uses all 4 buttons and mqtt-action sensor (not listening to mqtt topic)

For anyone that stubles upon this: Create a new folder/file in your blueprints-folder and add this, reload and its ready to go :slight_smile:

blueprint:
  name: Zigbee2MQTT - Hue Tap Dail 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.
    example value zigbee2mqtt/0x001788010d7d3cac/action
    source https://community.home-assistant.io/t/philips-hue-tap-dial-switch-zha/446636/114

    '
  domain: automation
  input:
    button_sensor:
      name: Philips Hue Tap dial switch sensor entity
      description: Sensor for Philips Hue Tap dial switch to use (Use sensor with
        entity_id ends with _action)
      selector:
        entity:
          domain:
          - sensor
          multiple: false
    remote_button_1_single_press:
      name: Button 1 Single Press
      description: The light(s) to control with first button
      selector:
        target:
          entity:
          - domain:
            - light
    remote_button_2_single_press:
      name: Button 2 Single Press
      description: The light(s) to control with second button
      selector:
        target:
          entity:
          - domain:
            - light
    remote_button_3_single_press:
      name: Button 3 Single Press
      description: The light(s) to control with third button
      selector:
        target:
          entity:
          - domain:
            - light
    remote_button_4_single_press:
      name: Button 4 Single Press
      description: The light(s) to control with fourth button
      selector:
        target:
          entity:
          - domain:
            - light
    current_button:
      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
          multiple: false
    dim_scale:
      name: Diming Scale
      description: Scale factor for the dimming. This value will be multiplied by
        the value given from the dial. So lower number, more gradual dimming. Larger
        number, faster dimming.
      default: 3.0
      selector:
        number:
          min: 0.0
          max: 5.0
          step: 0.01
          mode: slider
    dim_time:
      name: Diming time
      description: How long it takes to dim one step
      default: 0.5
      selector:
        number:
          min: 0.1
          max: 1.0
          step: 0.01
          mode: slider
  source_url: https://github.com/AnderssonPeter/HomeAssistantBlueprints/blob/65f08a396a2d6e259b6b5f3a40e9b51a48ca0b8c/HueTapDailSwitch.yaml
mode: restart
max_exceeded: silent
variables:
  remote_button_1_single_press: !input remote_button_1_single_press
  remote_button_2_single_press: !input remote_button_2_single_press
  remote_button_3_single_press: !input remote_button_3_single_press
  remote_button_4_single_press: !input remote_button_4_single_press
  current_button: !input current_button
  dim_scale: !input dim_scale
  lights:
    remote_button_1_single_press: !input remote_button_1_single_press
    remote_button_2_single_press: !input remote_button_2_single_press
    remote_button_3_single_press: !input remote_button_3_single_press
    remote_button_4_single_press: !input remote_button_4_single_press
trigger:
- platform: state
  entity_id: !input button_sensor
  to: button_1_press
- platform: state
  entity_id: !input button_sensor
  to: button_2_press
- platform: state
  entity_id: !input button_sensor
  to: button_3_press
- platform: state
  entity_id: !input button_sensor
  to: button_4_press
- platform: state
  entity_id: !input button_sensor
  to: dial_rotate_left_step
- platform: state
  entity_id: !input button_sensor
  to: dial_rotate_left_slow
- platform: state
  entity_id: !input button_sensor
  to: dial_rotate_left_fast
- platform: state
  entity_id: !input button_sensor
  to: dial_rotate_right_step
- platform: state
  entity_id: !input button_sensor
  to: dial_rotate_right_slow
- platform: state
  entity_id: !input button_sensor
  to: dial_rotate_right_fast
action:
- variables:
    action: '{{ trigger.to_state.state }}'
- choose:
  - conditions: '{{ action == ''button_1_press'' }}'
    sequence:
    - service: light.toggle
      target: !input remote_button_1_single_press

    - choose:
      - conditions: '{{ current_button != none }}'
        sequence:
        - service: input_text.set_value
          target:
            entity_id: !input current_button
          data:
            value: remote_button_1_single_press
  - conditions: '{{ action == ''button_2_press'' }}'
    sequence:
    - service: light.toggle
      target: !input remote_button_2_single_press
    - choose:
      - conditions: '{{ current_button != none }}'
        sequence:
        - service: input_text.set_value
          target:
            entity_id: !input current_button
          data:
            value: remote_button_2_single_press
  - conditions: '{{ action == ''button_3_press'' }}'
    sequence:
    - service: light.toggle
      target: !input remote_button_3_single_press
    - choose:
      - conditions: '{{ current_button != none }}'
        sequence:
        - service: input_text.set_value
          target:
            entity_id: !input current_button
          data:
            value: remote_button_3_single_press
  - conditions: '{{ action == ''button_4_press'' }}'
    sequence:
    - service: light.toggle
      target: !input remote_button_4_single_press
    - choose:
      - conditions: '{{ current_button != none }}'
        sequence:
        - service: input_text.set_value
          target:
            entity_id: !input current_button
          data:
            value: remote_button_4_single_press
  - conditions:
    - '{{ action == ''dial_rotate_left_step'' }}'
    sequence:
    - choose:
      - conditions: '{{ current_button != none }}'
        sequence:
        - service: light.turn_on
          target: '{{ lights[states(current_button)] }}'
          data:
            brightness_step_pct: '{{ -dim_scale }}'
            transition: !input dim_time
      default:
      - service: light.turn_on
        target: !input remote_button_1_single_press
        data:
          brightness_step_pct: '{{ -dim_scale }}'
          transition: !input dim_time
  - conditions:
    - '{{ action == ''dial_rotate_right_step'' }}'
    sequence:
    - choose:
      - conditions: '{{ current_button != none }}'
        sequence:
        - service: light.turn_on
          target: '{{ lights[states(current_button)] }}'
          data:
            brightness_step_pct: '{{ dim_scale }}'
            transition: !input dim_time
      default:
      - service: light.turn_on
        target: !input remote_button_1_single_press
        data:
          brightness_step_pct: '{{ dim_scale }}'
          transition: !input dim_time
  - conditions:
    - '{{ action == ''dial_rotate_left_slow'' }}'
    sequence:
    - choose:
      - conditions: '{{ current_button != none }}'
        sequence:
        - service: light.turn_on
          target: '{{ lights[states(current_button)] }}'
          data:
            brightness_step_pct: '{{ -dim_scale * 2 }}'
            transition: !input dim_time
      default:
      - service: light.turn_on
        target: !input remote_button_1_single_press
        data:
          brightness_step_pct: '{{ -dim_scale * 2 }}'
          transition: !input dim_time
  - conditions:
    - '{{ action == ''dial_rotate_right_slow'' }}'
    sequence:
    - choose:
      - conditions: '{{ current_button != none }}'
        sequence:
        - service: light.turn_on
          target: '{{ lights[states(current_button)] }}'
          data:
            brightness_step_pct: '{{ dim_scale * 2 }}'
            transition: !input dim_time
      default:
      - service: light.turn_on
        target: !input remote_button_1_single_press
        data:
          brightness_step_pct: '{{ dim_scale * 2 }}'
          transition: !input dim_time
  - conditions:
    - '{{ action == ''dial_rotate_left_fast'' }}'
    sequence:
    - choose:
      - conditions: '{{ current_button != none }}'
        sequence:
        - service: light.turn_on
          target: '{{ lights[states(current_button)] }}'
          data:
            brightness_step_pct: '{{ -dim_scale * 5 }}'
            transition: !input dim_time
      default:
      - service: light.turn_on
        target: !input remote_button_1_single_press
        data:
          brightness_step_pct: '{{ -dim_scale * 5 }}'
          transition: !input dim_time
  - conditions:
    - '{{ action == ''dial_rotate_right_fast'' }}'
    sequence:
    - choose:
      - conditions: '{{ current_button != none }}'
        sequence:
        - service: light.turn_on
          target: '{{ lights[states(current_button)] }}'
          data:
            brightness_step_pct: '{{ dim_scale * 5 }}'
            transition: !input dim_time
      default:
      - service: light.turn_on
        target: !input remote_button_1_single_press
        data:
          brightness_step_pct: '{{ dim_scale * 5 }}'
          transition: !input dim_time

1 Like

Thank you for your work.
Could you please give me a hint how to set up the Text Helper correctly?

  • If not set up a Text Helper, the dial only works for the lamp on the 1st button (generally all 4 lamps are dimmable).
  • If set up, nothing happens when turning the dial.

What I did:
1st I set up a Text Helper (as there wasn’t any information here, I took a template from another website):

Then I just choosed it in your blueprint by the dropdown menu:

So what to do to set it up correctly please?

The regex that you setup would be preventing it from storing the value it needs to store. Remove that and it should work fine.

Thank you for trying to help!
But no joy, I’m sorry. Emptied the “Regex pattern” field, saved, started HA new, but no change.
What I wonder about: How does the helper know the last input from the Hue Tap? Where is the input? Maybe I missed an important requirement?

Edit:
Found a “traces” button and got this:

But where does it miss the id?

Any idea somebody? Any help appreciated

Is there any way to replicate the original behavior of the dial?
Let’s say I assign a scene to a button that turn on 2 out of 3 lights, the dial only affects the lights that are already on and have no impact on the lights that are off.

I’ve never put anything in here but it only ever adjusts the brightness of the light on button 1, even if it’s off it’ll dial up the brightness and turn it on. Any hints on how to set this up please? Pretend I don’t know yaml or regex!

Not exactly original. But I currently combined this script with the other script for the hue dial tab.

It’s still work in progress but as workaround you could try to set the lights (for dimming) and then define a custom action that start the scene.

For some reason the dimming is not working in HA for scenes although scenes have all the lights enteties as attribut. One could surely do it in the blueprint but I could not find a quick solution yet and that.