Philips Hue Tap Dial Switch - Zigbee2MQTT

I’d like to add to that. How would you implement the following: With the 4 buttons you select the devices (e.g. lights) and with the dial you set the brightness / volume etc.?

Haven’t finalized the automations yet, but my approach is as follows:

  1. With a long press in each of the four buttons, I toggle the respective light on/off.
  2. A short press on each button simply ‘selects’ the light I want to dim by storing the number between 1 and 4 in a number helper - same light as for the toggle functionality of that button, of course.
  3. Based on the value of the helper number set in 2 a set of 4 automations triggers the correct light to dim when I turn the wheel (the other three automations that are based on the same trigger simply stop at the condition for the correct helper number). This could probably be set up with one automation and some if then selections in the automation, but as long as there’s no else if it gets all a little busy with multiple layers of if thens.

I tried to switch the short/long press functionalit for selection/toggling but figure out that a long press always seems to invoke the action for a short press at the same time.

1 Like

Did anyone found a solution yet, how to increase or decrease the volume of a media_player entity through the Dial?

Here’s the yaml code from the blueprint I use:

    remote_dial_rotate_left_step:
      - service: script.turn_on
        data: {}
        target:
          entity_id: script.allhome_volume_down
    remote_dial_rotate_left_slow:
      - repeat:
          count: 2
          sequence:
            - service: script.turn_on
              data: {}
              target:
                entity_id: script.allhome_volume_down
    remote_dial_rotate_left_fast:
      - repeat:
          count: 3
          sequence:
            - service: script.turn_on
              data: {}
              target:
                entity_id: script.allhome_volume_down
    remote_dial_rotate_right_step:
      - service: script.turn_on
        data: {}
        target:
          entity_id: script.allhome_volume_up
    remote_dial_rotate_right_slow:
      - repeat:
          count: 2
          sequence:
            - service: script.turn_on
              data: {}
              target:
                entity_id: script.allhome_volume_up
    remote_dial_rotate_right_fast:
      - repeat:
          count: 3
          sequence:
            - service: script.turn_on
              data: {}
              target:
                entity_id: script.allhome_volume_up
      - service: script.toggle_dr_high_bar
        data: {}

And here are the scripts that the actions are calling:

  1. For turning the volume down:
alias: AllHome Volume Down
sequence:
  - service: media_player.volume_set
    target:
      entity_id: media_player.allhome
    data_template:
      volume_level: "{{ state_attr('media_player.allhome', 'volume_level') - 0.02 }}"
mode: queued
icon: mdi:volume-minus
max: 5

and for turning the volume up:

sequence:
  - service: media_player.volume_set
    target:
      entity_id: media_player.allhome
    data_template:
      volume_level: "{{ state_attr('media_player.allhome', 'volume_level') + 0.04 }}"
mode: queued
alias: AllHome Volume Up
icon: mdi:volume-plus
max: 5

I use scripts because I have a few other automations that I use to turn the volume up or down.

By pressing one of the four buttons just before I turn the dial I can also invoke other actions, e.g. change the brightness of a smart light bulb.

Can you share this part with the helper and stuff?

Thanks for all the other parts you have shared.

I copied this together from the blueprint and some scripts - hope you can make sense of it.

The helper called input_number.hue_tapdialswitch_02_selection holds the value which button has just been pushed.

Here is the part of the blueprint that toggles the entity or selects it for the volume/brightness to be adjusted:

alias: Hue TapDialSwitch 02 - Actions
description: ""
use_blueprint:
  path: freakshock88/philips_hue_tap_dial_switch_zigbee2mqtt_actions_blueprint.yaml
  input:
    button_sensor: sensor.hue_tapdialswitch_02_action
    remote_button_1_single_press:
      - service: input_number.set_value
        data:
          value: 1
        target:
          entity_id: input_number.hue_tapdialswitch_02_selection
        enabled: true
    remote_button_2_single_press:
      - service: input_number.set_value
        data:
          value: 2
        target:
          entity_id: input_number.hue_tapdialswitch_02_selection
        enabled: true
    remote_button_1_hold_release:
      - service: light.toggle
        data: {}
        target:
          entity_id:
            - light.patio_lights
    remote_button_2_hold_release:
      - service: media_player.toggle
        data: {}
        target:
          entity_id:
            - media_player.allhome

And this is the same piece as in my previous post, just for TapDialSwitch_02 instead of _01 - note the repeat (or lack thereof) for the ‘direction_step’, ‘direction_slow’ vs. ‘direction_fast’:

    remote_dial_rotate_right_step:
      - service: script.turn_on
        data: {}
        target:
          entity_id:
            - script.tapdialswitch_02_turn_up
    remote_dial_rotate_right_slow:
      - repeat:
          count: "2"
          sequence:
            - service: script.turn_on
              data: {}
              target:
                entity_id: script.tapdialswitch_02_turn_up
    remote_dial_rotate_right_fast:
      - repeat:
          count: "3"
          sequence:
            - service: script.turn_on
              data: {}
              target:
                entity_id: script.tapdialswitch_02_turn_up
    remote_dial_rotate_left_step:
      - service: script.turn_on
        data: {}
        target:
          entity_id:
            - script.tapdialswitch_02_turn_down
    remote_dial_rotate_left_slow:
      - repeat:
          count: "2"
          sequence:
            - service: script.turn_on
              data: {}
              target:
                entity_id: script.tapdialswitch_02_turn_down
    remote_dial_rotate_left_fast:
      - repeat:
          count: "3"
          sequence:
            - service: script.turn_on
              data: {}
              target:
                entity_id: script.tapdialswitch_02_turn_down

Here are the scripts that adjust either brightness or volume, depending on the helper value.

Increase brightness/volume:

alias: TapDialSwitch 02 - Turn Up
sequence:
  - if:
      - condition: state
        entity_id: input_number.hue_tapdialswitch_02_selection
        state: "1.0"
    then:
      - service: script.turn_on
        data: {}
        target:
          entity_id: script.patio_lights_brightness_up
    else:
      - service: script.turn_on
        data: {}
        target:
          entity_id: script.allhome_volume_up
mode: queued
max: 5

Decrease brightness/volume:

alias: TapDialSwitch 02 - Turn Down
sequence:
  - if:
      - condition: state
        entity_id: input_number.hue_tapdialswitch_02_selection
        state: "1.0"
    then:
      - service: script.turn_on
        data: {}
        target:
          entity_id:
            - script.patio_lights_brightness_down
    else:
      - service: script.turn_on
        data: {}
        target:
          entity_id:
            - script.allhome_volume_down
mode: queued
max: 5

I only have the need for switching/adjusting two entities, the light on button 1 for brightness and the allhome media player for on button 2 volume - I understand that this section would get much more complicated (with nested if-then-else code) if I needed more than two entities, i.e. wanted to use more than 2 buttons on the TapDialSwitch to invoke turning items up or down.

The scripts for the volume adjustment are in a previous post, the ones for brightness are below:

alias: Patio Lights Brightness Up
sequence:
  - service: light.turn_on
    data:
      brightness_step: 10
    target:
      entity_id:
        - light.patio_lights
mode: queued
icon: mdi:lightbulb-on-30
max: 5

alias: Patio Lights Brightness Down
sequence:
  - service: light.turn_on
    data:
      brightness_step: -10
    target:
      entity_id:
        - light.patio_lights
mode: queued
icon: mdi:lightbulb-on-30
max: 5

I’m sure there is massive room for improvement, but I’m happy that I got it to this point :wink:
Hope that helps.

Thanks for the guide. I think I can figure it out from here.

Hi all. Beginner question here:

I added the tap dial with sonoff zigbee home automation. This works because I can see the buttons being registered when pressed. So what do I have to do next to make the tap dail working in this blueprint? I can’t seem to figure out which sensor I have to use in the entity field off the blueprint. I only have a battery sensor available.
Thanks

I have configured the 4 buttons on my Hue Tap Dial to play different radio stations. To keep track of my radio stations, I added a TTS message to each one, which gives me back the message of which station I selected. When I long press a button, the automation always starts over. The TTS message starts again from the beginning every second. Is there any way to fix this? Thanks for this great blueprint :slight_smile:

This only works with Zigbee2MQTT (Z2M).
You need a different blueprint for ZHA.