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.

1 Like

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.

I had some problems with this not always running the action, but changing the blueprint from mode: restart to mode: queued fixed it.
I think what was happening is the button press action was not always complete before the release action came in.

Can someone please explain me how to pair/add this Tap Dial Switch to ZHA? I have the switch with the Cell in it. I tried all kind of pressing/holding buttons and so on… no success thus far. Bit frustrating, hope the device is not broken, but like to have some input on how to pair it.

Just bought it new of the shelf.

@hfeenstra
If you open the battery compartment there is a small reset hole. Push the button inside for like 3 secs with paperclip and the tapdail will reset and go into pairing mode. Make sure to allow pairing in ZHA before doing this so it will recognise it.

what about

As far as I can see there’s quite a bit of overlap between the ‘new’ types and the existing actions.

  • action_direction is already a part of the main action.
  • Action type indicates whether a rotation is small (step) or fast (rotation). So that also overlaps.
  • The action_time property seems to be a bit more fine-grained as to how fast the rotation was. Since I don’t really have a need for this I will not incorporate it into the blueprint myself, but if anyone has a proposal how to, they could create one.

Is there a way to set brightness and color when pressing a button?
My kitchen for example has a morning automation for the wife and the lights are set low. When I go into the kitchen and use the hue tap I would like the lights to come on at a set brightness and color.
I am currently using a blueprint for the Ikea switch for the kitchen which has this implemented. My plan is to replace this switch with the hue Tap.

Thank for the hard work!

Yes there is, use this in your action.

There is another problem I am seeing in the two rooms I setup. Both have 1 light that will not toggle on with the rest of the lights. They will however toggle on on the second press when the rest of the light turn off. These rooms are setup on differs t buttons on the switch.
Very strange behaviour that I can not understand why.
Any ideas?

Edit:
So I can get button 2 to toggle a scene, single press. I can not get button 1 to toggle (single press) . Button one turns the lights on to the button 2 scene (weird). I have removed and redone button 1 many times with the same outcome!
On a side note, is there a way to use a group of lights?

Thanks

Ok so I have found 2 issues.
First one is a problem with the hue Tap. I will warranty it next week.

The second is as far as I can tell, the blueprint or how I am trying to use it. Let me explain. If I set up button 1 with a scene or device/entities (press) it works fine. If i now add a scene to the same button as press/release it stumbles. The light won’t turn off on a single press but will flash, then turn on the scene set to press/release. If i press and hold, the lights will toggle off. Press and hold is not setup at all. So where did it get a press/hold command from? I have tried this on 3 tap switches with the same result no matter what button I choose/setup.
The devices/entities and the scenes are selected from call service if that helps.

Edit:
It would appear that the blueprint is activating the different presses as one. I added a fan toggle to my bedroom on press/hold. I already have a single press to toggle the lights on the same button (same room). When I press/hold it will turn the lights on and maybe toggle the fan. The fan sometimes comes on then as I release the button turns off.

Am I Doing something wrong?
How to fix this?

Thanks

I recently migrated from ZHA to Z2M and used that ZHA Blueprint. Since I am not that good in coding I was wandering what needs to be done to change the blueprint in order to get that funcionality. It was pretty slick to have the possibility to adjust the brightness of the recent light